2023-04-25 06:12:48 +03:00
|
|
|
import { test } from '@affine-test/kit/playwright';
|
2023-07-13 12:05:01 +03:00
|
|
|
import { openHomePage, webUrl } from '@affine-test/kit/utils/load-page';
|
|
|
|
import { waitEditorLoad } 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-06-07 12:31:54 +03:00
|
|
|
await waitEditorLoad(page);
|
2023-04-22 04:44:29 +03:00
|
|
|
const currentUrl = page.url();
|
2023-07-07 17:15:27 +03:00
|
|
|
const invalidUrl = currentUrl.replace('hello-world', 'invalid');
|
2023-04-22 04:44:29 +03:00
|
|
|
await page.goto(invalidUrl);
|
2023-07-07 17:15:27 +03:00
|
|
|
await expect(page.getByTestId('notFound')).toBeVisible();
|
2023-04-22 04:44:29 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
test('goto not found workspace', async ({ page }) => {
|
|
|
|
await openHomePage(page);
|
2023-06-07 12:31:54 +03:00
|
|
|
await waitEditorLoad(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-04-22 04:44:29 +03:00
|
|
|
await page.goto(new URL('/workspace/invalid/all', webUrl).toString());
|
2023-07-24 12:02:35 +03:00
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
expect(page.url()).toBe(new URL('/404', webUrl).toString());
|
2023-04-22 04:44:29 +03:00
|
|
|
});
|