test: improve data migration suite (#4124)

This commit is contained in:
Alex Yang
2023-09-02 03:31:07 +00:00
committed by GitHub
parent eb1a21265f
commit 70b5a9deeb
43 changed files with 273 additions and 265 deletions
+16 -16
View File
@@ -4,7 +4,7 @@ import { openHomePage } from '@affine-test/kit/utils/load-page';
import {
getBlockSuiteEditorTitle,
newPage,
waitEditorLoad,
waitForEditorLoad,
} from '@affine-test/kit/utils/page-logic';
import { expect, type Page } from '@playwright/test';
@@ -38,7 +38,7 @@ async function titleIsFocused(page: Page) {
test('Click slider bar button', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
const quickSearchButton = page.locator(
'[data-testid=slider-bar-quick-search-button]'
@@ -50,7 +50,7 @@ test('Click slider bar button', async ({ page }) => {
test('Click arrowDown icon after title', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
const quickSearchButton = page.locator(
'[data-testid=slider-bar-quick-search-button]'
@@ -62,7 +62,7 @@ test('Click arrowDown icon after title', async ({ page }) => {
test('Press the shortcut key cmd+k', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
await openQuickSearchByShortcut(page);
const quickSearch = page.locator('[data-testid=quickSearch]');
@@ -71,7 +71,7 @@ test('Press the shortcut key cmd+k', async ({ page }) => {
test('Create a new page without keyword', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
await openQuickSearchByShortcut(page);
const addNewPage = page.locator('[data-testid=quick-search-add-new-page]');
@@ -82,7 +82,7 @@ test('Create a new page without keyword', async ({ page }) => {
test('Create a new page with keyword', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test123456');
@@ -94,7 +94,7 @@ test('Create a new page with keyword', async ({ page }) => {
test('Enter a keyword to search for', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test123456');
@@ -104,7 +104,7 @@ test('Enter a keyword to search for', async ({ page }) => {
test('Create a new page and search this page', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
await openQuickSearchByShortcut(page);
// input title and create new page
@@ -124,7 +124,7 @@ test('Create a new page and search this page', async ({ page }) => {
await assertTitle(page, 'test123456');
await page.reload();
await waitEditorLoad(page);
await waitForEditorLoad(page);
await openQuickSearchByShortcut(page);
await page.keyboard.insertText('test123456');
await page.waitForTimeout(300);
@@ -146,7 +146,7 @@ test('Navigate to the 404 page and try to open quick search', async ({
test('Open quick search on local page', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
await openQuickSearchByShortcut(page);
const publishedSearchResults = page.locator('[publishedSearchResults]');
@@ -155,7 +155,7 @@ test('Open quick search on local page', async ({ page }) => {
test('Autofocus input after opening quick search', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
await openQuickSearchByShortcut(page);
const locator = page.locator('[cmdk-input]');
@@ -164,7 +164,7 @@ test('Autofocus input after opening quick search', async ({ page }) => {
});
test('Autofocus input after select', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
await openQuickSearchByShortcut(page);
await page.keyboard.press('ArrowUp');
@@ -174,7 +174,7 @@ test('Autofocus input after select', async ({ page }) => {
});
test('Focus title after creating a new page', async ({ page }) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await newPage(page);
await openQuickSearchByShortcut(page);
const addNewPage = page.locator('[data-testid=quick-search-add-new-page]');
@@ -186,7 +186,7 @@ test('Not show navigation path if page is not a subpage or current page is not i
page,
}) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
await openQuickSearchByShortcut(page);
expect(await page.getByTestId('navigation-path').count()).toBe(0);
});
@@ -195,7 +195,7 @@ test('assert the recent browse pages are on the recent list', async ({
page,
}) => {
await openHomePage(page);
await waitEditorLoad(page);
await waitForEditorLoad(page);
// create first page
await newPage(page);
@@ -242,7 +242,7 @@ test('assert the recent browse pages are on the recent list', async ({
// create forth page, and check does the recent page list only contains three pages
await page.reload();
await waitEditorLoad(page);
await waitForEditorLoad(page);
await openQuickSearchByShortcut(page);
{
const addNewPage = page.getByTestId('quick-search-add-new-page');