Skip to content

Commit

Permalink
Merge pull request #1475 from IntersectMBO/fix/test-3I-6D-4H
Browse files Browse the repository at this point in the history
Fix failing test 3I 6D and 4H
  • Loading branch information
kneerose authored Jul 5, 2024
2 parents f69f8d8 + 68b8374 commit 7514ae9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
});

0 comments on commit 7514ae9

Please sign in to comment.