From 01849c50ceb2b3861ed3263bbe59846ed9cae053 Mon Sep 17 00:00:00 2001 From: prashant bellad Date: Wed, 6 Dec 2023 09:14:53 +0530 Subject: [PATCH 01/10] config: set retries to 2 for playwright tests --- playwright.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playwright.config.js b/playwright.config.js index 4269fbc80..2b74b4830 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -17,7 +17,7 @@ module.exports = defineConfig({ /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, /* Retry on CI only */ - retries: process.env.CI ? 2 : 2, + retries: 2, /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, From 473298565999f312e91682fd30601c06bd530bb3 Mon Sep 17 00:00:00 2001 From: prashant bellad Date: Thu, 7 Dec 2023 17:59:14 +0530 Subject: [PATCH 02/10] chore: added file comment --- test/e2e/reusable-user-steps/common.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/e2e/reusable-user-steps/common.js b/test/e2e/reusable-user-steps/common.js index 43f5f2462..eae73e8f1 100644 --- a/test/e2e/reusable-user-steps/common.js +++ b/test/e2e/reusable-user-steps/common.js @@ -1,3 +1,6 @@ +/** + * This file will contain common user steps that may be required in multiple different tests + */ /** * Login user flow * @param {*} root0 From e5f5663e5d360df07d389a02ba26d9ebbba05dd3 Mon Sep 17 00:00:00 2001 From: "prayag.m_pristine" Date: Thu, 7 Dec 2023 18:21:06 +0530 Subject: [PATCH 03/10] Added test file for Venue category --- .../gatherpress-admin-venue.spec.js | 27 +++++++++++++++++++ test/e2e/reusable-user-steps/common.js | 4 +-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 test/e2e/admin-tests/gatherpress-admin-venue.spec.js diff --git a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js new file mode 100644 index 000000000..f3c5c9c8d --- /dev/null +++ b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js @@ -0,0 +1,27 @@ +const { test } = require("@playwright/test"); +const { login } = require("../reusable-user-steps/common.js"); + +test.describe(" Validate test for admin side venue test", () => { + test.beforeEach(async ({ page }) => { + test.setTimeout(120000); + await page.setViewportSize({ width: 1920, height: 720 }); + await page.waitForLoadState("networkidle"); + }); + + + test("The admin should 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('Toggle block inserter').click(); + await page.screenshot({path:"new-venue.png"}) + }) + +}); \ No newline at end of file diff --git a/test/e2e/reusable-user-steps/common.js b/test/e2e/reusable-user-steps/common.js index eae73e8f1..bd8f34470 100644 --- a/test/e2e/reusable-user-steps/common.js +++ b/test/e2e/reusable-user-steps/common.js @@ -18,11 +18,11 @@ const login = async ({ }); await page.getByLabel('Username or Email Address').isVisible(); - await page.getByLabel('Username or Email Address').fill(username); + await page.getByLabel('Username or Email Address').fill('testuser1'); await page.getByLabel('Password', { exact: true }).isVisible(); - await page.getByLabel('Password', { exact: true }).fill(password); + await page.getByLabel('Password', { exact: true }).fill('zm86079&volj&!R5maIWEYX4'); await page.getByRole('button', { name: 'Log In' }).click(); }; From bc9f5786c45109aa579836827b5a3b446a3a81e5 Mon Sep 17 00:00:00 2001 From: "prayag.m_pristine" Date: Thu, 7 Dec 2023 18:49:14 +0530 Subject: [PATCH 04/10] update the common.js file --- test/e2e/reusable-user-steps/common.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/e2e/reusable-user-steps/common.js b/test/e2e/reusable-user-steps/common.js index bd8f34470..b12023fa8 100644 --- a/test/e2e/reusable-user-steps/common.js +++ b/test/e2e/reusable-user-steps/common.js @@ -18,11 +18,10 @@ const login = async ({ }); await page.getByLabel('Username or Email Address').isVisible(); - await page.getByLabel('Username or Email Address').fill('testuser1'); + await page.getByLabel('Username or Email Address').fill(username); await page.getByLabel('Password', { exact: true }).isVisible(); - await page.getByLabel('Password', { exact: true }).fill('zm86079&volj&!R5maIWEYX4'); await page.getByRole('button', { name: 'Log In' }).click(); }; From 8483cb6cc2a09791c8b1799e73e51e09bbd2aaee Mon Sep 17 00:00:00 2001 From: "prayag.m_pristine" Date: Sat, 9 Dec 2023 13:39:40 +0530 Subject: [PATCH 05/10] test file for venue infomation add --- .../gatherpress-admin-venue.spec.js | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js index f3c5c9c8d..b7349ef94 100644 --- a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js +++ b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js @@ -1,27 +1,39 @@ -const { test } = require("@playwright/test"); -const { login } = require("../reusable-user-steps/common.js"); +const { test } = require('@playwright/test'); +const { login } = require('../reusable-user-steps/common.js'); -test.describe(" Validate test for admin side venue test", () => { +test.describe(' Validate test for admin side venue test', () => { test.beforeEach(async ({ page }) => { test.setTimeout(120000); await page.setViewportSize({ width: 1920, height: 720 }); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState('networkidle'); }); - - test("The admin should create a new post for Venue",async({page})=>{ - + test('The admin should 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.screenshot({ path: 'vanue-page.png' }); - await page.locator('#wpbody-content').getByRole('link', { name: 'Add New' }).click(); - - await page.getByLabel('Toggle block inserter').click(); - await page.screenshot({path:"new-venue.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'); -}); \ No newline at end of file + 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' }); + }); +}); From 7b295b578c874316345b9beab2bb38e1a7b15433 Mon Sep 17 00:00:00 2001 From: "prayag.m_pristine" Date: Tue, 12 Dec 2023 18:55:04 +0530 Subject: [PATCH 06/10] update the test file for venue --- test/e2e/admin-tests/gatherpress-admin-venue.spec.js | 4 ++-- test/e2e/reusable-user-steps/common.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js index b7349ef94..c8c9480dd 100644 --- a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js +++ b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js @@ -1,14 +1,14 @@ const { test } = require('@playwright/test'); const { login } = require('../reusable-user-steps/common.js'); -test.describe(' Validate test for admin side venue test', () => { +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 create a new post for Venue', async ({ page }) => { + 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(); diff --git a/test/e2e/reusable-user-steps/common.js b/test/e2e/reusable-user-steps/common.js index b12023fa8..db81483e0 100644 --- a/test/e2e/reusable-user-steps/common.js +++ b/test/e2e/reusable-user-steps/common.js @@ -3,6 +3,7 @@ */ /** * Login user flow + * * @param {*} root0 * @param {*} root0.page * @param {*} root0.username @@ -21,7 +22,7 @@ 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(); }; From e2c64d36a88d65fcb9ababf9beb734c558548ba4 Mon Sep 17 00:00:00 2001 From: "prayag.m_pristine" Date: Wed, 13 Dec 2023 16:24:01 +0530 Subject: [PATCH 07/10] update the test file for venue --- test/e2e/admin-tests/gatherpress-admin-venue.spec.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js index c8c9480dd..5d91f2c5f 100644 --- a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js +++ b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js @@ -16,10 +16,7 @@ test.describe(' e2e test for venue through admin side', () => { 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.locator('#wpbody-content').getByRole('link', { name: 'Add New' }).click(); await page.getByLabel('Add title').isVisible(); await page.getByLabel('Add title').fill('Test venue'); @@ -28,9 +25,7 @@ test.describe(' e2e test for venue through admin side', () => { 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('Empty block; start writing or').fill('test venue information'); await page.getByLabel('Toggle block inserter').click(); await page.getByRole('option', { name: 'Paragraph' }).click(); From a831df5a6abe23d0a306a2499654684539fa9fea Mon Sep 17 00:00:00 2001 From: "prayag.m_pristine" Date: Thu, 14 Dec 2023 10:11:24 +0530 Subject: [PATCH 08/10] update venue test file --- .../gatherpress-admin-venue.spec.js | 45 +++++++++++-------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js index 5d91f2c5f..ff96a6acb 100644 --- a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js +++ b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js @@ -1,34 +1,41 @@ -const { test } = require('@playwright/test'); -const { login } = require('../reusable-user-steps/common.js'); +const { test } = require("@playwright/test"); +const { login } = require("../reusable-user-steps/common.js"); -test.describe(' e2e test for venue through admin side', () => { +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'); + await page.waitForLoadState("networkidle"); }); - test('The admin should be able to create a new post for Venue', async ({ page }) => { - await login({ page, username: 'testuser1' }); + 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: "Events", exact: true }).click(); - await page.getByRole('link', { name: 'Venues' }).click(); - await page.screenshot({ path: 'vanue-page.png' }); + 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 + .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'); + 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'); + 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("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' }); + await page.getByLabel("Toggle block inserter").click(); + await page.getByRole("option", { name: "Paragraph" }).click(); + await page.screenshot({ path: "new-venue.png" }); }); }); From 67ed08b524f68d68993462e4d88afcff492a496e Mon Sep 17 00:00:00 2001 From: "prayag.m_pristine" Date: Fri, 15 Dec 2023 22:39:29 +0530 Subject: [PATCH 09/10] venue test file change the double quote to single quote --- test/e2e/admin-tests/gatherpress-admin-venue.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js index ff96a6acb..0d440e8d8 100644 --- a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js +++ b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js @@ -1,7 +1,7 @@ const { test } = require("@playwright/test"); const { login } = require("../reusable-user-steps/common.js"); -test.describe(" e2e test for venue through admin side", () => { +test.describe("e2e test for venue through admin side", () => { test.beforeEach(async ({ page }) => { test.setTimeout(120000); await page.setViewportSize({ width: 1920, height: 720 }); From a83655f048e56bceaf21a34f422337708cbb4b0f Mon Sep 17 00:00:00 2001 From: "prayag.m_pristine" Date: Sat, 16 Dec 2023 09:05:03 +0530 Subject: [PATCH 10/10] update the venue code remove double qotes --- .../gatherpress-admin-venue.spec.js | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js index 0d440e8d8..fb8a3bcba 100644 --- a/test/e2e/admin-tests/gatherpress-admin-venue.spec.js +++ b/test/e2e/admin-tests/gatherpress-admin-venue.spec.js @@ -1,41 +1,41 @@ -const { test } = require("@playwright/test"); -const { login } = require("../reusable-user-steps/common.js"); +const { test } = require('@playwright/test'); +const { login } = require('../reusable-user-steps/common.js'); -test.describe("e2e test for venue through admin side", () => { +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"); + await page.waitForLoadState('networkidle'); }); - test("The admin should be able to create a new post for Venue", async ({ + test('The admin should be able to create a new post for Venue', async ({ page, }) => { - await login({ page, username: "testuser1" }); + await login({ page, username: 'testuser1' }); - await page.getByRole("link", { name: "Events", exact: true }).click(); + 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.getByRole('link', { name: 'Venues' }).click(); + await page.screenshot({ path: 'vanue-page.png' }); await page - .locator("#wpbody-content") - .getByRole("link", { name: "Add New" }) + .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"); + 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"); + const venue = await page.$('.gp-venue__name'); + await venue.press('Backspace'); await page - .getByLabel("Empty block; start writing or") - .fill("test venue information"); + .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" }); + await page.getByLabel('Toggle block inserter').click(); + await page.getByRole('option', { name: 'Paragraph' }).click(); + await page.screenshot({ path: 'new-venue.png' }); }); });