mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-20 07:47:19 +08:00
feat: add preloading template (#2655)
Co-authored-by: Himself65 <himself65@outlook.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../../libs/load-page';
|
||||
import { waitMarkdownImported } from '../../libs/page-logic';
|
||||
import { waitEditorLoad } from '../../libs/page-logic';
|
||||
import {
|
||||
clickNewPageButton,
|
||||
clickSideBarCurrentWorkspaceBanner,
|
||||
@@ -11,7 +11,7 @@ import { getBuiltInUser, loginUser } from '../../libs/utils';
|
||||
|
||||
test('collaborative', async ({ page, browser }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const [a, b] = await getBuiltInUser();
|
||||
await loginUser(page, a);
|
||||
await page.reload();
|
||||
|
||||
@@ -2,14 +2,14 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../../libs/load-page';
|
||||
import { waitMarkdownImported } from '../../libs/page-logic';
|
||||
import { waitEditorLoad } from '../../libs/page-logic';
|
||||
import { clickSideBarAllPageButton } from '../../libs/sidebar';
|
||||
import { createFakeUser, loginUser } from '../../libs/utils';
|
||||
import { enableAffineCloudWorkspace } from '../../libs/workspace';
|
||||
|
||||
test('authorization expired', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const [a] = await createFakeUser();
|
||||
await loginUser(page, a);
|
||||
await enableAffineCloudWorkspace(page);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../../libs/load-page';
|
||||
import { waitMarkdownImported } from '../../libs/page-logic';
|
||||
import { waitEditorLoad } from '../../libs/page-logic';
|
||||
import { clickNewPageButton } from '../../libs/sidebar';
|
||||
import { createFakeUser, loginUser } from '../../libs/utils';
|
||||
import { createWorkspace } from '../../libs/workspace';
|
||||
@@ -13,7 +13,7 @@ test('public single page', async ({ page, browser }) => {
|
||||
await loginUser(page, a);
|
||||
const name = `test-${Date.now()}`;
|
||||
await createWorkspace({ name }, page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickNewPageButton(page);
|
||||
const page1Id = page.url().split('/').at(-1);
|
||||
await clickNewPageButton(page);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../../libs/load-page';
|
||||
import { waitMarkdownImported } from '../../libs/page-logic';
|
||||
import { waitEditorLoad } from '../../libs/page-logic';
|
||||
import { clickPublishPanel } from '../../libs/setting';
|
||||
import {
|
||||
clickSideBarAllPageButton,
|
||||
@@ -15,10 +15,10 @@ test('enable public workspace', async ({ page, context }) => {
|
||||
await openHomePage(page);
|
||||
const [a] = await createFakeUser();
|
||||
await loginUser(page, a);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const name = `test-${Date.now()}`;
|
||||
await createWorkspace({ name }, page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickSideBarSettingButton(page);
|
||||
await page.waitForTimeout(50);
|
||||
await clickPublishPanel(page);
|
||||
@@ -45,10 +45,10 @@ test('access public workspace page', async ({ page, browser }) => {
|
||||
await openHomePage(page);
|
||||
const [a] = await createFakeUser();
|
||||
await loginUser(page, a);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const name = `test-${Date.now()}`;
|
||||
await createWorkspace({ name }, page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickSideBarSettingButton(page);
|
||||
await page.waitForTimeout(50);
|
||||
await clickPublishPanel(page);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../../libs/load-page';
|
||||
import { waitMarkdownImported } from '../../libs/page-logic';
|
||||
import { waitEditorLoad } from '../../libs/page-logic';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const userA = require('../../fixtures/userA.json');
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
|
||||
test('should login with user A', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const [a] = await createFakeUser(userA, userB);
|
||||
await loginUser(page, a);
|
||||
await clickSideBarCurrentWorkspaceBanner(page);
|
||||
@@ -35,7 +35,7 @@ test('should login with user A', async ({ page }) => {
|
||||
|
||||
test('should enable affine workspace successfully', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const [a] = await createFakeUser();
|
||||
await loginUser(page, a);
|
||||
const name = `test-${Date.now()}`;
|
||||
@@ -50,6 +50,6 @@ test('should enable affine workspace successfully', async ({ page }) => {
|
||||
await assertCurrentWorkspaceFlavour('affine', page);
|
||||
await openWorkspaceListModal(page);
|
||||
await page.getByTestId('workspace-list-modal-sign-out').click();
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await assertCurrentWorkspaceFlavour('local', page);
|
||||
});
|
||||
|
||||
@@ -3,10 +3,7 @@ import type { Page } from '@playwright/test';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import {
|
||||
getBlockSuiteEditorTitle,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { getBlockSuiteEditorTitle, waitEditorLoad } from '../libs/page-logic';
|
||||
import { clickSideBarAllPageButton } from '../libs/sidebar';
|
||||
|
||||
function getAllPage(page: Page) {
|
||||
@@ -29,14 +26,14 @@ function getAllPage(page: Page) {
|
||||
|
||||
test('all page', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickSideBarAllPageButton(page);
|
||||
});
|
||||
|
||||
test('all page can create new page', async ({ page }) => {
|
||||
const { clickNewPageButton } = getAllPage(page);
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickSideBarAllPageButton(page);
|
||||
await clickNewPageButton();
|
||||
const title = getBlockSuiteEditorTitle(page);
|
||||
@@ -49,7 +46,7 @@ test('all page can create new page', async ({ page }) => {
|
||||
test('all page can create new edgeless page', async ({ page }) => {
|
||||
const { clickNewEdgelessDropdown } = getAllPage(page);
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickSideBarAllPageButton(page);
|
||||
await clickNewEdgelessDropdown();
|
||||
await expect(page.locator('affine-edgeless-page')).toBeVisible();
|
||||
@@ -79,7 +76,7 @@ const checkFilterName = async (page: Page, name: string) => {
|
||||
|
||||
test('allow creation of filters by favorite', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickSideBarAllPageButton(page);
|
||||
await closeDownloadTip(page);
|
||||
await createFirstFilter(page, 'Is Favourited');
|
||||
@@ -118,7 +115,7 @@ const fillDatePicker = async (page: Page, date: Date) => {
|
||||
};
|
||||
test('allow creation of filters by created time', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickSideBarAllPageButton(page);
|
||||
await closeDownloadTip(page);
|
||||
await createFirstFilter(page, 'Created');
|
||||
|
||||
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { clickPageMoreActions, waitMarkdownImported } from '../libs/page-logic';
|
||||
import { clickPageMoreActions, waitEditorLoad } from '../libs/page-logic';
|
||||
|
||||
test('Switch to edgeless by switch edgeless item', async ({ page }) => {
|
||||
async function getCount(): Promise<number> {
|
||||
@@ -11,7 +11,7 @@ test('Switch to edgeless by switch edgeless item', async ({ page }) => {
|
||||
});
|
||||
}
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const btn = await page.getByTestId('switch-edgeless-mode-button');
|
||||
await page.evaluate(() => {
|
||||
globalThis.__toastCount = 0;
|
||||
@@ -50,7 +50,7 @@ test('Switch to edgeless by switch edgeless item', async ({ page }) => {
|
||||
|
||||
test('Convert to edgeless by editor header items', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickPageMoreActions(page);
|
||||
const menusEdgelessItem = page.getByTestId('editor-option-menu-edgeless');
|
||||
await menusEdgelessItem.click({ delay: 100 });
|
||||
|
||||
@@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
|
||||
test('Click right-bottom corner contact icon', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await page.locator('[data-testid=help-island]').click();
|
||||
const rightBottomContactUs = page.locator(
|
||||
'[data-testid=right-bottom-contact-us-icon]'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
test('should have page0', async ({ page }) => {
|
||||
await page.goto('http://localhost:8080/_debug/init-page?type=importMarkdown');
|
||||
await page.goto('http://localhost:8080/_debug/init-page');
|
||||
await page.waitForSelector('v-line');
|
||||
const pageId = await page.evaluate(async () => {
|
||||
// @ts-ignore
|
||||
|
||||
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
|
||||
test('drag a page from "All pages" list onto the "Trash" folder in the sidebar to move it to trash list', async ({
|
||||
page,
|
||||
@@ -11,7 +11,7 @@ test('drag a page from "All pages" list onto the "Trash" folder in the sidebar t
|
||||
// Init test db with known workspaces and open "All Pages" page via url directly
|
||||
{
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await page.getByText('All Pages').click();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page';
|
||||
import {
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
waitEditorLoad,
|
||||
} from '../libs/page-logic';
|
||||
|
||||
async function importImage(page: Page, url: string) {
|
||||
@@ -42,7 +42,7 @@ async function closeImagePreviewModal(page: Page) {
|
||||
|
||||
test('image preview should be shown', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
const title = await getBlockSuiteEditorTitle(page);
|
||||
await title.click();
|
||||
@@ -57,7 +57,7 @@ test('image preview should be shown', async ({ page }) => {
|
||||
|
||||
test('image go left and right', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
let blobId: string;
|
||||
{
|
||||
|
||||
@@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
|
||||
test('Collapse Sidebar', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await page.getByTestId('app-sidebar-arrow-button-collapse').click();
|
||||
const sliderBarArea = page.getByTestId('app-sidebar');
|
||||
await expect(sliderBarArea).not.toBeInViewport();
|
||||
@@ -14,7 +14,7 @@ test('Collapse Sidebar', async ({ page }) => {
|
||||
|
||||
test('Expand Sidebar', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await page.getByTestId('app-sidebar-arrow-button-collapse').click();
|
||||
const sliderBarArea = page.getByTestId('sliderBar-inner');
|
||||
await expect(sliderBarArea).not.toBeInViewport();
|
||||
@@ -25,7 +25,7 @@ test('Expand Sidebar', async ({ page }) => {
|
||||
|
||||
test('Click resizer can close sidebar', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const sliderBarArea = page.getByTestId('sliderBar-inner');
|
||||
await expect(sliderBarArea).toBeVisible();
|
||||
|
||||
@@ -35,7 +35,7 @@ test('Click resizer can close sidebar', async ({ page }) => {
|
||||
|
||||
test('Drag resizer can resize sidebar', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const sliderBarArea = page.getByTestId('sliderBar-inner');
|
||||
await expect(sliderBarArea).toBeVisible();
|
||||
|
||||
@@ -52,7 +52,7 @@ test('Drag resizer can resize sidebar', async ({ page }) => {
|
||||
|
||||
test('Sidebar in between sm & md breakpoint', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const sliderBarArea = page.getByTestId('sliderBar-inner');
|
||||
const sliderBarModalBackground = page.getByTestId('app-sidebar-float-mask');
|
||||
await expect(sliderBarArea).toBeInViewport();
|
||||
|
||||
@@ -2,12 +2,12 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { newPage, waitMarkdownImported } from '../libs/page-logic';
|
||||
import { newPage, waitEditorLoad } from '../libs/page-logic';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('should create a page with a local first avatar', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await page.getByTestId('workspace-name').click();
|
||||
await page.getByTestId('new-workspace').click({ delay: 50 });
|
||||
|
||||
@@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page';
|
||||
import {
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
waitEditorLoad,
|
||||
} from '../libs/page-logic';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
@@ -13,7 +13,7 @@ test('New a page , then delete it in all pages, permanently delete it', async ({
|
||||
page,
|
||||
}) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');
|
||||
|
||||
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
import {
|
||||
clickSideBarCurrentWorkspaceBanner,
|
||||
clickSideBarSettingButton,
|
||||
@@ -11,7 +11,7 @@ import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('Create new workspace, then delete it', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickSideBarCurrentWorkspaceBanner(page);
|
||||
await page.getByTestId('new-workspace').click();
|
||||
await page
|
||||
@@ -49,7 +49,7 @@ test('Create new workspace, then delete it', async ({ page }) => {
|
||||
|
||||
test('Delete last workspace', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickSideBarSettingButton(page);
|
||||
await page.getByTestId('delete-workspace-button').click();
|
||||
const workspaceNameDom = await page.getByTestId('workspace-name');
|
||||
|
||||
@@ -6,13 +6,13 @@ import {
|
||||
clickPageMoreActions,
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
waitEditorLoad,
|
||||
} from '../libs/page-logic';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test.skip('New a page ,then open it and export html', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await page
|
||||
|
||||
@@ -6,14 +6,14 @@ import {
|
||||
clickPageMoreActions,
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
waitEditorLoad,
|
||||
} from '../libs/page-logic';
|
||||
import { waitForLogMessage } from '../libs/utils';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('New a page and open it ,then favorite it', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
@@ -32,7 +32,7 @@ test('New a page and open it ,then favorite it', async ({ page }) => {
|
||||
|
||||
test('Export to html, markdown and png', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
{
|
||||
await clickPageMoreActions(page);
|
||||
await page.getByTestId('export-menu').click();
|
||||
@@ -66,7 +66,7 @@ test.skip('Export to pdf', async ({ page }) => {
|
||||
});
|
||||
});
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
{
|
||||
await clickPageMoreActions(page);
|
||||
await page.getByTestId('export-menu').click();
|
||||
@@ -77,7 +77,7 @@ test.skip('Export to pdf', async ({ page }) => {
|
||||
|
||||
test('Cancel favorite', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
|
||||
@@ -7,12 +7,12 @@ import {
|
||||
createLinkedPage,
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
waitEditorLoad,
|
||||
} from '../libs/page-logic';
|
||||
|
||||
test('Show favorite items in sidebar', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
@@ -37,7 +37,7 @@ test('Show favorite items in sidebar', async ({ page }) => {
|
||||
|
||||
test('Show favorite reference in sidebar', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
@@ -76,7 +76,7 @@ test("Deleted page's reference will not be shown in sidebar", async ({
|
||||
page,
|
||||
}) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
|
||||
@@ -5,13 +5,13 @@ import { openHomePage } from '../libs/load-page';
|
||||
import {
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
waitEditorLoad,
|
||||
} from '../libs/page-logic';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('click btn new page', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const originPageId = page.url().split('/').reverse()[0];
|
||||
await newPage(page);
|
||||
const newPageId = page.url().split('/').reverse()[0];
|
||||
@@ -21,7 +21,7 @@ test('click btn new page', async ({ page }) => {
|
||||
|
||||
test('click btn bew page and find it in all pages', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page');
|
||||
|
||||
@@ -5,13 +5,13 @@ import { openHomePage } from '../libs/load-page';
|
||||
import {
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
waitEditorLoad,
|
||||
} from '../libs/page-logic';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('click btn bew page and open in tab', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page');
|
||||
|
||||
@@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page';
|
||||
import {
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
waitEditorLoad,
|
||||
} from '../libs/page-logic';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
@@ -13,7 +13,7 @@ test('New a page , then delete it in all pages, restore it', async ({
|
||||
page,
|
||||
}) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');
|
||||
|
||||
@@ -4,14 +4,14 @@ import { test, testResultDir } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
import { clickSideBarSettingButton } from '../libs/sidebar';
|
||||
|
||||
test('Should highlight the setting page menu when selected', async ({
|
||||
page,
|
||||
}) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const element = await page.getByTestId('slider-bar-workspace-setting-button');
|
||||
const prev = await element.screenshot({
|
||||
path: resolve(
|
||||
|
||||
@@ -6,13 +6,13 @@ import {
|
||||
clickPageMoreActions,
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
waitEditorLoad,
|
||||
} from '../libs/page-logic';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('New a page ,then open it and show delete modal', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
|
||||
@@ -35,7 +35,7 @@ test('New a page ,then go to all pages and show delete modal', async ({
|
||||
page,
|
||||
}) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
|
||||
|
||||
@@ -5,7 +5,7 @@ import { openHomePage } from '../libs/load-page';
|
||||
import {
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
waitEditorLoad,
|
||||
} from '../libs/page-logic';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
@@ -13,7 +13,7 @@ test('New a page , then delete it in all pages, finally find it in trash', async
|
||||
page,
|
||||
}) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
|
||||
|
||||
@@ -2,13 +2,13 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
import { clickSideBarAllPageButton } from '../libs/sidebar';
|
||||
import { createWorkspace, openWorkspaceListModal } from '../libs/workspace';
|
||||
|
||||
test('just one item in the workspace list at first', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const workspaceName = page.getByTestId('workspace-name');
|
||||
await workspaceName.click();
|
||||
expect(
|
||||
@@ -21,7 +21,7 @@ test('just one item in the workspace list at first', async ({ page }) => {
|
||||
|
||||
test('create one workspace in the workspace list', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const newWorkspaceNameStr = 'New Workspace';
|
||||
await createWorkspace({ name: newWorkspaceNameStr }, page);
|
||||
|
||||
@@ -50,7 +50,7 @@ test('create one workspace in the workspace list', async ({ page }) => {
|
||||
|
||||
test('create multi workspace in the workspace list', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await createWorkspace({ name: 'New Workspace 2' }, page);
|
||||
await createWorkspace({ name: 'New Workspace 3' }, page);
|
||||
|
||||
@@ -67,14 +67,14 @@ test('create multi workspace in the workspace list', async ({ page }) => {
|
||||
await page.reload();
|
||||
await openWorkspaceListModal(page);
|
||||
await page.getByTestId('draggable-item').nth(1).click();
|
||||
await page.waitForTimeout(50);
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// @ts-expect-error
|
||||
const currentId: string = await page.evaluate(() => currentWorkspace.id);
|
||||
|
||||
await openWorkspaceListModal(page);
|
||||
const sourceElement = await page.getByTestId('draggable-item').nth(2);
|
||||
const targetElement = await page.getByTestId('draggable-item').nth(1);
|
||||
const sourceElement = page.getByTestId('draggable-item').nth(2);
|
||||
const targetElement = page.getByTestId('draggable-item').nth(1);
|
||||
|
||||
const sourceBox = await sourceElement.boundingBox();
|
||||
const targetBox = await targetElement.boundingBox();
|
||||
@@ -99,7 +99,7 @@ test('create multi workspace in the workspace list', async ({ page }) => {
|
||||
}
|
||||
);
|
||||
await page.mouse.up();
|
||||
await page.waitForTimeout(50);
|
||||
await page.waitForTimeout(100);
|
||||
await page.reload();
|
||||
await openWorkspaceListModal(page);
|
||||
|
||||
@@ -110,6 +110,7 @@ test('create multi workspace in the workspace list', async ({ page }) => {
|
||||
}
|
||||
|
||||
await page.getByTestId('draggable-item').nth(2).click();
|
||||
await page.waitForTimeout(100);
|
||||
|
||||
// @ts-expect-error
|
||||
const nextId: string = await page.evaluate(() => currentWorkspace.id);
|
||||
|
||||
@@ -2,12 +2,12 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('preset workspace name', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const workspaceName = page.getByTestId('workspace-name');
|
||||
await page.waitForTimeout(1000);
|
||||
expect(await workspaceName.textContent()).toBe('Demo Workspace');
|
||||
@@ -22,7 +22,7 @@ test('preset workspace name', async ({ page }) => {
|
||||
// });
|
||||
test('Open language switch menu', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const editorOptionMenuButton = page.getByTestId('editor-option-menu');
|
||||
await expect(editorOptionMenuButton).toBeVisible();
|
||||
await editorOptionMenuButton.click();
|
||||
|
||||
@@ -2,14 +2,14 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
import { createWorkspace } from '../libs/workspace';
|
||||
|
||||
test('Open last workspace when back to affine', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await createWorkspace({ name: 'New Workspace 2' }, page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
// show workspace list
|
||||
await page.getByTestId('workspace-name').click();
|
||||
|
||||
@@ -19,7 +19,7 @@ test('Open last workspace when back to affine', async ({ page }) => {
|
||||
await workspaceCards[1].click();
|
||||
await openHomePage(page);
|
||||
|
||||
const workspaceNameDom = await page.getByTestId('workspace-name');
|
||||
const workspaceNameDom = page.getByTestId('workspace-name');
|
||||
const currentWorkspaceName = await workspaceNameDom.evaluate(
|
||||
node => node.textContent
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { expect, type Page } from '@playwright/test';
|
||||
|
||||
import { withCtrlOrMeta } from '../libs/keyboard';
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { newPage, waitMarkdownImported } from '../libs/page-logic';
|
||||
import { newPage, waitEditorLoad } from '../libs/page-logic';
|
||||
|
||||
const openQuickSearchByShortcut = async (page: Page) =>
|
||||
await withCtrlOrMeta(page, () => page.keyboard.press('k', { delay: 50 }));
|
||||
@@ -33,7 +33,7 @@ async function titleIsFocused(page: Page) {
|
||||
|
||||
test('Click slider bar button', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
const quickSearchButton = page.locator(
|
||||
'[data-testid=slider-bar-quick-search-button]'
|
||||
@@ -45,7 +45,7 @@ test('Click slider bar button', async ({ page }) => {
|
||||
|
||||
test('Click arrowDown icon after title', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
const quickSearchButton = page.locator(
|
||||
'[data-testid=slider-bar-quick-search-button]'
|
||||
@@ -57,7 +57,7 @@ test('Click arrowDown icon after title', async ({ page }) => {
|
||||
|
||||
test('Press the shortcut key cmd+k', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
const quickSearch = page.locator('[data-testid=quickSearch]');
|
||||
@@ -66,7 +66,7 @@ test('Press the shortcut key cmd+k', async ({ page }) => {
|
||||
|
||||
test('Create a new page without keyword', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
const addNewPage = page.locator('[data-testid=quick-search-add-new-page]');
|
||||
@@ -77,7 +77,7 @@ test('Create a new page without keyword', async ({ page }) => {
|
||||
|
||||
test('Create a new page with keyword', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
await page.keyboard.insertText('test123456');
|
||||
@@ -89,7 +89,7 @@ test('Create a new page with keyword', async ({ page }) => {
|
||||
|
||||
test('Enter a keyword to search for', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
await page.keyboard.insertText('test123456');
|
||||
@@ -99,7 +99,7 @@ test('Enter a keyword to search for', async ({ page }) => {
|
||||
|
||||
test('Create a new page and search this page', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
// input title and create new page
|
||||
@@ -131,7 +131,7 @@ test('Navigate to the 404 page and try to open quick search', async ({
|
||||
|
||||
test('Open quick search on local page', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
const publishedSearchResults = page.locator('[publishedSearchResults]');
|
||||
@@ -140,7 +140,7 @@ test('Open quick search on local page', async ({ page }) => {
|
||||
|
||||
test('Autofocus input after opening quick search', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
const locator = page.locator('[cmdk-input]');
|
||||
@@ -149,7 +149,7 @@ test('Autofocus input after opening quick search', async ({ page }) => {
|
||||
});
|
||||
test('Autofocus input after select', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
await page.keyboard.press('ArrowUp');
|
||||
@@ -159,7 +159,7 @@ test('Autofocus input after select', async ({ page }) => {
|
||||
});
|
||||
test('Focus title after creating a new page', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await newPage(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
const addNewPage = page.locator('[data-testid=quick-search-add-new-page]');
|
||||
@@ -171,7 +171,7 @@ test('Not show navigation path if page is not a subpage or current page is not i
|
||||
page,
|
||||
}) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await openQuickSearchByShortcut(page);
|
||||
expect(await page.getByTestId('navigation-path').count()).toBe(0);
|
||||
});
|
||||
|
||||
@@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage, webUrl } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
|
||||
test('goto not found page', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const currentUrl = page.url();
|
||||
const invalidUrl = currentUrl.replace(/\/$/, '') + '/invalid';
|
||||
await page.goto(invalidUrl);
|
||||
@@ -15,9 +15,9 @@ test('goto not found page', async ({ page }) => {
|
||||
|
||||
test('goto not found workspace', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const currentUrl = page.url();
|
||||
await page.goto(new URL('/workspace/invalid/all', webUrl).toString());
|
||||
await page.waitForSelector('v-line');
|
||||
await waitEditorLoad(page);
|
||||
expect(page.url()).toEqual(currentUrl);
|
||||
});
|
||||
|
||||
@@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
|
||||
test('Open shortcuts modal', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await page.locator('[data-testid=help-island]').click();
|
||||
|
||||
const shortcutsIcon = page.locator('[data-testid=shortcuts-icon]');
|
||||
|
||||
@@ -2,11 +2,11 @@ import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
|
||||
test('Create subpage', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
await page.getByTestId('app-sidebar-arrow-button-collapse').click();
|
||||
const sliderBarArea = page.getByTestId('sliderBar-inner');
|
||||
await expect(sliderBarArea).not.toBeInViewport();
|
||||
|
||||
@@ -4,7 +4,7 @@ import { test, testResultDir } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitEditorLoad } from '../libs/page-logic';
|
||||
|
||||
// default could be anything, according to the system
|
||||
test('default white', async ({ browser }) => {
|
||||
@@ -13,7 +13,7 @@ test('default white', async ({ browser }) => {
|
||||
});
|
||||
const page = await context.newPage();
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
await waitEditorLoad(page);
|
||||
const root = page.locator('html');
|
||||
const themeMode = await root.evaluate(element =>
|
||||
element.getAttribute('data-theme')
|
||||
|
||||
Reference in New Issue
Block a user