Skip to content

Commit

Permalink
Fix date test mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
kurukimi committed Aug 1, 2024
1 parent 54b6957 commit e4ac8aa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions e2e/tests/controls.mobile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ test.describe("Browse week mobile", () => {

test("Should browse weeks forward", async ({ page, t }) => {
const jump = 3;
for (let i = 0; i < jump; i++)
for (let i = 0; i < jump; i++) {
await page.getByRole("button", { name: t("controls.aria.nextWeek") }).click();
}
await expect(page).toHaveURL(`/entries/week/${startingWeek + jump}`);
});

test("Should browse weeks backward", async ({ page, t }) => {
const jump = 3;
for (let i = 0; i < jump; i++)
for (let i = 0; i < jump; i++) {
await page.getByRole("button", { name: t("controls.aria.prevWeek") }).click();
}
await expect(page).toHaveURL(`/entries/week/${startingWeek - jump}`);
});

Expand All @@ -29,8 +31,10 @@ test.describe("Browse week mobile", () => {
await expect(page).toHaveURL(`/entries/week/${currentWeek}`);
});

test("Should go to specific week", async ({ page }) => {
test("Should go to specific week", async ({ page, dayjs }) => {
const jump = 4;
const startingWeek = dayjs().week();
await page.goto(`/entries/week/${startingWeek}`);
await page.getByRole("combobox", { name: String(startingWeek) }).click();
await page.getByRole("option", { name: String(startingWeek + jump) }).click();
await expect(page).toHaveURL(`/entries/week/${startingWeek + jump}`);
Expand Down

0 comments on commit e4ac8aa

Please sign in to comment.