mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor: header options menu (#3615)
This commit is contained in:
@@ -70,7 +70,7 @@ test('Able to insert the title of an untitled page', async ({ page }) => {
|
||||
await titleBarTextContent.click({ delay: 100 });
|
||||
const titleContent = await page.getByTestId('title-content');
|
||||
await titleContent.fill('test');
|
||||
await page.getByTestId('save-edit-button').click({ delay: 100 });
|
||||
await titleContent.blur();
|
||||
expect(await titleBarTextContent.textContent()).toBe('test');
|
||||
});
|
||||
|
||||
@@ -81,11 +81,11 @@ test('Able to edit the title of an existing page', async ({ page }) => {
|
||||
await titleBarTextContent.click({ delay: 100 });
|
||||
const titleContent = await page.getByTestId('title-content');
|
||||
await titleContent.fill('test');
|
||||
await page.getByTestId('save-edit-button').click({ delay: 100 });
|
||||
await titleContent.blur();
|
||||
expect(await titleBarTextContent.textContent()).toBe('test');
|
||||
await titleBarTextContent.click({ delay: 100 });
|
||||
await titleContent.fill('Sample text 2');
|
||||
await page.getByTestId('save-edit-button').click({ delay: 100 });
|
||||
await titleContent.blur();
|
||||
expect(await titleBarTextContent.textContent()).toBe('Sample text 2');
|
||||
});
|
||||
|
||||
@@ -98,10 +98,28 @@ test('Clearing out the title bar will remove the page title', async ({
|
||||
await titleBarTextContent.click({ delay: 100 });
|
||||
const titleContent = await page.getByTestId('title-content');
|
||||
await titleContent.fill('test');
|
||||
await page.getByTestId('save-edit-button').click({ delay: 100 });
|
||||
await titleContent.blur();
|
||||
expect(await titleBarTextContent.textContent()).toBe('test');
|
||||
await titleBarTextContent.click({ delay: 100 });
|
||||
await titleContent.fill('');
|
||||
await page.getByTestId('save-edit-button').click({ delay: 100 });
|
||||
await titleContent.blur();
|
||||
expect(await titleBarTextContent.textContent()).toBe('Untitled');
|
||||
});
|
||||
|
||||
test('Rename by editor header items, save with shortcut', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickPageMoreActions(page);
|
||||
const menusRenameItem = page.getByTestId('editor-option-menu-rename');
|
||||
await menusRenameItem.click({ delay: 100 });
|
||||
const titleBarTextContent = page.getByTestId('title-edit-button');
|
||||
const titleContent = page.getByTestId('title-content');
|
||||
await titleContent.fill('test');
|
||||
await page.keyboard.press('Enter');
|
||||
expect(await titleBarTextContent.textContent()).toBe('test');
|
||||
await clickPageMoreActions(page);
|
||||
await menusRenameItem.click({ delay: 100 });
|
||||
await titleContent.fill('');
|
||||
await page.keyboard.press('Escape');
|
||||
expect(await titleBarTextContent.textContent()).toBe('Untitled');
|
||||
});
|
||||
|
||||
18
tests/affine-local/e2e/local-first-import-page.spec.ts
Normal file
18
tests/affine-local/e2e/local-first-import-page.spec.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
||||
import {
|
||||
clickPageMoreActions,
|
||||
waitEditorLoad,
|
||||
} from '@affine-test/kit/utils/page-logic';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
test('Click import page item', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickPageMoreActions(page);
|
||||
const importItem = page.getByTestId('editor-option-menu-import');
|
||||
await importItem.click();
|
||||
const importModal = page.locator('import-page');
|
||||
|
||||
expect(await importModal.isVisible()).toBe(true);
|
||||
});
|
||||
@@ -46,6 +46,6 @@ export const createLinkedPage = async (page: Page, pageName?: string) => {
|
||||
export async function clickPageMoreActions(page: Page) {
|
||||
return page
|
||||
.getByTestId('editor-header-items')
|
||||
.getByTestId('editor-option-menu')
|
||||
.getByTestId('header-dropDownButton')
|
||||
.click();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user