mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
test(core): add missing await for expect (#11900)
This commit is contained in:
@@ -70,7 +70,7 @@ test.describe('AIChatWith/Network', () => {
|
||||
20000
|
||||
);
|
||||
const { message } = await utils.chatPanel.getLatestAssistantMessage(page);
|
||||
expect(await message.locator('affine-footnote-node').count()).toBe(0);
|
||||
await expect(message.locator('affine-footnote-node')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('should disable network search when chating with image', async ({
|
||||
|
||||
@@ -37,7 +37,7 @@ test.describe('AIChatWith/tags', () => {
|
||||
const { content, message } =
|
||||
await utils.chatPanel.getLatestAssistantMessage(page);
|
||||
expect(content).toMatch(/TagAAaa.*cat/);
|
||||
expect(await message.locator('affine-footnote-node').count()).toBe(1);
|
||||
await expect(message.locator('affine-footnote-node')).toHaveCount(1);
|
||||
}).toPass();
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ test.describe('AIChatWith/tags', () => {
|
||||
await utils.chatPanel.getLatestAssistantMessage(page);
|
||||
expect(content).toMatch(/TagEEee.*cat/);
|
||||
expect(content).toMatch(/TagFFff.*dog/);
|
||||
expect(await message.locator('affine-footnote-node').count()).toBe(2);
|
||||
await expect(message.locator('affine-footnote-node')).toHaveCount(2);
|
||||
}).toPass();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ test.describe('AIInsertion/SaveAsDoc', () => {
|
||||
const { actions, content } =
|
||||
await utils.chatPanel.getLatestAssistantMessage(page);
|
||||
await actions.saveAsDoc();
|
||||
await page.getByText('New doc created');
|
||||
await page.getByText('New doc created').waitFor({ state: 'visible' });
|
||||
|
||||
// Verify the ai block is created
|
||||
const editorContent = await utils.editor.getEditorContent(page);
|
||||
@@ -63,7 +63,7 @@ test.describe('AIInsertion/SaveAsDoc', () => {
|
||||
const { actions, content } =
|
||||
await utils.chatPanel.getLatestAssistantMessage(page);
|
||||
await actions.saveAsDoc();
|
||||
await page.getByText('New doc created');
|
||||
await page.getByText('New doc created').waitFor({ state: 'visible' });
|
||||
|
||||
// Switch to page mode
|
||||
await utils.editor.isPageMode(page);
|
||||
|
||||
@@ -85,8 +85,8 @@ test.describe('login first', () => {
|
||||
{
|
||||
await clickSideBarSettingButton(page);
|
||||
const locator = page.getByTestId('user-info-card');
|
||||
expect(locator.getByText(user.email)).toBeTruthy();
|
||||
expect(locator.getByText(user.name)).toBeTruthy();
|
||||
await expect(locator.getByText(user.email)).toBeVisible();
|
||||
await expect(locator.getByText(user.name)).toBeVisible();
|
||||
await locator.click({
|
||||
delay: 50,
|
||||
});
|
||||
@@ -103,8 +103,8 @@ test.describe('login first', () => {
|
||||
{
|
||||
await clickSideBarSettingButton(page);
|
||||
const locator = page.getByTestId('user-info-card');
|
||||
expect(locator.getByText(user.email)).toBeTruthy();
|
||||
expect(locator.getByText(newName)).toBeTruthy();
|
||||
await expect(locator.getByText(user.email)).toBeVisible();
|
||||
await expect(locator.getByText(newName)).toBeVisible();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ test('can enable share page', async ({ page, browser }) => {
|
||||
await waitForEditorLoad(page2);
|
||||
const title = getBlockSuiteEditorTitle(page2);
|
||||
await expect(title).toContainText('TEST TITLE');
|
||||
expect(page2.locator('affine-paragraph').first()).toContainText(
|
||||
await expect(page2.locator('affine-paragraph').first()).toContainText(
|
||||
'TEST CONTENT'
|
||||
);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ test('append paragraph should be disabled in shared mode', async ({
|
||||
}
|
||||
expect(error).toBeNull();
|
||||
|
||||
expect(await paragraph.count()).toBe(numParagraphs);
|
||||
await expect(paragraph).toHaveCount(numParagraphs);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -217,7 +217,7 @@ test('share page with default edgeless', async ({ page, browser }) => {
|
||||
await expect(page.locator('affine-edgeless-root')).toBeVisible({
|
||||
timeout: 1000,
|
||||
});
|
||||
expect(page2.locator('affine-paragraph').first()).toContainText(
|
||||
await expect(page2.locator('affine-paragraph').first()).toContainText(
|
||||
'TEST CONTENT'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -93,11 +93,11 @@ test('should have pagination in member list', async ({ page }) => {
|
||||
// Click left arrow to back to first page
|
||||
await navigationItems[0].click();
|
||||
await page.waitForTimeout(500);
|
||||
expect(await page.locator('[data-testid="member-item"]').count()).toBe(8);
|
||||
await expect(page.locator('[data-testid="member-item"]')).toHaveCount(8);
|
||||
// Click right arrow to second page
|
||||
await navigationItems[3].click();
|
||||
await page.waitForTimeout(500);
|
||||
expect(await page.locator('[data-testid="member-item"]').count()).toBe(3);
|
||||
await expect(page.locator('[data-testid="member-item"]')).toHaveCount(3);
|
||||
});
|
||||
|
||||
test('should transform local favorites data', async ({ page }) => {
|
||||
|
||||
@@ -36,7 +36,7 @@ test('should close embed editing modal when editor switching to page mode by sho
|
||||
|
||||
await page.keyboard.press('Alt+s');
|
||||
await waitForEditorLoad(page);
|
||||
expect(editingModal).toBeHidden();
|
||||
await expect(editingModal).toBeHidden();
|
||||
});
|
||||
|
||||
test('embed card should not overflow the edgeless note', async ({ page }) => {
|
||||
|
||||
@@ -53,6 +53,6 @@ test('should not show hidden note in embed view page mode', async ({
|
||||
|
||||
// check the content
|
||||
const embedLink = page.locator('affine-embed-synced-doc-block');
|
||||
expect(embedLink.getByText(/visible content/)).toBeVisible();
|
||||
expect(embedLink.getByText(/hidden content/)).toBeHidden();
|
||||
await expect(embedLink.getByText(/visible content/)).toBeVisible();
|
||||
await expect(embedLink.getByText(/hidden content/)).toBeHidden();
|
||||
});
|
||||
|
||||
@@ -193,15 +193,15 @@ test.describe('TOC display', () => {
|
||||
const toc = await openTocPanel(page);
|
||||
const sortingButton = locateSortingButton(toc);
|
||||
await expect(sortingButton).not.toHaveClass(/active/);
|
||||
expect(toc.locator('[data-sortable="false"]')).toHaveCount(1);
|
||||
await expect(toc.locator('[data-sortable="false"]')).toHaveCount(1);
|
||||
|
||||
await clickEdgelessModeButton(page);
|
||||
await expect(sortingButton).toHaveClass(/active/);
|
||||
expect(toc.locator('[data-sortable="true"]')).toHaveCount(1);
|
||||
await expect(toc.locator('[data-sortable="true"]')).toHaveCount(1);
|
||||
|
||||
await sortingButton.click();
|
||||
await expect(sortingButton).not.toHaveClass(/active/);
|
||||
expect(toc.locator('[data-sortable="false"]')).toHaveCount(1);
|
||||
await expect(toc.locator('[data-sortable="false"]')).toHaveCount(1);
|
||||
});
|
||||
|
||||
test('should notify user when there are some page only notes and sorting is disabled', async ({
|
||||
|
||||
@@ -176,7 +176,7 @@ test('should hide edgeless-only note headings', async ({ page }) => {
|
||||
.getByTestId('outline-block-preview-h1')
|
||||
.locator('span');
|
||||
await h1InPanel.waitFor({ state: 'visible' });
|
||||
expect(h1InPanel).toContainText(['Heading 1']);
|
||||
await expect(h1InPanel).toContainText(['Heading 1']);
|
||||
});
|
||||
|
||||
test('outline viewer should be useable in doc peek preview', async ({
|
||||
|
||||
@@ -87,9 +87,9 @@ test('Show collections items in sidebar', async ({ page }) => {
|
||||
const deletePage = page.getByText('Move to trash');
|
||||
await deletePage.click();
|
||||
await page.getByTestId('confirm-modal-confirm').click();
|
||||
expect(
|
||||
await first.locator('[data-testid^="navigation-panel-doc-"]').count()
|
||||
).toBe(0);
|
||||
await expect(
|
||||
first.locator('[data-testid^="navigation-panel-doc-"]')
|
||||
).toHaveCount(0);
|
||||
// position is a workaround for the hover issue when empty collection status's height > 26px (will cause scroll)
|
||||
await first.hover({ position: { x: 10, y: 10 } });
|
||||
await first
|
||||
@@ -100,7 +100,7 @@ test('Show collections items in sidebar', async ({ page }) => {
|
||||
await page.waitForTimeout(50);
|
||||
await expect(items).toHaveCount(0);
|
||||
await createAndPinCollection(page);
|
||||
expect(await items.count()).toBe(1);
|
||||
await expect(items).toHaveCount(1);
|
||||
await clickSideBarAllPageButton(page);
|
||||
await createLocalWorkspace(
|
||||
{
|
||||
@@ -109,7 +109,7 @@ test('Show collections items in sidebar', async ({ page }) => {
|
||||
page
|
||||
);
|
||||
await waitForEditorLoad(page);
|
||||
expect(await items.count()).toBe(0);
|
||||
await expect(items).toHaveCount(0);
|
||||
await clickSideBarCurrentWorkspaceBanner(page);
|
||||
await page.getByTestId('workspace-card').nth(0).click();
|
||||
});
|
||||
@@ -122,7 +122,7 @@ test('edit collection', async ({ page }) => {
|
||||
const items = collections.locator(
|
||||
'[data-testid^="navigation-panel-collection-"]'
|
||||
);
|
||||
expect(await items.count()).toBe(1);
|
||||
await expect(items).toHaveCount(1);
|
||||
const first = items.first();
|
||||
await first.hover();
|
||||
await first
|
||||
@@ -144,7 +144,7 @@ test('edit collection and change filter date', async ({ page }) => {
|
||||
const items = collections.locator(
|
||||
'[data-testid^="navigation-panel-collection-"]'
|
||||
);
|
||||
expect(await items.count()).toBe(1);
|
||||
await expect(items).toHaveCount(1);
|
||||
const first = items.first();
|
||||
await first.hover();
|
||||
await first
|
||||
@@ -184,6 +184,6 @@ test('add collection from sidebar', async ({ page }) => {
|
||||
const items = collections.locator(
|
||||
'[data-testid^="navigation-panel-collection-"]'
|
||||
);
|
||||
expect(await items.count()).toBe(1);
|
||||
await expect(items).toHaveCount(1);
|
||||
await expect(nullCollection).not.toBeVisible();
|
||||
});
|
||||
|
||||
@@ -21,21 +21,20 @@ test('page delete -> refresh page -> it should be disappear', async ({
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page delete');
|
||||
const newPageId = getCurrentDocIdFromUrl(page);
|
||||
await page.getByTestId('all-pages').click();
|
||||
const cell = page.getByRole('cell', {
|
||||
name: 'this is a new page delete',
|
||||
});
|
||||
expect(cell).not.toBeUndefined();
|
||||
const allPages = page.getByTestId('virtualized-page-list');
|
||||
const cell = allPages.getByText('this is a new page delete');
|
||||
await expect(cell).toBeVisible();
|
||||
await getPageOperationButton(page, newPageId).click();
|
||||
const deleteBtn = page.getByTestId('move-to-trash');
|
||||
await deleteBtn.click();
|
||||
const confirmTip = page.getByText('Delete page?');
|
||||
expect(confirmTip).not.toBeUndefined();
|
||||
const confirmTip = page.getByRole('dialog', { name: 'Delete doc?' });
|
||||
await expect(confirmTip).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
await page.getByTestId('trash-page').click();
|
||||
await getPageItem(page, newPageId).getByTestId('delete-page-button').click();
|
||||
await page.getByText('Delete permanently?').dblclick();
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
expect(page.getByText("There's no page here yet")).not.toBeUndefined();
|
||||
await expect(page.getByText('Deleted docs will appear here.')).toBeVisible();
|
||||
await page.getByTestId('all-pages').click();
|
||||
|
||||
const currentWorkspace = await workspace.current();
|
||||
@@ -55,15 +54,14 @@ test('page delete -> create new page -> refresh page -> new page should be appea
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page delete');
|
||||
const newPageDeleteId = getCurrentDocIdFromUrl(page);
|
||||
await page.getByTestId('all-pages').click();
|
||||
const cellDelete = page.getByRole('cell', {
|
||||
name: 'this is a new page delete',
|
||||
});
|
||||
expect(cellDelete).not.toBeUndefined();
|
||||
const allPages = page.getByTestId('virtualized-page-list');
|
||||
const cellDelete = allPages.getByText('this is a new page delete');
|
||||
await expect(cellDelete).toBeVisible();
|
||||
await getPageOperationButton(page, newPageDeleteId).click();
|
||||
const deleteBtn = page.getByTestId('move-to-trash');
|
||||
await deleteBtn.click();
|
||||
const confirmTip = page.getByText('Delete page?');
|
||||
expect(confirmTip).not.toBeUndefined();
|
||||
const confirmTip = page.getByRole('dialog', { name: 'Delete doc?' });
|
||||
await expect(confirmTip).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
await page.getByTestId('trash-page').click();
|
||||
await getPageItem(page, newPageDeleteId)
|
||||
@@ -71,7 +69,7 @@ test('page delete -> create new page -> refresh page -> new page should be appea
|
||||
.click();
|
||||
await page.getByText('Delete permanently?').dblclick();
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
expect(page.getByText('Deleted docs will appear here')).not.toBeUndefined();
|
||||
await expect(page.getByText('Deleted docs will appear here')).toBeVisible();
|
||||
await page.getByTestId('all-pages').click();
|
||||
|
||||
await clickNewPageButton(page);
|
||||
@@ -116,15 +114,14 @@ test('delete multiple pages -> create multiple pages -> refresh', async ({
|
||||
await page.getByTestId('all-pages').click();
|
||||
|
||||
// 1st cell to be deleted
|
||||
const cellDelete1 = page.getByRole('cell', {
|
||||
name: 'this is a new page1',
|
||||
});
|
||||
expect(cellDelete1).not.toBeUndefined();
|
||||
const allPages = page.getByTestId('virtualized-page-list');
|
||||
const cellDelete1 = allPages.getByText('this is a new page1');
|
||||
await expect(cellDelete1).toBeVisible();
|
||||
await getPageOperationButton(page, newPageId1).click();
|
||||
const deleteBtn1 = page.getByTestId('move-to-trash');
|
||||
await deleteBtn1.click();
|
||||
const confirmTip1 = page.getByText('Delete page?');
|
||||
expect(confirmTip1).not.toBeUndefined();
|
||||
const confirmTip1 = page.getByRole('dialog', { name: 'Delete doc?' });
|
||||
await expect(confirmTip1).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
await page.getByTestId('trash-page').click();
|
||||
await getPageItem(page, newPageId1).getByTestId('delete-page-button').click();
|
||||
@@ -133,15 +130,13 @@ test('delete multiple pages -> create multiple pages -> refresh', async ({
|
||||
await page.getByTestId('all-pages').click();
|
||||
|
||||
// 2nd cell to be deleted
|
||||
const cellDelete2 = page.getByRole('cell', {
|
||||
name: 'this is a new page2',
|
||||
});
|
||||
expect(cellDelete2).not.toBeUndefined();
|
||||
const cellDelete2 = allPages.getByText('this is a new page2');
|
||||
await expect(cellDelete2).toBeVisible();
|
||||
await getPageOperationButton(page, newPageId2).click();
|
||||
const deleteBtn2 = page.getByTestId('move-to-trash');
|
||||
await deleteBtn2.click();
|
||||
const confirmTip2 = page.getByText('Delete page?');
|
||||
expect(confirmTip2).not.toBeUndefined();
|
||||
const confirmTip2 = page.getByRole('dialog', { name: 'Delete doc?' });
|
||||
await expect(confirmTip2).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
await page.getByTestId('trash-page').click();
|
||||
await getPageItem(page, newPageId2).getByTestId('delete-page-button').click();
|
||||
|
||||
@@ -24,7 +24,7 @@ test.skip('New a page ,then open it and export html', async ({
|
||||
const cell = page.getByRole('cell', {
|
||||
name: 'this is a new page to export html content',
|
||||
});
|
||||
expect(cell).not.toBeUndefined();
|
||||
await expect(cell).toBeVisible();
|
||||
|
||||
await cell.click();
|
||||
await clickPageMoreActions(page);
|
||||
@@ -57,7 +57,7 @@ test.skip('New a page ,then open it and export markdown', async ({
|
||||
const cell = page.getByRole('cell', {
|
||||
name: 'this is a new page to export markdown content',
|
||||
});
|
||||
expect(cell).not.toBeUndefined();
|
||||
await expect(cell).toBeVisible();
|
||||
|
||||
await cell.click();
|
||||
await clickPageMoreActions(page);
|
||||
|
||||
@@ -22,7 +22,7 @@ test('New a page and open it, then favorite it', async ({
|
||||
const cell = page
|
||||
.getByTestId('page-list-item')
|
||||
.getByText('this is a new page to favorite');
|
||||
expect(cell).not.toBeUndefined();
|
||||
await expect(cell).toBeVisible();
|
||||
|
||||
await cell.click();
|
||||
await clickPageMoreActions(page);
|
||||
@@ -69,7 +69,7 @@ test('Cancel favorite', async ({ page, workspace }) => {
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
await page.getByTestId('all-pages').click();
|
||||
const cell = getPageByTitle(page, 'this is a new page to favorite');
|
||||
expect(cell).not.toBeUndefined();
|
||||
await expect(cell).toBeVisible();
|
||||
|
||||
await cell.click();
|
||||
await clickPageMoreActions(page);
|
||||
@@ -77,10 +77,12 @@ test('Cancel favorite', async ({ page, workspace }) => {
|
||||
const favoriteBtn = page.getByTestId('editor-option-menu-favorite');
|
||||
await favoriteBtn.click();
|
||||
|
||||
const favorites = page.getByTestId('navigation-panel-favorites');
|
||||
|
||||
// expect it in favorite list
|
||||
expect(
|
||||
page.getByRole('cell', { name: 'this is a new page to favorite' })
|
||||
).not.toBeUndefined();
|
||||
await expect(
|
||||
favorites.getByText('this is a new page to favorite')
|
||||
).toBeVisible();
|
||||
|
||||
// cancel favorite
|
||||
|
||||
@@ -96,11 +98,9 @@ test('Cancel favorite', async ({ page, workspace }) => {
|
||||
await page.getByTestId('favorited-icon').nth(0).click();
|
||||
|
||||
// expect it not in favorite list
|
||||
expect(
|
||||
page.getByText(
|
||||
'Tips: Click Add to Favorites/Trash and the page will appear here.'
|
||||
)
|
||||
).not.toBeUndefined();
|
||||
await expect(
|
||||
favorites.getByTestId('slider-bar-favorites-empty-message')
|
||||
).toBeVisible();
|
||||
const currentWorkspace = await workspace.current();
|
||||
|
||||
expect(currentWorkspace.meta.flavour).toContain('local');
|
||||
|
||||
@@ -30,8 +30,9 @@ test('click btn bew page and find it in all pages', async ({
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page');
|
||||
await page.getByTestId('all-pages').click();
|
||||
const cell = page.getByRole('cell', { name: 'this is a new page' });
|
||||
expect(cell).not.toBeUndefined();
|
||||
const allPages = page.getByTestId('virtualized-page-list');
|
||||
const cell = allPages.getByText('this is a new page');
|
||||
await expect(cell).toBeVisible();
|
||||
const currentWorkspace = await workspace.current();
|
||||
|
||||
expect(currentWorkspace.meta.flavour).toContain('local');
|
||||
|
||||
@@ -20,16 +20,16 @@ test('New a page , then delete it in all pages, restore it', async ({
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');
|
||||
const newPageId = getCurrentDocIdFromUrl(page);
|
||||
await page.getByTestId('all-pages').click();
|
||||
const cell = page.getByRole('cell', {
|
||||
name: 'this is a new page to restore',
|
||||
});
|
||||
expect(cell).not.toBeUndefined();
|
||||
const cell = page
|
||||
.getByTestId('virtualized-page-list')
|
||||
.getByText('this is a new page to restore');
|
||||
await expect(cell).toBeVisible();
|
||||
|
||||
await getPageOperationButton(page, newPageId).click();
|
||||
const deleteBtn = page.getByTestId('move-to-trash');
|
||||
await deleteBtn.click();
|
||||
const confirmTip = page.getByText('Delete page?');
|
||||
expect(confirmTip).not.toBeUndefined();
|
||||
const confirmTip = page.getByRole('dialog', { name: 'Delete doc?' });
|
||||
await expect(confirmTip).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
|
||||
@@ -42,10 +42,9 @@ test('New a page , then delete it in all pages, restore it', async ({
|
||||
// stay in trash page
|
||||
expect(page.url()).toBe(trashPage);
|
||||
await page.getByTestId('all-pages').click();
|
||||
const restoreCell = page.getByRole('cell', {
|
||||
name: 'this is a new page to restore',
|
||||
});
|
||||
expect(restoreCell).not.toBeUndefined();
|
||||
const allPages = page.getByTestId('virtualized-page-list');
|
||||
const restoreCell = allPages.getByText('this is a new page to restore');
|
||||
await expect(restoreCell).toBeVisible();
|
||||
const currentWorkspace = await workspace.current();
|
||||
|
||||
expect(currentWorkspace.meta.flavour).toContain('local');
|
||||
|
||||
@@ -23,14 +23,14 @@ test('New a page ,then open it and show delete modal', async ({
|
||||
const cell = page
|
||||
.getByTestId('page-list-item')
|
||||
.getByText('this is a new page to delete');
|
||||
expect(cell).not.toBeUndefined();
|
||||
await expect(cell).toBeVisible();
|
||||
|
||||
await cell.click();
|
||||
await clickPageMoreActions(page);
|
||||
const deleteBtn = page.getByTestId('editor-option-menu-delete');
|
||||
await deleteBtn.click();
|
||||
const confirmTip = page.getByText('Delete page?');
|
||||
expect(confirmTip).not.toBeUndefined();
|
||||
const confirmTip = page.getByRole('dialog', { name: 'Delete doc?' });
|
||||
await expect(confirmTip).toBeVisible();
|
||||
const currentWorkspace = await workspace.current();
|
||||
|
||||
expect(currentWorkspace.meta.flavour).toContain('local');
|
||||
@@ -47,16 +47,15 @@ test('New a page ,then go to all pages and show delete modal', async ({
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
|
||||
const newPageId = getCurrentDocIdFromUrl(page);
|
||||
await page.getByTestId('all-pages').click();
|
||||
const cell = page.getByRole('cell', {
|
||||
name: 'this is a new page to delete',
|
||||
});
|
||||
expect(cell).not.toBeUndefined();
|
||||
const allPages = page.getByTestId('virtualized-page-list');
|
||||
const cell = allPages.getByText('this is a new page to delete');
|
||||
await expect(cell).toBeVisible();
|
||||
|
||||
await getPageOperationButton(page, newPageId).click();
|
||||
const deleteBtn = page.getByTestId('move-to-trash');
|
||||
await deleteBtn.click();
|
||||
const confirmTip = page.getByText('Delete page?');
|
||||
expect(confirmTip).not.toBeUndefined();
|
||||
const confirmTip = page.getByRole('dialog', { name: 'Delete doc?' });
|
||||
await expect(confirmTip).toBeVisible();
|
||||
const currentWorkspace = await workspace.current();
|
||||
|
||||
expect(currentWorkspace.meta.flavour).toContain('local');
|
||||
|
||||
@@ -20,23 +20,22 @@ test('New a page , then delete it in all pages, finally find it in trash', async
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
|
||||
const newPageId = getCurrentDocIdFromUrl(page);
|
||||
await page.getByTestId('all-pages').click();
|
||||
const cell = page.getByRole('cell', {
|
||||
name: 'this is a new page to delete',
|
||||
});
|
||||
expect(cell).not.toBeUndefined();
|
||||
const allPages = page.getByTestId('virtualized-page-list');
|
||||
const cell = allPages.getByText('this is a new page to delete');
|
||||
await expect(cell).toBeVisible();
|
||||
|
||||
await getPageOperationButton(page, newPageId).click();
|
||||
const deleteBtn = page.getByTestId('move-to-trash');
|
||||
await deleteBtn.click();
|
||||
const confirmTip = page.getByText('Delete page?');
|
||||
expect(confirmTip).not.toBeUndefined();
|
||||
const confirmTip = page.getByRole('dialog', { name: 'Delete doc?' });
|
||||
await expect(confirmTip).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: 'Delete' }).click();
|
||||
|
||||
await page.getByTestId('trash-page').click();
|
||||
expect(
|
||||
page.getByRole('cell', { name: 'this is a new page to delete' })
|
||||
).not.toBeUndefined();
|
||||
await expect(
|
||||
allPages.getByText('this is a new page to delete')
|
||||
).toBeVisible();
|
||||
const currentWorkspace = await workspace.current();
|
||||
|
||||
expect(currentWorkspace.meta.flavour).toContain('local');
|
||||
|
||||
@@ -17,12 +17,7 @@ test('just one item in the workspace list at first', async ({
|
||||
await waitForEditorLoad(page);
|
||||
const workspaceName = page.getByTestId('workspace-name');
|
||||
await workspaceName.click();
|
||||
expect(
|
||||
page
|
||||
.locator('div')
|
||||
.filter({ hasText: 'AFFiNE TestLocal WorkspaceAvailable Offline' })
|
||||
.nth(3)
|
||||
).not.toBeNull();
|
||||
await expect(page.getByTestId('workspace-card')).toHaveCount(1);
|
||||
const currentWorkspace = await workspace.current();
|
||||
|
||||
expect(currentWorkspace.meta.flavour).toContain('local');
|
||||
|
||||
@@ -89,7 +89,7 @@ test.describe('note to linked doc', () => {
|
||||
const moreButton = locatorComponentToolbarMoreButton(page);
|
||||
await moreButton.click();
|
||||
const turnButton = page.locator('.turn-into-linked-doc');
|
||||
expect(turnButton).toBeNull();
|
||||
await expect(turnButton).toBeHidden();
|
||||
});
|
||||
|
||||
// TODO FIX ME
|
||||
@@ -110,7 +110,7 @@ test.describe('note to linked doc', () => {
|
||||
const moreButton = locatorComponentToolbarMoreButton(page);
|
||||
await moreButton.click();
|
||||
const turnButton = page.locator('.turn-into-linked-doc');
|
||||
expect(turnButton).toBeNull();
|
||||
await expect(turnButton).toBeHidden();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user