refactor: workspace manager (#5060)

This commit is contained in:
EYHN
2023-12-15 07:20:50 +00:00
parent af15aa06d4
commit fe2851d3e9
217 changed files with 3605 additions and 4244 deletions

View File

@@ -57,5 +57,5 @@ test('should create a page with a local first avatar and remove it', async ({
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});

View File

@@ -41,7 +41,7 @@ test('page delete -> refresh page -> it should be disappear', async ({
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('page delete -> create new page -> refresh page -> new page should be appear -> old page should be disappear', async ({
@@ -95,7 +95,7 @@ test('page delete -> create new page -> refresh page -> new page should be appea
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('delete multiple pages -> create multiple pages -> refresh', async ({
@@ -155,5 +155,5 @@ test('delete multiple pages -> create multiple pages -> refresh', async ({
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});

View File

@@ -45,7 +45,7 @@ test('Create new workspace, then delete it', async ({ page, workspace }) => {
);
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('Delete last workspace', async ({ page }) => {

View File

@@ -41,7 +41,7 @@ test.skip('New a page ,then open it and export html', async ({
);
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test.skip('New a page ,then open it and export markdown', async ({
@@ -74,5 +74,5 @@ test.skip('New a page ,then open it and export markdown', async ({
);
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});

View File

@@ -31,7 +31,7 @@ test('New a page and open it ,then favorite it', async ({
await favoriteBtn.click();
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('Export to html, markdown and png', async ({ page }) => {
@@ -121,5 +121,5 @@ test('Cancel favorite', async ({ page, workspace }) => {
).not.toBeUndefined();
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});

View File

@@ -33,7 +33,7 @@ test('Show favorite items in sidebar', async ({ page, workspace }) => {
);
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('Show favorite reference in sidebar', async ({ page, workspace }) => {
@@ -73,7 +73,7 @@ test('Show favorite reference in sidebar', async ({ page, workspace }) => {
).toBeVisible();
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test("Deleted page's reference will not be shown in sidebar", async ({
@@ -124,7 +124,7 @@ test("Deleted page's reference will not be shown in sidebar", async ({
expect(collapseButton).toHaveAttribute('data-disabled', 'true');
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('Add new favorite page via sidebar', async ({ page }) => {

View File

@@ -16,7 +16,7 @@ test('click btn new page', async ({ page, workspace }) => {
expect(newPageId).not.toBe(originPageId);
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('click btn bew page and find it in all pages', async ({
@@ -33,5 +33,5 @@ test('click btn bew page and find it in all pages', async ({
expect(cell).not.toBeUndefined();
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});

View File

@@ -28,5 +28,5 @@ test('click btn bew page and open in tab', async ({ page, workspace }) => {
expect(newTabPage.url()).toBe(newPageUrl);
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});

View File

@@ -47,5 +47,5 @@ test('New a page , then delete it in all pages, restore it', async ({
expect(restoreCell).not.toBeUndefined();
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});

View File

@@ -32,7 +32,7 @@ test('New a page ,then open it and show delete modal', async ({
expect(confirmTip).not.toBeUndefined();
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('New a page ,then go to all pages and show delete modal', async ({
@@ -58,5 +58,5 @@ test('New a page ,then go to all pages and show delete modal', async ({
expect(confirmTip).not.toBeUndefined();
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});

View File

@@ -38,5 +38,5 @@ test('New a page , then delete it in all pages, finally find it in trash', async
).not.toBeUndefined();
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});

View File

@@ -25,7 +25,7 @@ test('just one item in the workspace list at first', async ({
).not.toBeNull();
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('create one workspace in the workspace list', async ({
@@ -57,7 +57,7 @@ test('create one workspace in the workspace list', async ({
expect(result1).toBe(11);
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});
test('create multi workspace in the workspace list', async ({
@@ -88,7 +88,7 @@ test('create multi workspace in the workspace list', async ({
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
await openWorkspaceListModal(page);
await page.waitForTimeout(1000);
@@ -142,5 +142,5 @@ test('create multi workspace in the workspace list', async ({
const nextWorkspace = await workspace.current();
expect(currentWorkspace.id).toBe(nextWorkspace.id);
expect(currentWorkspace.meta.id).toBe(nextWorkspace.meta.id);
});

View File

@@ -11,5 +11,5 @@ test('preset workspace name', async ({ page, workspace }) => {
expect(await workspaceName.textContent()).toBe('Demo Workspace');
const currentWorkspace = await workspace.current();
expect(currentWorkspace.flavour).toContain('local');
expect(currentWorkspace.meta.flavour).toContain('local');
});

View File

@@ -20,6 +20,7 @@ test('goto not found workspace', async ({ page }) => {
// if doesn't wait for timeout, data won't be saved into indexedDB
await page.waitForTimeout(1000);
await page.goto(new URL('/workspace/invalid/all', coreUrl).toString());
await page.waitForTimeout(3000);
expect(page.url()).toBe(new URL('/404', coreUrl).toString());
await expect(page.getByTestId('not-found')).toBeVisible({
timeout: 10000,
});
});