AFFiNE/tests/affine-local/e2e/blocksuite/editor.spec.ts
L-Sun bd31c8388c
fix(core): update outline viewer style (#7641)
## What changes
- Update responsive style and fix some bug of outline viewer (https://github.com/toeverything/blocksuite/pull/7759)
- Change left and right padding of full-width editor from `15px` to `72px`
- Hide outline viewer when side outline panel is opened ([BS-987](https://linear.app/affine-design/issue/BS-987/逻辑-bug-toc-入口和-toc-侧边栏共存))
- Add entries of outline panel and frame panel in more menu of detail page header ( [BS-996](https://linear.app/affine-design/issue/BS-996/page-mode-下的-page-option-缺少-view-table-of-contents-的入口) , [BS-1006](https://linear.app/affine-design/issue/BS-1006/edgeless-mode-的-page-options-里缺少-view-all-frames))
- Add outline viewer to dock peek preview ( [BS-995](https://linear.app/affine-design/issue/BS-995/center-peek-里缺少-quick-toc-的入口) )
- Add more e2e tests for outline viewer
2024-08-05 03:57:48 +00:00

76 lines
2.6 KiB
TypeScript

import { test } from '@affine-test/kit/playwright';
import { openHomePage } from '@affine-test/kit/utils/load-page';
import {
clickNewPageButton,
getBlockSuiteEditorTitle,
waitForEditorLoad,
} from '@affine-test/kit/utils/page-logic';
import type { Page } from '@playwright/test';
import { expect } from '@playwright/test';
const addDatabase = async (page: Page) => {
await page.keyboard.press('/', { delay: 500 });
await page.keyboard.press('d', { delay: 500 });
await page.keyboard.press('a', { delay: 500 });
await page.keyboard.press('t', { delay: 500 });
await page.keyboard.press('a', { delay: 500 });
await page.getByTestId('Table View').click();
};
test('database is useable', async ({ page }) => {
test.slow();
await openHomePage(page);
await waitForEditorLoad(page);
await clickNewPageButton(page);
const title = getBlockSuiteEditorTitle(page);
await title.pressSequentially('test title');
await page.keyboard.press('Enter');
expect(await title.innerText()).toBe('test title');
await addDatabase(page);
const database = page.locator('affine-database');
await expect(database).toBeVisible();
await page.reload();
await waitForEditorLoad(page);
await clickNewPageButton(page);
const title2 = getBlockSuiteEditorTitle(page);
await title2.pressSequentially('test title2');
await page.waitForTimeout(500);
expect(await title2.innerText()).toBe('test title2');
await page.keyboard.press('Enter');
await addDatabase(page);
const database2 = page.locator('affine-database');
await expect(database2).toBeVisible();
});
test('link page is useable', async ({ page }) => {
await openHomePage(page);
await waitForEditorLoad(page);
await clickNewPageButton(page);
await waitForEditorLoad(page);
const title = getBlockSuiteEditorTitle(page);
await title.pressSequentially('page1');
await page.keyboard.press('Enter');
expect(await title.innerText()).toBe('page1');
await clickNewPageButton(page);
await waitForEditorLoad(page);
const title2 = getBlockSuiteEditorTitle(page);
await title2.pressSequentially('page2');
await page.keyboard.press('Enter');
expect(await title2.innerText()).toBe('page2');
await page.keyboard.press('@', { delay: 50 });
await page.keyboard.press('p');
await page.keyboard.press('a');
await page.keyboard.press('g');
await page.keyboard.press('e');
await page.keyboard.press('1');
await page.keyboard.press('Enter');
const link = page.locator('.affine-reference');
await expect(link).toBeVisible();
await page.click('.affine-reference');
await page.waitForTimeout(500);
await expect(
page.locator('.doc-title-container:has-text("page1")')
).toBeVisible();
});