refactor: lazy load workspaces (#3091)

This commit is contained in:
Alex Yang
2023-07-07 22:15:27 +08:00
committed by GitHub
parent 66152401be
commit 283f0cd263
45 changed files with 446 additions and 750 deletions

View File

@@ -19,6 +19,7 @@ test('database is useable', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await newPage(page);
await waitEditorLoad(page);
await page.keyboard.insertText('test title');
await page.keyboard.press('Enter');
const title = page.locator('.affine-default-page-block-title');
@@ -29,9 +30,11 @@ test('database is useable', async ({ page }) => {
await page.reload();
await waitEditorLoad(page);
await newPage(page);
await waitEditorLoad(page);
await page.keyboard.insertText('test title2');
await page.keyboard.press('Enter');
const title2 = page.locator('.affine-default-page-block-title');
await page.waitForTimeout(500);
expect(await title2.innerText()).toBe('test title2');
await addDatabase(page);
const database2 = page.locator('.affine-database-table');
@@ -42,11 +45,13 @@ test('link page is useable', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await newPage(page);
await waitEditorLoad(page);
await page.keyboard.insertText('page1');
await page.keyboard.press('Enter');
const title = page.locator('.affine-default-page-block-title');
expect(await title.innerText()).toBe('page1');
await newPage(page);
await waitEditorLoad(page);
await page.keyboard.insertText('page2');
await page.keyboard.press('Enter');
const title2 = page.locator('.affine-default-page-block-title');
@@ -59,7 +64,9 @@ test('link page is useable', async ({ page }) => {
await page.keyboard.press('1');
await page.keyboard.press('Enter');
const link = page.locator('.affine-reference');
expect(link).toBeVisible();
await page.waitForTimeout(500);
await expect(link).toBeVisible();
await page.click('.affine-reference');
await page.waitForTimeout(500);
expect(await title.innerText()).toBe('page1');
});

View File

@@ -13,6 +13,7 @@ test('drag a page from "All pages" list onto the "Trash" folder in the sidebar t
await openHomePage(page);
await waitEditorLoad(page);
await page.getByText('All Pages').click();
await page.waitForTimeout(500);
}
const title = 'AFFiNE - not just a note taking app';

View File

@@ -103,6 +103,7 @@ test('create multi workspace in the workspace list', async ({ page }) => {
await page.reload();
await openWorkspaceListModal(page);
await page.waitForTimeout(1000);
// check workspace list length
{
const workspaceCards1 = await page.$$('data-testid=workspace-card');

View File

@@ -8,9 +8,9 @@ test('goto not found page', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
const currentUrl = page.url();
const invalidUrl = currentUrl.replace(/\/$/, '') + '/invalid';
const invalidUrl = currentUrl.replace('hello-world', 'invalid');
await page.goto(invalidUrl);
await expect(page.getByTestId('notFound').isVisible()).toBeTruthy();
await expect(page.getByTestId('notFound')).toBeVisible();
});
test('goto not found workspace', async ({ page }) => {