Skip to content

Commit 72e5c5a

Browse files
authored
Merge pull request #976 from prashantabellad/featured-image
test to verify the featured image
2 parents c1d0494 + b7ecbf2 commit 72e5c5a

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

featured-image.png

559 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
const { test, expect } = require('@playwright/test');
2+
const { login } = require('../reusable-user-steps/common');
3+
4+
test.describe('e2e test for publish event through admin side', () => {
5+
test.beforeEach(async ({ page }) => {
6+
test.setTimeout(120000);
7+
await page.setViewportSize({ width: 1920, height: 720 });
8+
await page.waitForLoadState('networkidle');
9+
await login({ page, username: 'prashantbellad' });
10+
});
11+
12+
test('The user should be able add featured image in post and verify the added featured image post', async ({
13+
page,
14+
}) => {
15+
await page.getByRole('link', { name: 'Events', exact: true }).click();
16+
await page
17+
.locator('#wpbody-content')
18+
.getByRole('link', { name: 'Add New' })
19+
.click();
20+
21+
await page
22+
.getByLabel('Block: Event Date')
23+
.locator('div')
24+
.first()
25+
.isVisible();
26+
27+
await page.getByLabel('Add title').fill('Featured Image test');
28+
29+
await page.getByRole('heading', { name: 'Date & time' }).isVisible();
30+
31+
await page.getByRole('button', { name: 'Set featured image' }).click();
32+
33+
await page
34+
.locator('.attachments-wrapper')
35+
.locator('li')
36+
.first()
37+
.click();
38+
39+
await page.getByRole('button', { name: 'Set featured image' }).click();
40+
41+
await page
42+
.getByRole('button', { name: 'Publish', exact: true })
43+
.click();
44+
await page
45+
.getByLabel('Editor publish')
46+
.getByRole('button', { name: 'Publish', exact: true })
47+
.click();
48+
await page
49+
.getByLabel('Editor publish')
50+
.getByRole('link', { name: 'View Event' })
51+
.click();
52+
await page.locator('#wp--skip-link--target img').isVisible();
53+
54+
// await expect(page).toHaveScreenshot('featured_image.png', {fullPage:true})
55+
const FeaturedImage = await page.screenshot({ fullPage: true });
56+
expect(FeaturedImage).toMatchSnapshot('featured_image.png');
57+
});
58+
});

0 commit comments

Comments
 (0)