Skip to content

Commit ff8c4c1

Browse files
committed
fix(ci): nav test await url
1 parent 9d212ee commit ff8c4c1

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

starters/e2e/e2e.signals.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ test.describe("signals", () => {
347347
await expect(text2).toHaveText("Value: from1");
348348

349349
await input.clear();
350-
await textarea.type("from2");
350+
await textarea.fill("from2");
351351
await expect(input).toHaveValue("from2");
352352
await expect(textarea).toHaveValue("from2");
353353
await expect(text1).toHaveText("Value: from2");

starters/e2e/qwikcity/nav.spec.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ test.describe("actions", () => {
6262
// Without this, sometimes the URL is #hash-1
6363
await page.waitForTimeout(100);
6464

65-
expect(page).toHaveURL(
65+
await expect(page).toHaveURL(
6666
"/qwikcity-test/scroll-restoration/hash/#hash-2",
6767
);
6868
let scrollY1;
@@ -77,20 +77,29 @@ test.describe("actions", () => {
7777
await scrollTo(page, 0, 1000);
7878
await link2.click();
7979

80-
expect(page).toHaveURL(
80+
await expect(page).toHaveURL(
8181
"/qwikcity-test/scroll-restoration/hash/#hash-1",
8282
);
8383
await page.waitForTimeout(50);
84-
const scrollY2 = (await getWindowScrollXY(page))[1];
84+
let scrollY2;
85+
do {
86+
await page.waitForTimeout(10);
87+
scrollY2 = (await getWindowScrollXY(page))[1];
88+
} while (scrollY2 > 500);
8589
expect(scrollY2).toBeGreaterThan(70);
8690
expect(scrollY2).toBeLessThan(90);
8791

8892
const link3 = page.locator("#no-hash");
8993
await scrollTo(page, 0, 2000);
9094
await link3.click();
9195

92-
expect(page).toHaveURL("/qwikcity-test/scroll-restoration/hash/");
96+
await expect(page).toHaveURL("/qwikcity-test/scroll-restoration/hash/");
9397
await page.waitForTimeout(50);
98+
let scrollY3;
99+
do {
100+
await page.waitForTimeout(10);
101+
scrollY3 = (await getWindowScrollXY(page))[1];
102+
} while (scrollY3 > 1000);
94103
expect(await getWindowScrollXY(page)).toStrictEqual([0, 0]);
95104
});
96105
test("should restore scroll on back and forward navigations", async ({

0 commit comments

Comments
 (0)