Add templates, tests, and miscellaneous project files
Includes new page templates (fitness-gym, nonprofit, online-course, photography-studio, real-estate, startup-company, travel-blog, wedding-invitation) with thumbnail SVGs, test specs, documentation files, and minor updates to index.html, router.php, and playwright config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
52
tests/media-blocks-verify.spec.js
Normal file
52
tests/media-blocks-verify.spec.js
Normal file
@@ -0,0 +1,52 @@
|
||||
const { test, expect } = require('@playwright/test');
|
||||
const { waitForEditor, addBlockById, clearCanvas } = require('./helpers');
|
||||
|
||||
test.describe('Media Category Blocks Verification', () => {
|
||||
test('should show Image, Video, and File/PDF blocks in Media category', async ({ page }) => {
|
||||
await waitForEditor(page);
|
||||
|
||||
// Verify all three blocks exist and are in Media category
|
||||
const mediaBlocks = await page.evaluate(() => {
|
||||
const editor = window.editor;
|
||||
const bm = editor.BlockManager;
|
||||
return ['image-block', 'video-block', 'file-embed'].map(id => {
|
||||
const block = bm.get(id);
|
||||
if (!block) return { id, found: false };
|
||||
const cat = block.get('category');
|
||||
return {
|
||||
id,
|
||||
found: true,
|
||||
label: block.get('label'),
|
||||
category: typeof cat === 'string' ? cat : (cat && cat.id),
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
for (const block of mediaBlocks) {
|
||||
expect(block.found).toBe(true);
|
||||
expect(block.category).toBe('Media');
|
||||
}
|
||||
|
||||
console.log('All Media blocks are registered!');
|
||||
|
||||
// Test adding Image block via API
|
||||
const imgResult = await addBlockById(page, 'image-block');
|
||||
expect(imgResult.success).toBe(true);
|
||||
|
||||
const canvas = page.frameLocator('#gjs iframe').first();
|
||||
const img = canvas.locator('img');
|
||||
await expect(img).toBeVisible({ timeout: 3000 });
|
||||
console.log('Image block added successfully');
|
||||
|
||||
// Clear canvas
|
||||
await clearCanvas(page);
|
||||
|
||||
// Test adding Video block via API
|
||||
const vidResult = await addBlockById(page, 'video-block');
|
||||
expect(vidResult.success).toBe(true);
|
||||
|
||||
const videoWrapper = canvas.locator('.video-wrapper');
|
||||
await expect(videoWrapper).toBeVisible({ timeout: 3000 });
|
||||
console.log('Video block added successfully');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user