39 lines
1.3 KiB
JavaScript
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');
|
||
|
|
});
|