Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test to verify the featured image #976

Merged
merged 4 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added featured-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions test/e2e/admin-tests/gatherpress-event-featured-image.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const { test, expect } = require('@playwright/test');
const { login } = require('../reusable-user-steps/common');

test.describe('e2e test for publish event through admin side', () => {
test.beforeEach(async ({ page }) => {
test.setTimeout(120000);
await page.setViewportSize({ width: 1920, height: 720 });
await page.waitForLoadState('networkidle');
await login({ page, username: 'prashantbellad' });
});

test('The user should be able add featured image in post and verify the added featured image post', async ({
page,
}) => {
await page.getByRole('link', { name: 'Events', exact: true }).click();
await page
.locator('#wpbody-content')
.getByRole('link', { name: 'Add New' })
.click();

await page
.getByLabel('Block: Event Date')
.locator('div')
.first()
.isVisible();

await page.getByLabel('Add title').fill('Featured Image test');

await page.getByRole('heading', { name: 'Date & time' }).isVisible();

await page.getByRole('button', { name: 'Set featured image' }).click();

await page
.locator('.attachments-wrapper')
.locator('li')
.first()
.click();

await page.getByRole('button', { name: 'Set featured image' }).click();

await page
.getByRole('button', { name: 'Publish', exact: true })
.click();
await page
.getByLabel('Editor publish')
.getByRole('button', { name: 'Publish', exact: true })
.click();
await page
.getByLabel('Editor publish')
.getByRole('link', { name: 'View Event' })
.click();
await page.locator('#wp--skip-link--target img').isVisible();

// await expect(page).toHaveScreenshot('featured_image.png', {fullPage:true})
const FeaturedImage = await page.screenshot({ fullPage: true });
expect(FeaturedImage).toMatchSnapshot('featured_image.png');
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading