mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-03 18:40:00 +08:00
fix: title behavior on BlockSuite editor (#1264)
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
export async function newPage(page: Page) {
|
||||
await page.waitForSelector('virgo-line');
|
||||
// fixme(himself65): if too fast, the page will crash
|
||||
await page.getByTestId('sliderBar').getByText('New Page').click({
|
||||
delay: 100,
|
||||
});
|
||||
await page.waitForTimeout(100);
|
||||
await page.waitForSelector('virgo-line');
|
||||
}
|
||||
|
||||
export function getBlockSuiteEditorTitle(page: Page) {
|
||||
return page.locator('virgo-line').nth(0);
|
||||
}
|
||||
|
||||
export async function clickPageMoreActions(page: Page) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { loadPage } from './libs/load-page';
|
||||
import { newPage } from './libs/page-logic';
|
||||
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
|
||||
import { test } from './libs/playwright';
|
||||
|
||||
loadPage();
|
||||
@@ -11,8 +11,8 @@ test.describe('Local first delete page', () => {
|
||||
page,
|
||||
}) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page to restore');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');
|
||||
const newPageId = page.url().split('/').reverse()[0];
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
const cell = page.getByRole('cell', {
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { loadPage } from './libs/load-page';
|
||||
import { clickPageMoreActions, newPage } from './libs/page-logic';
|
||||
import {
|
||||
clickPageMoreActions,
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
} from './libs/page-logic';
|
||||
import { test } from './libs/playwright';
|
||||
loadPage();
|
||||
|
||||
test.describe('Local first export page', () => {
|
||||
test.skip('New a page ,then open it and export html', async ({ page }) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await page
|
||||
.getByPlaceholder('Title')
|
||||
.fill('this is a new page to export html content');
|
||||
@@ -38,7 +42,7 @@ test.describe('Local first export page', () => {
|
||||
page,
|
||||
}) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await page
|
||||
.getByPlaceholder('Title')
|
||||
.fill('this is a new page to export markdown content');
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { loadPage } from './libs/load-page';
|
||||
import { clickPageMoreActions, newPage } from './libs/page-logic';
|
||||
import {
|
||||
clickPageMoreActions,
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
} from './libs/page-logic';
|
||||
import { test } from './libs/playwright';
|
||||
loadPage();
|
||||
|
||||
test.describe('Local first favorite and cancel favorite page', () => {
|
||||
test('New a page and open it ,then favorite it', async ({ page }) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page to favorite');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
const cell = page.getByRole('cell', {
|
||||
name: 'this is a new page to favorite',
|
||||
@@ -23,8 +27,8 @@ test.describe('Local first favorite and cancel favorite page', () => {
|
||||
});
|
||||
test('Cancel favorite', async ({ page }) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page to favorite');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
const cell = page.getByRole('cell', {
|
||||
name: 'this is a new page to favorite',
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { loadPage } from './libs/load-page';
|
||||
import { clickPageMoreActions, newPage } from './libs/page-logic';
|
||||
import {
|
||||
clickPageMoreActions,
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
} from './libs/page-logic';
|
||||
import { test } from './libs/playwright';
|
||||
loadPage();
|
||||
|
||||
test.describe('Local first favorite items ui', () => {
|
||||
test('Show favorite items in sidebar', async ({ page }) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page to favorite');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
const newPageId = page.url().split('/').reverse()[0];
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
const cell = page.getByRole('cell', {
|
||||
@@ -31,8 +35,8 @@ test.describe('Local first favorite items ui', () => {
|
||||
|
||||
test('Show favorite items in favorite list', async ({ page }) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page to favorite');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to favorite');
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
const cell = page.getByRole('cell', {
|
||||
name: 'this is a new page to favorite',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { loadPage } from './libs/load-page';
|
||||
import { newPage } from './libs/page-logic';
|
||||
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
|
||||
import { test } from './libs/playwright';
|
||||
loadPage();
|
||||
|
||||
@@ -15,8 +15,8 @@ test.describe('local first new page', () => {
|
||||
|
||||
test('click btn bew page and find it in all pages', async ({ page }) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page');
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
const cell = page.getByRole('cell', { name: 'this is a new page' });
|
||||
expect(cell).not.toBeUndefined();
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { loadPage } from './libs/load-page';
|
||||
import { newPage } from './libs/page-logic';
|
||||
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
|
||||
import { test } from './libs/playwright';
|
||||
loadPage();
|
||||
|
||||
test.describe('local first new page', () => {
|
||||
test('click btn bew page and open in tab', async ({ page }) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page');
|
||||
const newPageUrl = page.url();
|
||||
const newPageId = page.url().split('/').reverse()[0];
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { loadPage } from './libs/load-page';
|
||||
import { newPage } from './libs/page-logic';
|
||||
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
|
||||
import { test } from './libs/playwright';
|
||||
loadPage();
|
||||
|
||||
@@ -10,8 +10,8 @@ test.describe('Local first delete page', () => {
|
||||
page,
|
||||
}) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page to restore');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to restore');
|
||||
const originPageUrl = page.url();
|
||||
const newPageId = page.url().split('/').reverse()[0];
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { loadPage } from './libs/load-page';
|
||||
import { clickPageMoreActions, newPage } from './libs/page-logic';
|
||||
import {
|
||||
clickPageMoreActions,
|
||||
getBlockSuiteEditorTitle,
|
||||
newPage,
|
||||
} from './libs/page-logic';
|
||||
import { test } from './libs/playwright';
|
||||
loadPage();
|
||||
|
||||
test.describe('Local first delete page', () => {
|
||||
test('New a page ,then open it and show delete modal', async ({ page }) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page to delete');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
const cell = page.getByRole('cell', {
|
||||
name: 'this is a new page to delete',
|
||||
@@ -28,8 +32,8 @@ test.describe('Local first delete page', () => {
|
||||
page,
|
||||
}) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page to delete');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
|
||||
const newPageId = page.url().split('/').reverse()[0];
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
const cell = page.getByRole('cell', {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { loadPage } from './libs/load-page';
|
||||
import { newPage } from './libs/page-logic';
|
||||
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
|
||||
import { test } from './libs/playwright';
|
||||
loadPage();
|
||||
|
||||
@@ -10,8 +10,8 @@ test.describe('Local first trash page', () => {
|
||||
page,
|
||||
}) => {
|
||||
await newPage(page);
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page to delete');
|
||||
await getBlockSuiteEditorTitle(page).click();
|
||||
await getBlockSuiteEditorTitle(page).fill('this is a new page to delete');
|
||||
const newPageId = page.url().split('/').reverse()[0];
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
const cell = page.getByRole('cell', {
|
||||
|
||||
Reference in New Issue
Block a user