AFFiNE/tests/local-first-new-page.spec.ts

25 lines
915 B
TypeScript

import { expect } from '@playwright/test';
import { loadPage } from './libs/load-page';
import { getBlockSuiteEditorTitle, newPage } from './libs/page-logic';
import { test } from './libs/playwright';
loadPage();
test.describe('local first new page', () => {
test('click btn new page', async ({ page }) => {
const originPageId = page.url().split('/').reverse()[0];
await newPage(page);
const newPageId = page.url().split('/').reverse()[0];
expect(newPageId).not.toBe(originPageId);
});
test('click btn bew page and find it in all pages', async ({ page }) => {
await newPage(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();
});
});