mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat: new collections (#4530)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
@@ -19,10 +19,7 @@ const monthNames = [
|
||||
];
|
||||
|
||||
export const createFirstFilter = async (page: Page, name: string) => {
|
||||
await page
|
||||
.locator('[data-testid="header"]')
|
||||
.locator('button', { hasText: 'Filter' })
|
||||
.click();
|
||||
await page.locator('[data-testid="create-first-filter"]').click();
|
||||
await page
|
||||
.locator('[data-testid="variable-select-item"]', { hasText: name })
|
||||
.click();
|
||||
@@ -42,9 +39,9 @@ const dateFormat = (date: Date) => {
|
||||
};
|
||||
|
||||
export const checkPagesCount = async (page: Page, count: number) => {
|
||||
expect((await page.locator('[data-testid="title"]').all()).length).toBe(
|
||||
count
|
||||
);
|
||||
expect(
|
||||
(await page.locator('[data-testid="page-list-item"]').all()).length
|
||||
).toBe(count);
|
||||
};
|
||||
|
||||
export const checkDatePicker = async (page: Page, date: Date) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
import type { Locator, Page } from '@playwright/test';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
export async function waitForEditorLoad(page: Page) {
|
||||
@@ -16,7 +16,7 @@ export async function waitForAllPagesLoad(page: Page) {
|
||||
|
||||
export async function clickNewPageButton(page: Page) {
|
||||
// fixme(himself65): if too fast, the page will crash
|
||||
await page.getByTestId('new-page-button').click({
|
||||
await page.getByTestId('new-page-button').first().click({
|
||||
delay: 100,
|
||||
});
|
||||
await waitForEditorLoad(page);
|
||||
@@ -51,3 +51,28 @@ export async function clickPageMoreActions(page: Page) {
|
||||
.getByTestId('header-dropDownButton')
|
||||
.click();
|
||||
}
|
||||
|
||||
export const getPageOperationButton = (page: Page, id: string) => {
|
||||
return getPageItem(page, id).getByTestId('page-list-operation-button');
|
||||
};
|
||||
|
||||
export const getPageItem = (page: Page, id: string) => {
|
||||
return page.locator(`[data-page-id="${id}"][data-testid="page-list-item"]`);
|
||||
};
|
||||
|
||||
export const getPageByTitle = (page: Page, title: string) => {
|
||||
return page.getByTestId('page-list-item').getByText(title);
|
||||
};
|
||||
|
||||
export const dragTo = async (page: Page, locator: Locator, target: Locator) => {
|
||||
await locator.hover();
|
||||
await page.mouse.down();
|
||||
await page.waitForTimeout(1000);
|
||||
const targetElement = await target.boundingBox();
|
||||
if (!targetElement) {
|
||||
throw new Error('target element not found');
|
||||
}
|
||||
await page.mouse.move(targetElement.x, targetElement.y);
|
||||
await target.hover();
|
||||
await page.mouse.up();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user