Files
site-builder/tests/media-blocks-simple.spec.js
Josh Knapp b511a6684d 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>
2026-03-01 14:15:58 -08:00

39 lines
1.3 KiB
JavaScript

const { test, expect } = require('@playwright/test');
const { waitForEditor, addBlockById } = require('./helpers');
test('Media category should have 3 blocks: Image, Video, File/PDF', async ({ page }) => {
await waitForEditor(page);
// Verify all 3 media blocks are registered
const mediaBlocks = await page.evaluate(() => {
const editor = window.editor;
const bm = editor.BlockManager;
return {
image: !!bm.get('image-block'),
video: !!bm.get('video-block'),
fileEmbed: !!bm.get('file-embed'),
};
});
expect(mediaBlocks.image).toBe(true);
expect(mediaBlocks.video).toBe(true);
expect(mediaBlocks.fileEmbed).toBe(true);
// Verify they are in the Media category
const categories = 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);
const cat = block.get('category');
return { id, category: typeof cat === 'string' ? cat : (cat && cat.id) };
});
});
for (const block of categories) {
expect(block.category).toBe('Media');
}
console.log('All 3 Media blocks verified: Image, Video, File/PDF');
});