diff --git a/test/e2e/admin-tests/gatherpress-admin-event-details.spec.js b/test/e2e/admin-tests/gatherpress-admin-event-details.spec.js index 398e1353e..3fba0dea4 100644 --- a/test/e2e/admin-tests/gatherpress-admin-event-details.spec.js +++ b/test/e2e/admin-tests/gatherpress-admin-event-details.spec.js @@ -40,14 +40,22 @@ test.describe('e2e test for event post, verify the event time is visible on fron .getByRole('link', { name: 'View Event' }) .click(); - await expect( - page.locator('.wp-block-gatherpress-event-date') - ).toBeVisible(); - const details = await page.locator('.wp-block-gatherpress-event-date'); - expect(await details.screenshot()).toMatchSnapshot( - 'event-post-details.png' - ); + + await page.locator('#wp--skip-link--target').isVisible(); + await page + .locator('#wp--skip-link--target') + .screenshot({ path: 'event-details-post.png' }); + + await expect(page).toHaveScreenshot('event_details.png', { + fullPage: true, + mask: [ + page.locator('header'), + page.locator('h1'), + page.locator('footer'), + ], + }); + }); }); diff --git a/test/e2e/admin-tests/gatherpress-admin-venue-map.spec.js b/test/e2e/admin-tests/gatherpress-admin-venue-map.spec.js index eccddf82c..966ebaba9 100644 --- a/test/e2e/admin-tests/gatherpress-admin-venue-map.spec.js +++ b/test/e2e/admin-tests/gatherpress-admin-venue-map.spec.js @@ -58,6 +58,8 @@ test.describe('e2e test for venue map through admin side', () => { page.locator('h1'), page.locator('footer'), ], + }); + }); }); diff --git a/test/e2e/admin-tests/gatherpress-event-featured-image.spec.js b/test/e2e/admin-tests/gatherpress-event-featured-image.spec.js index f5adfa993..df14e2dec 100644 --- a/test/e2e/admin-tests/gatherpress-event-featured-image.spec.js +++ b/test/e2e/admin-tests/gatherpress-event-featured-image.spec.js @@ -1,6 +1,8 @@ const { test, expect } = require('@playwright/test'); + const { login } = require('../reusable-user-steps/common.js'); + test.describe('e2e test for publish event through admin side', () => { test.beforeEach(async ({ page }) => { test.setTimeout(120000); @@ -13,6 +15,7 @@ test.describe('e2e test for publish event through admin side', () => { page, }) => { const postName = `featuredImage-${Math.random().toString(36).substring(2)}`; + await page.getByRole('link', { name: 'Events', exact: true }).click(); await page .locator('#wpbody-content') @@ -28,8 +31,10 @@ test.describe('e2e test for publish event through admin side', () => { await page.getByLabel('Add title').fill(postName); await page.getByRole('heading', { name: 'Date & time' }).isVisible(); + await page.getByLabel('Settings', { exact: true }).click(); await page.getByRole('button', { name: 'Event settings' }).click(); + await page.getByRole('button', { name: 'Set featured image' }).click(); await page @@ -52,6 +57,7 @@ test.describe('e2e test for publish event through admin side', () => { .getByRole('link', { name: 'View Event' }) .click(); await page.locator('#wp--skip-link--target img').isVisible(); + await page.waitForLoadState('networkidle'); const FeaturedImage = await page.screenshot({ fullPage: true, @@ -65,6 +71,7 @@ test.describe('e2e test for publish event through admin side', () => { page.locator('footer'), ], }); + expect(FeaturedImage).toMatchSnapshot('featured_image.png'); }); }); diff --git a/test/e2e/admin-tests/gatherpress-event-loggedIn.spec.js b/test/e2e/admin-tests/gatherpress-event-loggedIn.spec.js index 25f713f54..a33101764 100644 --- a/test/e2e/admin-tests/gatherpress-event-loggedIn.spec.js +++ b/test/e2e/admin-tests/gatherpress-event-loggedIn.spec.js @@ -18,6 +18,8 @@ test.describe('e2e test for publish event through admin side', () => { .getByRole('link', { name: 'Add New' }) .click(); + await page.getByLabel('Add title').fill('online event'); + await page .getByLabel('Block: Event Date') .locator('div') @@ -25,9 +27,14 @@ test.describe('e2e test for publish event through admin side', () => { .isVisible(); await page.getByRole('heading', { name: 'Date & time' }).isVisible(); + await page.getByLabel('Settings', { exact: true }).click(); + await page.getByLabel('Settings', { exact: true }).click(); + await page.getByRole('button', { name: 'Event settings' }).click(); - await page.getByLabel('Venue Selector').selectOption('58:online-event'); + await page.getByRole('button', { name: 'Event settings' }).click(); + await page.getByRole('button', { name: 'Event settings' }).click(); + await page.getByLabel('Venue Selector').selectOption('33:online-event'); const currentDate = new Date().toISOString().split('T')[0]; // format YYYY-MM-DD const eventTitle = await page .getByLabel('Add title') diff --git a/test/e2e/admin-tests/gatherpress-event-nonLoggegIn.spec.js b/test/e2e/admin-tests/gatherpress-event-nonLoggegIn.spec.js index fc1920b6c..c230305dc 100644 --- a/test/e2e/admin-tests/gatherpress-event-nonLoggegIn.spec.js +++ b/test/e2e/admin-tests/gatherpress-event-nonLoggegIn.spec.js @@ -13,18 +13,17 @@ test.describe('e2e test for home page event on develop.gatherpress.org', () => { test.skip('01-the user should be able to publish an offline event', async ({ page, }) => { + await login({ page, username: 'prashantbellad' }); await page.getByRole('link', { name: 'Events', exact: true }).click(); await page .locator('#wpbody-content') .getByRole('link', { name: 'Add New' }) .click(); - const currentDate = new Date().toISOString().split('T')[0]; // format YYYY-MM-DD const eventTitle = await page .getByLabel('Add title') .fill(`offline T-Event:${currentDate}`); - await page .getByLabel('Block: Event Date') .locator('div') @@ -33,9 +32,12 @@ test.skip('01-the user should be able to publish an offline event', async ({ await page.getByRole('heading', { name: 'Date & time' }).isVisible(); await page.getByRole('button', { name: 'Event settings' }).click(); - await page.getByLabel('Venue Selector').selectOption('offline event'); - await page.getByRole('button', { name: 'Event settings' }).click(); + await page.getByRole('button', { name: 'Event settings' }).click(); + + await page + .getByLabel('Venue Selector') + .selectOption('73:test-offline-event'); await page.getByRole('button', { name: 'Publish', exact: true }).click(); await page @@ -45,11 +47,11 @@ test.skip('01-the user should be able to publish an offline event', async ({ await page .getByText(`${eventTitle} is now live.`) - .isVisible({ timeout: 60000 }); //verified the event is live. + .isVisible({ timeout: 60000 }); // verified the event is live. await page .locator('.post-publish-panel__postpublish-buttons') .filter({ hasText: 'View Event' }) - .isVisible(); //verify the view event button. + .isVisible({ timeout: 30000 }); // verified the view event button. }); test('02-verify the non-logged in user view RSVP button on home page and perform RSVP action', async ({ diff --git a/test/e2e/admin-tests/gatherpress-event-venue-map.spec.js b/test/e2e/admin-tests/gatherpress-event-venue-map.spec.js index 74289f14c..45eda6509 100644 --- a/test/e2e/admin-tests/gatherpress-event-venue-map.spec.js +++ b/test/e2e/admin-tests/gatherpress-event-venue-map.spec.js @@ -29,7 +29,9 @@ test.describe('e2e test for event, the user should view the event map on event p .getByRole('link', { name: 'Add New Event' }) .click(); + await page.getByLabel('Add title').fill(postName); + await page .getByLabel('Block: Event Date') .locator('div') diff --git a/test/e2e/admin-tests/gatherpress-event.spec.js b/test/e2e/admin-tests/gatherpress-event.spec.js index 6013e0179..6fd833182 100644 --- a/test/e2e/admin-tests/gatherpress-event.spec.js +++ b/test/e2e/admin-tests/gatherpress-event.spec.js @@ -12,6 +12,7 @@ test.describe('e2e test for publish event through admin side', () => { test('the user should be able to publish an online event', async ({ page, }) => { + await login({ page, username: 'prashantbellad' }); await page.getByRole('link', { name: 'Events', exact: true }).click(); await page .locator('#wpbody-content') @@ -66,6 +67,7 @@ test.describe('e2e test for publish event through admin side', () => { test.skip('the user should be able publish an offline event', async ({ page, }) => { + await login({ page, username: 'prashantbellad' }); await page.getByRole('link', { name: 'Events', exact: true }).click(); await page .locator('#wpbody-content') @@ -87,9 +89,8 @@ test.describe('e2e test for publish event through admin side', () => { await page.getByRole('button', { name: 'Event settings' }).click(); await page .getByLabel('Venue Selector') - .selectOption('offline event', { timeout: 60000 }); + .selectOption('73:test-offline-event'); - await page.getByRole('button', { name: 'Event settings' }).click(); await page .getByRole('button', { name: 'Publish', exact: true }) .click(); diff --git a/test/e2e/admin-tests/gatherpress-venue-map-toggle-ON.spec.js b/test/e2e/admin-tests/gatherpress-venue-map-toggle-ON.spec.js index ed64759a2..b5984f2af 100644 --- a/test/e2e/admin-tests/gatherpress-venue-map-toggle-ON.spec.js +++ b/test/e2e/admin-tests/gatherpress-venue-map-toggle-ON.spec.js @@ -18,6 +18,7 @@ test.describe('e2e test for venue map through admin side', () => { await page.getByRole('link', { name: 'Venues' }).click(); await page.getByRole('link', { name: 'Add New Venue' }).click(); + await page.getByLabel('Add title').fill(postName); await page @@ -29,6 +30,7 @@ test.describe('e2e test for venue map through admin side', () => { await page.getByLabel('Settings', { exact: true }).click(); + await page.getByRole('button', { name: 'Venue settings' }).click(); await page.getByLabel('Full Address').fill('hinjewadi, pune, India'); @@ -67,6 +69,8 @@ test.describe('e2e test for venue map through admin side', () => { page.locator('.wp-block-template-part'), page.locator('.wp-block-gatherpress-event-date'), ], + + }); }); });