mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 02:13:00 +08:00
refactor: workspace manager (#5060)
This commit is contained in:
@@ -18,7 +18,7 @@ test('new page', async ({ page, workspace }) => {
|
||||
delay: 100,
|
||||
});
|
||||
await page.waitForSelector('v-line');
|
||||
const flavour = (await workspace.current()).flavour;
|
||||
const flavour = (await workspace.current()).meta.flavour;
|
||||
expect(flavour).toBe('local');
|
||||
});
|
||||
|
||||
@@ -169,14 +169,8 @@ test('windows only check', async ({ page }) => {
|
||||
test('delete workspace', async ({ page }) => {
|
||||
await clickSideBarCurrentWorkspaceBanner(page);
|
||||
await page.getByTestId('new-workspace').click();
|
||||
await page
|
||||
.getByTestId('create-workspace-input')
|
||||
.pressSequentially('Delete Me', {
|
||||
delay: 100,
|
||||
});
|
||||
await page.getByTestId('create-workspace-create-button').click({
|
||||
delay: 100,
|
||||
});
|
||||
await page.getByTestId('create-workspace-input').fill('Delete Me');
|
||||
await page.getByTestId('create-workspace-create-button').click();
|
||||
// await page.getByTestId('create-workspace-continue-button').click({
|
||||
// delay: 100,
|
||||
// });
|
||||
@@ -197,9 +191,7 @@ test('delete workspace', async ({ page }) => {
|
||||
);
|
||||
await page.mouse.wheel(0, 500);
|
||||
await page.getByTestId('delete-workspace-button').click();
|
||||
await page
|
||||
.getByTestId('delete-workspace-input')
|
||||
.pressSequentially('Delete Me');
|
||||
await page.getByTestId('delete-workspace-input').fill('Delete Me');
|
||||
await page.getByTestId('delete-workspace-confirm-button').click();
|
||||
await page.waitForTimeout(1000);
|
||||
expect(await page.getByTestId('workspace-name').textContent()).toBe(
|
||||
|
||||
@@ -10,7 +10,7 @@ test('check workspace has a DB file', async ({ appInfo, workspace }) => {
|
||||
const dbPath = path.join(
|
||||
appInfo.sessionData,
|
||||
'workspaces',
|
||||
w.id,
|
||||
w.meta.id,
|
||||
'storage.db'
|
||||
);
|
||||
// check if db file exists
|
||||
@@ -25,7 +25,7 @@ test.skip('move workspace db file', async ({ page, appInfo, workspace }) => {
|
||||
// goto workspace setting
|
||||
await page.getByTestId('workspace-list-item').click();
|
||||
|
||||
const tmpPath = path.join(appInfo.sessionData, w.id + '-tmp-dir');
|
||||
const tmpPath = path.join(appInfo.sessionData, w.meta.id + '-tmp-dir');
|
||||
|
||||
// move db file to tmp folder
|
||||
await page.evaluate(tmpPath => {
|
||||
@@ -53,7 +53,7 @@ test.fixme('export then add', async ({ page, appInfo, workspace }) => {
|
||||
await page.getByTestId('slider-bar-workspace-setting-button').click();
|
||||
await expect(page.getByTestId('setting-modal')).toBeVisible();
|
||||
|
||||
const originalId = w.id;
|
||||
const originalId = w.meta.id;
|
||||
|
||||
const newWorkspaceName = 'new-test-name';
|
||||
|
||||
@@ -67,7 +67,7 @@ test.fixme('export then add', async ({ page, appInfo, workspace }) => {
|
||||
await page.getByTestId('save-workspace-name').click();
|
||||
await page.waitForSelector('text="Update workspace name success"');
|
||||
|
||||
const tmpPath = path.join(appInfo.sessionData, w.id + '-tmp.db');
|
||||
const tmpPath = path.join(appInfo.sessionData, w.meta.id + '-tmp.db');
|
||||
|
||||
// export db file to tmp folder
|
||||
await page.evaluate(tmpPath => {
|
||||
@@ -105,7 +105,7 @@ test.fixme('export then add', async ({ page, appInfo, workspace }) => {
|
||||
// sleep for a while to wait for the workspace to be added :D
|
||||
await page.waitForTimeout(2000);
|
||||
const newWorkspace = await workspace.current();
|
||||
expect(newWorkspace.id).not.toBe(originalId);
|
||||
expect(newWorkspace.meta.id).not.toBe(originalId);
|
||||
// check its name is correct
|
||||
await expect(page.getByTestId('workspace-name')).toHaveText(newWorkspaceName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user