Skip to content

Commit 8fe00dc

Browse files
committed
remove test helpers
1 parent 4144ef8 commit 8fe00dc

File tree

6 files changed

+12
-270
lines changed

6 files changed

+12
-270
lines changed

tests/e2e/find-wallet.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import { takeSnapshot, test } from "@chromatic-com/playwright"
22

33
import { FindWalletPage } from "./pages/FindWalletPage"
4-
import { waitForPageReady } from "./utils/testHelpers"
54

65
test.describe("Find Wallet Page", () => {
76
let findWalletPage: FindWalletPage
87

98
test.beforeEach(async ({ page }) => {
109
findWalletPage = new FindWalletPage(page)
1110
await findWalletPage.goto()
12-
await waitForPageReady(page)
11+
await findWalletPage.waitForPageReady()
1312
})
1413

1514
test("loads successfully", async ({ page }, testInfo) => {

tests/e2e/global.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { DEFAULT_LOCALE } from "@/lib/constants"
55

66
import { testData } from "./fixtures/testData"
77
import { HomePage } from "./pages/HomePage"
8-
import { waitForPageReady } from "./utils/testHelpers"
98

109
test.describe("Global", () => {
1110
test.describe("Error Handling", () => {
@@ -35,7 +34,7 @@ test.describe("Global", () => {
3534
test.beforeEach(async ({ page }) => {
3635
homePage = new HomePage(page)
3736
await homePage.goto()
38-
await waitForPageReady(page)
37+
await homePage.waitForPageReady()
3938
})
4039

4140
async function switchToChinese(page: Page, homePage: HomePage) {
@@ -70,7 +69,6 @@ test.describe("Global", () => {
7069

7170
test.beforeEach(async ({ page }) => {
7271
homePage = new HomePage(page)
73-
await waitForPageReady(page)
7472
})
7573

7674
async function switchToArabic(page: Page, homePage: HomePage) {
@@ -83,15 +81,15 @@ test.describe("Global", () => {
8381

8482
test("home page RTL visual snapshot", async ({ page }, testInfo) => {
8583
await page.goto("/ar")
86-
await waitForPageReady(page)
84+
await homePage.waitForPageReady()
8785
await takeSnapshot(page, "home-arabic-rtl", testInfo)
8886
})
8987

9088
test("nav flips logo and search button when switching to RTL via language picker", async ({
9189
page,
9290
}) => {
9391
await homePage.goto()
94-
await waitForPageReady(page)
92+
await homePage.waitForPageReady()
9593

9694
await homePage.assertUrlMatches(`/${DEFAULT_LOCALE}/`)
9795

tests/e2e/home.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ import { takeSnapshot, test } from "@chromatic-com/playwright"
22

33
import { testData } from "./fixtures/testData"
44
import { HomePage } from "./pages/HomePage"
5-
import { waitForPageReady } from "./utils/testHelpers"
65

76
test.describe("Home Page", () => {
87
let homePage: HomePage
98

109
test.beforeEach(async ({ page }) => {
1110
homePage = new HomePage(page)
1211
await homePage.goto()
13-
await waitForPageReady(page)
12+
await homePage.waitForPageReady()
1413
})
1514

1615
test("loads successfully", async ({ page }, testInfo) => {

tests/e2e/pages/BasePage.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ export class BasePage {
3737
return viewport ? viewport.width <= breakpointAsNumber.md : false
3838
}
3939

40+
/**
41+
* Wait for page to be fully loaded with all network requests completed
42+
*/
43+
async waitForPageReady(timeout = 30000): Promise<void> {
44+
await this.page.waitForLoadState("networkidle", { timeout })
45+
}
46+
4047
/**
4148
* Wait for page to be loaded and ready
4249
*/

tests/e2e/utils/index.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/e2e/utils/testHelpers.ts

Lines changed: 0 additions & 256 deletions
This file was deleted.

0 commit comments

Comments
 (0)