feat(core): new worker workspace engine (#9257)

This commit is contained in:
EYHN
2025-01-17 00:22:18 +08:00
committed by GitHub
parent 7dc470e7ea
commit a2ffdb4047
219 changed files with 4267 additions and 7194 deletions

View File

@@ -11,10 +11,7 @@ import {
waitForEditorLoad,
} from '@affine-test/kit/utils/page-logic';
import { clickUserInfoCard } from '@affine-test/kit/utils/setting';
import {
clickSideBarCurrentWorkspaceBanner,
clickSideBarSettingButton,
} from '@affine-test/kit/utils/sidebar';
import { clickSideBarSettingButton } from '@affine-test/kit/utils/sidebar';
import { createLocalWorkspace } from '@affine-test/kit/utils/workspace';
import { expect } from '@playwright/test';
@@ -211,72 +208,3 @@ test('can sync svg between different browsers', async ({ page, browser }) => {
expect(svg2).toEqual(svg1);
}
});
test('When the first sync is not completed, should always show loading', async ({
page,
browser,
}) => {
await page.reload();
await waitForEditorLoad(page);
await createLocalWorkspace(
{
name: 'test',
},
page
);
await enableCloudWorkspace(page);
await clickNewPageButton(page);
await waitForEditorLoad(page);
const title = getBlockSuiteEditorTitle(page);
await title.pressSequentially('TEST TITLE', {
delay: 50,
});
const context = await browser.newContext();
await skipOnboarding(context);
const page2 = await context.newPage();
await loginUser(page2, user);
// simulate sync stuck
await page2.evaluate(() => {
(window as any)._TEST_SIMULATE_SYNC_LAG = new Promise(() => {});
});
const localWorkspaceUrl = page2.url();
await clickSideBarCurrentWorkspaceBanner(page2);
await page2.getByTestId('workspace-card').getByText('test').click(); // enter "test" workspace
await page2.waitForTimeout(1000);
await expect(
page2.getByTestId('page-list-item').getByText('TEST TITLE')
).not.toBeVisible(); // should be loading
// Simulate user refresh and re-enter workspace, should still be loading
await page2.goto(localWorkspaceUrl);
// setup sync lag
await page2.evaluate(() => {
(window as any).resolveSyncLag = null;
(window as any)._TEST_SIMULATE_SYNC_LAG = new Promise(resolve => {
(window as any).resolveSyncLag = resolve;
});
});
await clickSideBarCurrentWorkspaceBanner(page2);
await page2.getByTestId('workspace-card').getByText('test').click(); // enter "test" workspace
await page2.waitForTimeout(1000);
await expect(
page2.getByTestId('page-list-item').getByText('TEST TITLE')
).not.toBeVisible(); // should be loading
await page2.evaluate(() => {
(window as any).resolveSyncLag();
}); // start syncing
await page2.getByTestId('page-list-item').getByText('TEST TITLE').click(); // should be able to click page
await waitForEditorLoad(page2);
expect(await getBlockSuiteEditorTitle(page2).innerText()).toContain(
'TEST TITLE'
);
});