From c0bd4355700ec0791c661e2b79eb8be13aaf2174 Mon Sep 17 00:00:00 2001 From: Eddie Jaoude Date: Thu, 7 Dec 2023 06:48:34 +0100 Subject: [PATCH] fix: playwright networkidle to domcontentloaded --- tests/account/stats/location.spec.js | 4 ++-- tests/account/stats/referer.spec.js | 4 ++-- tests/changelog.spec.js | 4 ++-- tests/docs/docs.spec.js | 2 +- tests/events.spec.js | 2 +- tests/home.spec.js | 4 ++-- tests/manage/premium.spec.js | 4 ++-- tests/playground.spec.js | 2 +- tests/profile.spec.js | 2 +- tests/repos.spec.js | 2 +- tests/search.spec.js | 4 ++-- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/account/stats/location.spec.js b/tests/account/stats/location.spec.js index ce1271150f8..a47fd5d54f1 100644 --- a/tests/account/stats/location.spec.js +++ b/tests/account/stats/location.spec.js @@ -24,7 +24,7 @@ test("Logged in free user cannot access premium locations stats", async ({ const context = await login(browser); const page = await context.newPage(); await page.goto("/account/statistics/locations"); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL(/account\/onboarding/); }); @@ -34,7 +34,7 @@ test("Logged in premium user can access premium locations stats", async ({ const context = await login(browser, premiumUser); const page = await context.newPage(); await page.goto("/account/statistics/locations"); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL("/account/statistics/locations"); }); diff --git a/tests/account/stats/referer.spec.js b/tests/account/stats/referer.spec.js index 934cc47c2b0..2f2ef0c6e1a 100644 --- a/tests/account/stats/referer.spec.js +++ b/tests/account/stats/referer.spec.js @@ -22,7 +22,7 @@ test("Logged in free user cannot access premium referers stats", async ({ const context = await login(browser); const page = await context.newPage(); await page.goto("/account/statistics/referers"); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL(/account\/onboarding/); }); @@ -32,7 +32,7 @@ test("Logged in premium user can access premium referers stats", async ({ const context = await login(browser, premiumUser); const page = await context.newPage(); await page.goto("/account/statistics/referers"); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL("/account/statistics/referers"); }); diff --git a/tests/changelog.spec.js b/tests/changelog.spec.js index 190717a5daf..6d8f9c001bf 100644 --- a/tests/changelog.spec.js +++ b/tests/changelog.spec.js @@ -11,7 +11,7 @@ test("Changelog has title", async ({ page }) => { test("Navigate to Changelog", async ({ page }) => { await page.goto("/roadmap"); await page.getByRole("link", { name: "See full list" }).click(); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page.locator("h1")).toHaveText("Changelog"); }); @@ -28,7 +28,7 @@ test("Footer link goes to GitHub", async ({ page }) => { const getFooter = page.getByText("Powered by EddieHub"); await getFooter.click(); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL(/github/); }); diff --git a/tests/docs/docs.spec.js b/tests/docs/docs.spec.js index ed73200539d..ab51267bcfa 100644 --- a/tests/docs/docs.spec.js +++ b/tests/docs/docs.spec.js @@ -12,7 +12,7 @@ test("docs has quickstart link", async ({ page }) => { const getStarted = page.locator('h3:has-text("Quickstart")'); await getStarted.click(); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL(/quickstart/); }); diff --git a/tests/events.spec.js b/tests/events.spec.js index 3ef2d61a915..72574550d1f 100644 --- a/tests/events.spec.js +++ b/tests/events.spec.js @@ -10,7 +10,7 @@ test("Click on events profile in navbar navigates to events page", async ({ .getByRole("navigation") .getByRole("link", { name: "Events" }) .click(); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL(/\/events/); }); diff --git a/tests/home.spec.js b/tests/home.spec.js index e4dac979639..389f5c80212 100644 --- a/tests/home.spec.js +++ b/tests/home.spec.js @@ -13,7 +13,7 @@ test("homepage has example link", async ({ page }) => { await page.goto("/"); const getStarted = page.getByText("Example"); await getStarted.click(); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL(/eddiejaoude/); }); @@ -23,7 +23,7 @@ test("Footer link goes to GitHub", async ({ page }) => { const getFooter = page.getByText("Powered by EddieHub"); await getFooter.click(); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL(/github/); }); diff --git a/tests/manage/premium.spec.js b/tests/manage/premium.spec.js index 0d0ade75898..1102f743654 100644 --- a/tests/manage/premium.spec.js +++ b/tests/manage/premium.spec.js @@ -22,7 +22,7 @@ test("Logged in user can access manage premium but has alert", async ({ const context = await login(browser); const page = await context.newPage(); await page.goto("/account/manage/premium"); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page.locator("div.alert-warning")).toHaveText( /Please upgrade your account for these to take effect/, ); @@ -35,7 +35,7 @@ test("Logged in user can access manage premium but has no alert", async ({ const context = await login(browser, premiumUser); const page = await context.newPage(); await page.goto("/account/manage/premium"); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page.locator("div.alert-warning")).toBeHidden(); await expect(page).toHaveURL(/account\/manage\/premium/); }); diff --git a/tests/playground.spec.js b/tests/playground.spec.js index c142a745bf3..60a862c19bd 100644 --- a/tests/playground.spec.js +++ b/tests/playground.spec.js @@ -39,7 +39,7 @@ test("Footer link goes to GitHub", async ({ page }) => { const getFooter = page.getByText("Powered by EddieHub"); await getFooter.click(); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL(/github/); }); diff --git a/tests/profile.spec.js b/tests/profile.spec.js index 5bf6b80e73e..3c04d4eb53b 100644 --- a/tests/profile.spec.js +++ b/tests/profile.spec.js @@ -120,7 +120,7 @@ test("Link navigates", async ({ page }) => { test("redirect to search when tag clicked", async ({ page }) => { await page.goto("/_test-profile-user-6"); await page.getByRole("button", { name: "Open Source" }).first().click(); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL("search?keyword=open%20source"); }); diff --git a/tests/repos.spec.js b/tests/repos.spec.js index e1afce2264b..ae7f8032195 100644 --- a/tests/repos.spec.js +++ b/tests/repos.spec.js @@ -8,7 +8,7 @@ test("Click on repos in navbar navigates to repo page", async ({ page }) => { .getByRole("navigation") .getByRole("link", { name: "Repos" }) .click(); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page).toHaveURL("/repos"); }); diff --git a/tests/search.spec.js b/tests/search.spec.js index fb066d7722d..522ef6dd04f 100644 --- a/tests/search.spec.js +++ b/tests/search.spec.js @@ -15,7 +15,7 @@ test("Navigate to the Search page", async ({ page }) => { .getByRole("navigation") .getByRole("link", { name: "Search" }) .click(); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await expect(page.locator("h1")).toHaveText("Search"); }); @@ -81,7 +81,7 @@ test("Search term persistence after navigating back", async ({ page }) => { // 2. Navigate to profile await expect(page).toHaveURL(`/search?userSearchParam=${searchTerm}`); - await page.waitForLoadState("networkidle"); + await page.waitForLoadState("domcontentloaded"); await page.locator(`a h2:has-text('${searchTerm}')`).click(); await page.waitForURL(`/${searchTerm}`);