fix: correct router logic (#2342)

This commit is contained in:
Himself65
2023-05-12 13:55:45 +08:00
committed by GitHub
parent 10b4558947
commit 21fdced2bd
24 changed files with 206 additions and 332 deletions

View File

@@ -36,9 +36,6 @@ test('public single page', async ({ page, browser }) => {
);
await page.getByTestId('confirm-enable-cloud-button').click();
await promise;
const newPage2Url = page.url().split('/');
newPage2Url[newPage2Url.length - 1] = page2Id as string;
await page.goto(newPage2Url.join('/'));
await page.waitForSelector('v-line');
const currentTitle = await page
.locator('[data-block-is-title="true"]')

View File

@@ -46,9 +46,10 @@ test('should enable affine workspace successfully', async ({ page }) => {
await page.locator('[data-block-is-title="true"]').type('Hello, world!', {
delay: 50,
});
await page.waitForTimeout(1000);
await assertCurrentWorkspaceFlavour('affine', page);
await openWorkspaceListModal(page);
await page.getByTestId('workspace-list-modal-sign-out').click();
await page.waitForTimeout(1000);
await waitMarkdownImported(page);
await assertCurrentWorkspaceFlavour('local', page);
});

View File

@@ -9,9 +9,7 @@ test('Open last workspace when back to affine', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await createWorkspace({ name: 'New Workspace 2' }, page);
// FIXME: can not get when the new workspace is surely created, hack a timeout to wait
// waiting for page loading end
await page.waitForTimeout(3000);
await waitMarkdownImported(page);
// show workspace list
await page.getByTestId('workspace-name').click();

View File

@@ -3,7 +3,6 @@ import { expect } from '@playwright/test';
import { openHomePage, webUrl } from '../libs/load-page';
import { waitMarkdownImported } from '../libs/page-logic';
import { clickSideBarAllPageButton } from '../libs/sidebar';
test('goto not found page', async ({ page }) => {
await openHomePage(page);
@@ -17,9 +16,8 @@ test('goto not found page', async ({ page }) => {
test('goto not found workspace', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await clickSideBarAllPageButton(page);
const currentUrl = page.url();
await page.goto(new URL('/workspace/invalid/all', webUrl).toString());
await clickSideBarAllPageButton(page);
await page.waitForSelector('v-line');
expect(page.url()).toEqual(currentUrl);
});