test: add test for New a page ,then open it and show favorite

This commit is contained in:
tzhangchi
2022-12-23 23:36:49 +08:00
parent 789a30b7aa
commit 30a685ad9a
2 changed files with 33 additions and 0 deletions
@@ -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');
+32
View File
@@ -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();
});
});