Skip to content

Commit c472e15

Browse files
committed
add 404 tests
1 parent 3fac8c4 commit c472e15

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

tests/e2e/fixtures/testData.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
*/
44

55
export const testData = {
6+
urls: {
7+
invalid: "/invalid-url",
8+
invalidInternationalized: "/es/invalid-url",
9+
},
10+
611
search: {
712
validQuery: "smart contract",
813
invalidQuery: "xyz123nonexistent",
@@ -34,6 +39,8 @@ export const testData = {
3439
headings: {
3540
homepage: "Ethereum.org",
3641
findWallet: "Choose your wallet",
42+
notFoundEn: "we couldn't find that page",
43+
notFoundEs: "no hemos podido encontrar esa página",
3744
},
3845
},
3946
}

tests/e2e/global.spec.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,31 @@ test.describe("Global", () => {
2020

2121
await homePage.verifyNoResults()
2222
})
23+
24+
test("handles invalid URL with 404", async ({ page }) => {
25+
await page.goto(testData.urls.invalid)
26+
await expect(
27+
page.getByRole("heading", {
28+
level: 1,
29+
name: new RegExp(testData.content.headings.notFoundEn, "i"),
30+
})
31+
).toBeVisible()
32+
})
33+
34+
test("handles invalid URL with 404 internationalized", async ({ page }) => {
35+
await page.goto(testData.urls.invalidInternationalized)
36+
await expect(
37+
page.getByRole("heading", {
38+
level: 1,
39+
name: new RegExp(testData.content.headings.notFoundEs, "i"),
40+
})
41+
).toBeVisible()
42+
})
2343
})
2444

2545
test.describe("Accessibility", () => {
2646
test("skip link - keyboard navigation", async () => {
27-
// TODO: Add skip link tests. Part of #15663
47+
// TODO: Add skip link tests.
2848
})
2949
})
3050

0 commit comments

Comments
 (0)