Skip to content

Commit 589f974

Browse files
test(e2e): mainnet 404
1 parent c7e021c commit 589f974

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/e2e/storage/404.spec.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { expect, test } from '@playwright/test';
2+
import type { Page } from 'playwright-core';
3+
4+
test.describe('redirect to 404', () => {
5+
const testCases: {
6+
name: string;
7+
invalidUrls: string[];
8+
wait?: (params: { page: Page }) => Promise<void>;
9+
}[] = [
10+
{
11+
name: 'astro-demo',
12+
invalidUrls: [
13+
'https://nkzsw-gyaaa-aaaal-ada3a-cai.icp0.io/unknown',
14+
'https://nkzsw-gyaaa-aaaal-ada3a-cai.icp0.io/unknown/unknown'
15+
]
16+
},
17+
{
18+
name: 'juno-docs',
19+
invalidUrls: [
20+
'https://juno.build/unknown',
21+
'https://juno.build/unknown/unknown',
22+
'https://juno.build/docs/unknown',
23+
'https://juno.build/docs/examples/functions/unknown'
24+
]
25+
},
26+
{
27+
name: 'juno-console',
28+
invalidUrls: ['https://console.juno.build/unknown'],
29+
wait: async ({ page }) => {
30+
const orderSent = page.locator('.container p[role="presentation"]');
31+
await orderSent.waitFor();
32+
}
33+
}
34+
];
35+
36+
testCases.forEach(({ invalidUrls, wait }) => {
37+
invalidUrls.forEach((invalidUrl) => {
38+
test(`should redirect ${invalidUrl} to 404`, async ({ page }) => {
39+
const response = await page.goto(invalidUrl, { waitUntil: 'domcontentloaded' });
40+
41+
expect(response?.status()).toBe(404);
42+
43+
await wait?.({ page });
44+
45+
await expect(page).toHaveScreenshot();
46+
});
47+
});
48+
});
49+
});

0 commit comments

Comments
 (0)