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 { 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 }); }); 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 - ); });