2023-04-25 06:12:48 +03:00
|
|
|
import { test } from '@affine-test/kit/playwright';
|
2023-08-10 08:05:34 +03:00
|
|
|
import { coreUrl, openHomePage } from '@affine-test/kit/utils/load-page';
|
2023-09-02 06:31:07 +03:00
|
|
|
import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
|
2023-04-22 04:44:29 +03:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
|
|
|
test('goto not found page', async ({ page }) => {
|
|
|
|
await openHomePage(page);
|
2023-09-02 06:31:07 +03:00
|
|
|
await waitForEditorLoad(page);
|
2023-04-22 04:44:29 +03:00
|
|
|
const currentUrl = page.url();
|
2023-10-16 11:44:09 +03:00
|
|
|
const invalidUrl = currentUrl.concat('invalid');
|
2023-04-22 04:44:29 +03:00
|
|
|
await page.goto(invalidUrl);
|
2023-10-13 21:46:32 +03:00
|
|
|
await expect(page.getByTestId('not-found')).toBeVisible({
|
|
|
|
timeout: 10000,
|
|
|
|
});
|
2023-04-22 04:44:29 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
test('goto not found workspace', async ({ page }) => {
|
|
|
|
await openHomePage(page);
|
2023-09-02 06:31:07 +03:00
|
|
|
await waitForEditorLoad(page);
|
2023-07-19 18:52:21 +03:00
|
|
|
// if doesn't wait for timeout, data won't be saved into indexedDB
|
|
|
|
await page.waitForTimeout(1000);
|
2023-08-10 08:05:34 +03:00
|
|
|
await page.goto(new URL('/workspace/invalid/all', coreUrl).toString());
|
2023-08-29 13:07:05 +03:00
|
|
|
await page.waitForTimeout(3000);
|
2023-08-10 08:05:34 +03:00
|
|
|
expect(page.url()).toBe(new URL('/404', coreUrl).toString());
|
2023-04-22 04:44:29 +03:00
|
|
|
});
|