mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 06:47:02 +08:00
test(core): add e2e test for share page copy function (#11555)
related pr https://github.com/toeverything/AFFiNE/pull/11538 To close [BS-1915](https://linear.app/affine-design/issue/BS-1915/public-page-页面应该允许选中和复制内容)
This commit is contained in:
@@ -3,6 +3,8 @@ import { pasteContent } from '@affine-test/kit/utils/clipboard';
|
||||
import {
|
||||
clickEdgelessModeButton,
|
||||
clickPageModeButton,
|
||||
getCodeBlockIds,
|
||||
getParagraphIds,
|
||||
locateEditorContainer,
|
||||
} from '@affine-test/kit/utils/editor';
|
||||
import {
|
||||
@@ -84,28 +86,6 @@ async function verifyCodeBlockContent(
|
||||
);
|
||||
}
|
||||
|
||||
// Helper function to get block ids
|
||||
async function getBlockIds<T extends BlockComponent>(
|
||||
page: Page,
|
||||
selector: string
|
||||
) {
|
||||
const blocks = page.locator(selector);
|
||||
const blockIds = await blocks.evaluateAll((blocks: T[]) =>
|
||||
blocks.map(block => block.model.id)
|
||||
);
|
||||
return { blockIds };
|
||||
}
|
||||
|
||||
// Helper functions using the generic getBlockIds
|
||||
async function getParagraphIds(page: Page) {
|
||||
return getBlockIds<ParagraphBlockComponent>(page, paragraphLocator);
|
||||
}
|
||||
|
||||
// Helper functions using the generic getBlockIds
|
||||
async function getCodeBlockIds(page: Page) {
|
||||
return getBlockIds<CodeBlockComponent>(page, codeBlockLocator);
|
||||
}
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await clickNewPageButton(page, 'Clipboard Test');
|
||||
|
||||
Reference in New Issue
Block a user