mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
test: fix flaky on local-first-workspace-list.spec.ts (#2727)
This commit is contained in:
@@ -38,7 +38,7 @@ test('enable public workspace', async ({ page, context }) => {
|
||||
await page2.waitForSelector('thead', {
|
||||
timeout: 10000,
|
||||
});
|
||||
await page2.getByText('AFFiNE - not just a note taking app').click();
|
||||
await page2.getByText('Untitled').click();
|
||||
});
|
||||
|
||||
test('access public workspace page', async ({ page, browser }) => {
|
||||
|
||||
@@ -17,7 +17,7 @@ test('drag a page from "All pages" list onto the "Trash" folder in the sidebar t
|
||||
|
||||
// Drag-and-drop
|
||||
// Ref: https://playwright.dev/docs/input#dragging-manually
|
||||
await page.getByText('AFFiNE - not just a note taking app').hover();
|
||||
await page.getByText('Untitled').hover();
|
||||
await page.mouse.down();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.getByText('Trash').hover();
|
||||
@@ -29,7 +29,7 @@ test('drag a page from "All pages" list onto the "Trash" folder in the sidebar t
|
||||
).toBeVisible();
|
||||
|
||||
await expect(
|
||||
page.getByText('AFFiNE - not just a note taking app'),
|
||||
page.getByText('Untitled'),
|
||||
'The deleted post is no longer on the All Page list'
|
||||
).toHaveCount(0);
|
||||
|
||||
@@ -37,7 +37,7 @@ test('drag a page from "All pages" list onto the "Trash" folder in the sidebar t
|
||||
// Visit trash page via url
|
||||
await page.getByText('Trash', { exact: true }).click();
|
||||
await expect(
|
||||
page.getByText('AFFiNE - not just a note taking app'),
|
||||
page.getByText('Untitled'),
|
||||
'The deleted post exists in the Trash list'
|
||||
).toHaveCount(1);
|
||||
});
|
||||
|
||||
@@ -103,14 +103,21 @@ test('create multi workspace in the workspace list', async ({ page }) => {
|
||||
await page.reload();
|
||||
await openWorkspaceListModal(page);
|
||||
|
||||
//check workspace list length
|
||||
// check workspace list length
|
||||
{
|
||||
const workspaceCards1 = await page.$$('data-testid=workspace-card');
|
||||
expect(workspaceCards1.length).toBe(3);
|
||||
}
|
||||
|
||||
const workspaceChangePromise = page.evaluate(() => {
|
||||
new Promise(resolve => {
|
||||
window.addEventListener('affine:workspace:change', resolve, {
|
||||
once: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
await page.getByTestId('draggable-item').nth(2).click();
|
||||
await page.waitForTimeout(100);
|
||||
await workspaceChangePromise;
|
||||
|
||||
// @ts-expect-error
|
||||
const nextId: string = await page.evaluate(() => currentWorkspace.id);
|
||||
|
||||
Reference in New Issue
Block a user