Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: playwright networkidle to domcontentloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Dec 7, 2023
1 parent 136ce21 commit c0bd435
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions tests/account/stats/location.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
});

Expand All @@ -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");
});

Expand Down
4 changes: 2 additions & 2 deletions tests/account/stats/referer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
});

Expand All @@ -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");
});

Expand Down
4 changes: 2 additions & 2 deletions tests/changelog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

Expand All @@ -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/);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/docs/docs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/events.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
});

Expand Down
4 changes: 2 additions & 2 deletions tests/home.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
});
Expand All @@ -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/);
});
Expand Down
4 changes: 2 additions & 2 deletions tests/manage/premium.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/,
);
Expand All @@ -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/);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/playground.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/profile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

Expand Down
2 changes: 1 addition & 1 deletion tests/repos.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

Expand Down
4 changes: 2 additions & 2 deletions tests/search.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

Expand Down Expand Up @@ -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}`);

Expand Down

0 comments on commit c0bd435

Please sign in to comment.