2023-01-03 16:57:33 +03:00
|
|
|
import type { Page } from '@playwright/test';
|
|
|
|
|
2023-03-28 08:25:16 +03:00
|
|
|
export async function waitMarkdownImported(page: Page) {
|
2023-04-17 00:02:41 +03:00
|
|
|
await page.waitForSelector('v-line');
|
2023-03-28 08:25:16 +03:00
|
|
|
}
|
|
|
|
|
2023-01-03 16:57:33 +03:00
|
|
|
export async function newPage(page: Page) {
|
2023-03-01 10:40:01 +03:00
|
|
|
// fixme(himself65): if too fast, the page will crash
|
2023-03-27 21:41:04 +03:00
|
|
|
await page.getByTestId('new-page-button').click({
|
2023-03-01 10:40:01 +03:00
|
|
|
delay: 100,
|
|
|
|
});
|
2023-03-07 05:11:49 +03:00
|
|
|
await page.waitForSelector('v-line');
|
2023-03-02 20:38:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
export function getBlockSuiteEditorTitle(page: Page) {
|
2023-03-07 05:11:49 +03:00
|
|
|
return page.locator('v-line').nth(0);
|
2022-12-30 21:32:59 +03:00
|
|
|
}
|
|
|
|
|
2023-01-03 16:57:33 +03:00
|
|
|
export async function clickPageMoreActions(page: Page) {
|
2022-12-30 21:32:59 +03:00
|
|
|
return page
|
|
|
|
.getByTestId('editor-header-items')
|
2023-03-01 10:40:01 +03:00
|
|
|
.getByTestId('editor-option-menu')
|
2022-12-30 21:32:59 +03:00
|
|
|
.click();
|
|
|
|
}
|
2023-04-13 11:31:28 +03:00
|
|
|
|
2023-04-27 03:31:01 +03:00
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
*/
|
2023-04-13 11:31:28 +03:00
|
|
|
export async function createPinboardPage(
|
|
|
|
page: Page,
|
|
|
|
parentId: string,
|
|
|
|
title: string
|
|
|
|
) {
|
|
|
|
await newPage(page);
|
|
|
|
await page.focus('.affine-default-page-block-title');
|
|
|
|
await page.type('.affine-default-page-block-title', title, {
|
|
|
|
delay: 100,
|
|
|
|
});
|
|
|
|
await clickPageMoreActions(page);
|
|
|
|
await page.getByTestId('move-to-menu-item').click();
|
|
|
|
await page
|
|
|
|
.getByTestId('pinboard-menu')
|
|
|
|
.getByTestId(`pinboard-${parentId}`)
|
|
|
|
.click();
|
|
|
|
}
|