Skip to content

Commit 85bb522

Browse files
dev: add E2E tests (#1151)
1 parent 33d0c51 commit 85bb522

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

tests/e2e/specs/classic-block.spec.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,30 @@ test.describe('Feedzy Classic Block', () => {
124124
const image = page.locator('.feedzy-rss .rss_image img');
125125
await expect(image).toHaveAttribute('style', /aspect-ratio:\s*auto;/i);
126126
});
127+
128+
test('embed youtube video', async ({ editor, page, admin }) => {
129+
await admin.createNewPost();
130+
131+
await editor.insertBlock({
132+
name: 'feedzy-rss-feeds/feedzy-block',
133+
attributes: {
134+
feeds: 'https://www.youtube.com/feeds/videos.xml?channel_id=UCSHmNs-_UuU1CfPhSbilTZQ',
135+
max: 1,
136+
},
137+
});
138+
139+
const postId = await editor.publishPost();
140+
await page.goto(`/?p=${postId}`);
141+
142+
const rssContainer = page.locator('.rss_item').first();
143+
await expect(rssContainer).toBeVisible();
144+
145+
const youtubeLink = rssContainer
146+
.locator('a[href*="youtube.com/"]')
147+
.first();
148+
await expect(youtubeLink).toBeVisible();
149+
150+
const image = rssContainer.locator('img').first();
151+
await expect(image).toBeVisible();
152+
});
127153
});

tests/e2e/specs/import.spec.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,4 +304,31 @@ test.describe('Feed Import', () => {
304304
page.locator('.attachment').count()
305305
).resolves.toBeGreaterThan(0); // We should have some imported images.
306306
});
307+
308+
test('close Feedzy Action modal when clicking outside', async ({
309+
page,
310+
}) => {
311+
await page.goto('/wp-admin/post-new.php?post_type=feedzy_imports');
312+
await tryCloseTourModal(page);
313+
314+
await page
315+
.getByRole('button', { name: 'Step 3 Map content ' })
316+
.click();
317+
318+
await expect(
319+
page.getByText('Post Title item title Item')
320+
).toBeVisible();
321+
322+
await page.getByTitle('item title').getByRole('link').click();
323+
324+
await expect(
325+
page.getByRole('heading', { name: 'Add actions to this tag' })
326+
).toBeVisible();
327+
328+
await page.locator('body').click({ position: { x: 0, y: 0 } });
329+
330+
await expect(
331+
page.getByRole('heading', { name: 'Add actions to this tag' })
332+
).not.toBeVisible();
333+
});
307334
});

0 commit comments

Comments
 (0)