From fc90e0f49014e3c7599a980dffe7fe2dbc9e1fe5 Mon Sep 17 00:00:00 2001 From: niraj Date: Mon, 1 Jul 2024 13:27:19 +0545 Subject: [PATCH 1/3] chore: Add st,nd,rd also on date regex --- .../playwright/lib/helpers/extractExpiryDateFromText.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/helpers/extractExpiryDateFromText.ts b/tests/govtool-frontend/playwright/lib/helpers/extractExpiryDateFromText.ts index 833fe3064..7f42d8817 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/extractExpiryDateFromText.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/extractExpiryDateFromText.ts @@ -14,13 +14,13 @@ const monthNames = [ ]; export default function extractExpiryDateFromText(text: string): Date | null { - const regex = /(\d{1,2})th ([\w]{3}) (\d{4})/; + const regex = /(\d{1,2})(st|nd|rd|th) ([\w]{3}) (\d{4})/; const match = text.match(regex); if (match) { const day = parseInt(match[1]); - const month = match[2]; - const year = parseInt(match[3]); + const month = match[3]; + const year = parseInt(match[4]); return new Date(year, monthNames.indexOf(month), day); } else { From a601d5b328f250612beca6585b608983143ff7f8 Mon Sep 17 00:00:00 2001 From: niraj Date: Mon, 1 Jul 2024 13:30:22 +0545 Subject: [PATCH 2/3] chore: Remove GA learn more action test in disconnect state Remove learn more button test of governance action in disconnect state as there is view proposal button instead of learn more --- .../tests/6-miscellaneous/miscellaneous.spec.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts index 2a65c17b4..c574c8696 100644 --- a/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts +++ b/tests/govtool-frontend/playwright/tests/6-miscellaneous/miscellaneous.spec.ts @@ -76,12 +76,4 @@ test("6D. Should open Sanchonet docs in a new tab when clicking `Learn More` on page.getByTestId("lear-more-about-sole-voter-button").click(), ]); await expect(directVoterLearnMorepage).toHaveURL(DIRECT_VOTER_DOC_URL); - - const [proposed_GA_VoterLearnMorepage] = await Promise.all([ - context.waitForEvent("page"), - page.getByRole("button", { name: "Learn more" }).nth(3).click(), // BUG missing test id - ]); - await expect(proposed_GA_VoterLearnMorepage).toHaveURL( - PROPOSE_GOVERNANCE_ACTION_DOC_URL - ); }); From 68b837409e61fbedcbcccbbe34a78943e2b46e8c Mon Sep 17 00:00:00 2001 From: niraj Date: Mon, 1 Jul 2024 13:46:45 +0545 Subject: [PATCH 3/3] Chore: Ensure exact text match 'In Progress' in test 3I Make exact text match 'In Progress' in test 3I assertion as it is also taking in progress of --- .../tests/3-drep-registration/dRepRegistration.dRep.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts index 0c194a69b..27bc037ed 100644 --- a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts @@ -181,7 +181,7 @@ test.describe("Temporary DReps", () => { .click(); await expect( - dRepPage.locator("span").filter({ hasText: "In Progress" }) + dRepPage.locator("span").filter({ hasText: /^In Progress$/ }) ).toBeVisible(); // BUG add proper testId for dRep registration card }); });