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 files for Venue category of gatherpress #439

Merged
merged 12 commits into from
Dec 22, 2023
41 changes: 41 additions & 0 deletions test/e2e/admin-tests/gatherpress-admin-venue.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const { test } = require('@playwright/test');
const { login } = require('../reusable-user-steps/common.js');

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

test('The admin should be able to create a new post for Venue', async ({
page,
}) => {
await login({ page, username: 'testuser1' });

await page.getByRole('link', { name: 'Events', exact: true }).click();

await page.getByRole('link', { name: 'Venues' }).click();
await page.screenshot({ path: 'vanue-page.png' });

await page
.locator('#wpbody-content')
.getByRole('link', { name: 'Add New' })
.click();

await page.getByLabel('Add title').isVisible();
await page.getByLabel('Add title').fill('Test venue');
await page.getByLabel('Add title').press('Tab');

const venue = await page.$('.gp-venue__name');
await venue.press('Backspace');

await page
.getByLabel('Empty block; start writing or')
.fill('test venue information');

await page.getByLabel('Toggle block inserter').click();
await page.getByRole('option', { name: 'Paragraph' }).click();
await page.screenshot({ path: 'new-venue.png' });
});
});
5 changes: 4 additions & 1 deletion test/e2e/reusable-user-steps/common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/**
* This file will contain common user steps that may be required in multiple different tests
*/
/**
* Login user flow
*
* @param {*} root0
* @param {*} root0.page
* @param {*} root0.username
Expand All @@ -18,7 +22,6 @@ const login = async ({
await page.getByLabel('Username or Email Address').fill(username);

await page.getByLabel('Password', { exact: true }).isVisible();

await page.getByLabel('Password', { exact: true }).fill(password);

await page.getByRole('button', { name: 'Log In' }).click();
Expand Down
Loading