mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 09:36:17 +08:00
test: add test for New a page ,then open it and show favorite
This commit is contained in:
@@ -32,6 +32,7 @@ const PopoverContent = () => {
|
||||
return (
|
||||
<>
|
||||
<MenuItem
|
||||
data-testid="editor-option-menu-favorite"
|
||||
onClick={() => {
|
||||
toggleFavoritePage(id);
|
||||
toast(!favorite ? 'Removed to Favourites' : 'Added to Favourites');
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { loadPage } from './libs/load-page';
|
||||
|
||||
loadPage();
|
||||
|
||||
test.describe('Local first favorite page', () => {
|
||||
test('New a page ,then open it and show favorite', async ({ page }) => {
|
||||
await page.getByText('New Page').click();
|
||||
await page.getByPlaceholder('Title').click();
|
||||
await page.getByPlaceholder('Title').fill('this is a new page to favorite');
|
||||
|
||||
await page.getByRole('link', { name: 'All pages' }).click();
|
||||
|
||||
const cell = await page.getByRole('cell', {
|
||||
name: 'this is a new page to favorite',
|
||||
});
|
||||
|
||||
expect(cell).not.toBeUndefined();
|
||||
|
||||
await cell.click();
|
||||
|
||||
await page
|
||||
.getByTestId('editor-header-items')
|
||||
.getByRole('button')
|
||||
.nth(2)
|
||||
.click();
|
||||
|
||||
const favoriteBtn = page.getByTestId('editor-option-menu-favorite');
|
||||
|
||||
await favoriteBtn.click();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user