There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
test: remove deprecated api usage (#4577)
Alex Yang8f5ee9234c81
diff --git a/tests/affine-cloud/e2e/basic.spec.ts b/tests/affine-cloud/e2e/basic.spec.tsindex 3c080593af..a372c81a47 100644--- a/tests/affine-cloud/e2e/basic.spec.ts+++ b/tests/affine-cloud/e2e/basic.spec.ts@@ -124,7 +124,7 @@ test.describe('basic', () => {});const nameInput = page.getByPlaceholder('Input account name');await nameInput.clear();- await nameInput.type(newName, {+ await nameInput.pressSequentially(newName, {delay: 50,});await page.getByTestId('save-user-name').click({diff --git a/tests/affine-cloud/e2e/collaboration.spec.ts b/tests/affine-cloud/e2e/collaboration.spec.tsindex 7576eb184c..f2aeb2cd9e 100644--- a/tests/affine-cloud/e2e/collaboration.spec.ts+++ b/tests/affine-cloud/e2e/collaboration.spec.ts@@ -49,7 +49,7 @@ test.describe('collaboration', () => {);await enableCloudWorkspace(page);const title = getBlockSuiteEditorTitle(page);- await title.type('TEST TITLE', {+ await title.pressSequentially('TEST TITLE', {delay: 50,});await page.keyboard.press('Enter', { delay: 50 });@@ -102,7 +102,7 @@ test.describe('collaboration', () => {await page2.goto(currentUrl);{const title = getBlockSuiteEditorTitle(page);- await title.type('TEST TITLE', {+ await title.pressSequentially('TEST TITLE', {delay: 50,});}@@ -124,7 +124,7 @@ test.describe('collaboration', () => {await clickUserInfoCard(page);const input = page.getByTestId('user-name-input');await input.clear();- await input.type('TEST USER', {+ await input.pressSequentially('TEST USER', {delay: 50,});await page.getByTestId('save-user-name').click({@@ -167,7 +167,7 @@ test.describe('collaboration', () => {const page2 = await context.newPage();await loginUser(page2, user.email);await page2.goto(page.url());- waitForEditorLoad(page2);+ await waitForEditorLoad(page2);const collections = page2.getByTestId('collections');await expect(collections.getByText('test collection')).toBeVisible();}@@ -235,7 +235,7 @@ test.describe('collaboration members', () => {.all();// make sure the first member is the owner- expect(page.getByTestId('member-item').first()).toContainText(+ await expect(page.getByTestId('member-item').first()).toContainText('Workspace Owner');diff --git a/tests/affine-desktop/e2e/basic.spec.ts b/tests/affine-desktop/e2e/basic.spec.tsindex 65de02d5a7..921fad362d 100644--- a/tests/affine-desktop/e2e/basic.spec.ts+++ b/tests/affine-desktop/e2e/basic.spec.ts@@ -1,6 +1,7 @@import { platform } from 'node:os';import { test } from '@affine-test/kit/electron';+import { getBlockSuiteEditorTitle } from '@affine-test/kit/utils/page-logic';import { clickSideBarSettingButton } from '@affine-test/kit/utils/sidebar';import { expect } from '@playwright/test';@@ -27,8 +28,9 @@ if (platform() === 'darwin') {delay: 100,});await page.waitForSelector('v-line');- await page.focus('.affine-doc-page-block-title');- await page.type('.affine-doc-page-block-title', 'test1', {+ const title = getBlockSuiteEditorTitle(page);+ await title.focus();+ await title.pressSequentially('test1', {delay: 100,});await page.waitForTimeout(500);@@ -36,8 +38,9 @@ if (platform() === 'darwin') {delay: 100,});await page.waitForSelector('v-line');- await page.focus('.affine-doc-page-block-title');- await page.type('.affine-doc-page-block-title', 'test2', {++ await title.focus();+ await title.pressSequentially('test2', {delay: 100,});await page.waitForTimeout(500);@@ -45,8 +48,8 @@ if (platform() === 'darwin') {delay: 100,});await page.waitForSelector('v-line');- await page.focus('.affine-doc-page-block-title');- await page.type('.affine-doc-page-block-title', 'test3', {+ await title.focus();+ await title.pressSequentially('test3', {delay: 100,});}@@ -155,9 +158,11 @@ test('windows only check', async ({ page }) => {test('delete workspace', async ({ page }) => {await page.getByTestId('current-workspace').click();await page.getByTestId('new-workspace').click();- await page.getByTestId('create-workspace-input').type('Delete Me', {- delay: 100,- });+ await page+ .getByTestId('create-workspace-input')+ .pressSequentially('Delete Me', {+ delay: 100,+ });await page.getByTestId('create-workspace-create-button').click({delay: 100,});@@ -170,7 +175,7 @@ test('delete workspace', async ({ page }) => {expect(await page.getByTestId('workspace-name-input').inputValue()).toBe('Delete Me');- const contentElement = await page.getByTestId('setting-modal-content');+ const contentElement = page.getByTestId('setting-modal-content');const boundingBox = await contentElement.boundingBox();if (!boundingBox) {throw new Error('boundingBox is null');@@ -181,7 +186,9 @@ test('delete workspace', async ({ page }) => {);await page.mouse.wheel(0, 500);await page.getByTestId('delete-workspace-button').click();- await page.getByTestId('delete-workspace-input').type('Delete Me');+ await page+ .getByTestId('delete-workspace-input')+ .pressSequentially('Delete Me');await page.getByTestId('delete-workspace-confirm-button').click();await page.waitForTimeout(1000);expect(await page.getByTestId('workspace-name').textContent()).toBe(diff --git a/tests/affine-legacy/0.8.0-canary.7/e2e/basic.spec.ts b/tests/affine-legacy/0.8.0-canary.7/e2e/basic.spec.tsindex 421b994c74..f68514df25 100644--- a/tests/affine-legacy/0.8.0-canary.7/e2e/basic.spec.ts+++ b/tests/affine-legacy/0.8.0-canary.7/e2e/basic.spec.ts@@ -21,7 +21,7 @@ test('database migration', async ({ page, context }) => {});await page.getByTestId('new-page-button').click();const title = page.locator('.affine-default-page-block-title');- await title.type('hello');+ await title.pressSequentially('hello');await page.keyboard.press('Enter', { delay: 50 });await page.keyboard.press('/', { delay: 50 });await page.keyboard.press('d');diff --git a/tests/affine-legacy/0.8.4/e2e/basic.spec.ts b/tests/affine-legacy/0.8.4/e2e/basic.spec.tsindex 9000836905..ef1d6d030d 100644--- a/tests/affine-legacy/0.8.4/e2e/basic.spec.ts+++ b/tests/affine-legacy/0.8.4/e2e/basic.spec.ts@@ -24,7 +24,7 @@ test('surface migration', async ({ page, context }) => {});await page.getByTestId('new-page-button').click();const title = getBlockSuiteEditorTitle(page);- await title.type('hello');+ await title.pressSequentially('hello');await page.keyboard.press('Enter', { delay: 50 });await page.keyboard.type('world', {delay: 50,diff --git a/tests/affine-local/e2e/blocksuite/editor.spec.ts b/tests/affine-local/e2e/blocksuite/editor.spec.tsindex 8166236a88..d1e889d05d 100644--- a/tests/affine-local/e2e/blocksuite/editor.spec.ts+++ b/tests/affine-local/e2e/blocksuite/editor.spec.ts@@ -23,7 +23,7 @@ test('database is useable', async ({ page }) => {await clickNewPageButton(page);await waitForEditorLoad(page);const title = getBlockSuiteEditorTitle(page);- await title.type('test title');+ await title.pressSequentially('test title');await page.keyboard.press('Enter');expect(await title.innerText()).toBe('test title');await addDatabase(page);@@ -34,7 +34,7 @@ test('database is useable', async ({ page }) => {await clickNewPageButton(page);await waitForEditorLoad(page);const title2 = getBlockSuiteEditorTitle(page);- await title2.type('test title2');+ await title2.pressSequentially('test title2');await page.waitForTimeout(500);expect(await title2.innerText()).toBe('test title2');await page.keyboard.press('Enter');@@ -48,14 +48,14 @@ test('link page is useable', async ({ page }) => {await waitForEditorLoad(page);await clickNewPageButton(page);await waitForEditorLoad(page);- const title = await getBlockSuiteEditorTitle(page);- await title.type('page1');+ const title = getBlockSuiteEditorTitle(page);+ await title.pressSequentially('page1');await page.keyboard.press('Enter');expect(await title.innerText()).toBe('page1');await clickNewPageButton(page);await waitForEditorLoad(page);- const title2 = await getBlockSuiteEditorTitle(page);- await title2.type('page2');+ const title2 = getBlockSuiteEditorTitle(page);+ await title2.pressSequentially('page2');await page.keyboard.press('Enter');expect(await title2.innerText()).toBe('page2');await page.keyboard.press('@', { delay: 50 });diff --git a/tests/affine-local/e2e/duplicate-page.spec.ts b/tests/affine-local/e2e/duplicate-page.spec.tsindex c5f3675f54..894e5fafe1 100644--- a/tests/affine-local/e2e/duplicate-page.spec.ts+++ b/tests/affine-local/e2e/duplicate-page.spec.ts@@ -13,7 +13,7 @@ test('Duplicate page should work', async ({ page }) => {await waitForEditorLoad(page);await clickNewPageButton(page);const title = getBlockSuiteEditorTitle(page);- await title.type('test');+ await title.pressSequentially('test');await clickPageMoreActions(page);const duplicateButton = page.getByTestId('editor-option-menu-duplicate');await duplicateButton.click({ delay: 100 });diff --git a/tests/affine-local/e2e/local-first-avatar.spec.ts b/tests/affine-local/e2e/local-first-avatar.spec.tsindex 73397d0f62..b352686406 100644--- a/tests/affine-local/e2e/local-first-avatar.spec.ts+++ b/tests/affine-local/e2e/local-first-avatar.spec.ts@@ -19,7 +19,7 @@ test('should create a page with a local first avatar and remove it', async ({await page.getByTestId('new-workspace').click({ delay: 50 });await page.getByTestId('create-workspace-input')- .type('Test Workspace 1', { delay: 50 });+ .pressSequentially('Test Workspace 1', { delay: 50 });await page.getByTestId('create-workspace-create-button').click();await page.getByTestId('workspace-name').click({delay: 50,diff --git a/tests/affine-local/e2e/local-first-delete-workspace.spec.ts b/tests/affine-local/e2e/local-first-delete-workspace.spec.tsindex 0f43a85e4e..1b577df39e 100644--- a/tests/affine-local/e2e/local-first-delete-workspace.spec.ts+++ b/tests/affine-local/e2e/local-first-delete-workspace.spec.ts@@ -13,7 +13,7 @@ test('Create new workspace, then delete it', async ({ page, workspace }) => {await page.getByTestId('new-workspace').click();await page.getByTestId('create-workspace-input')- .type('Test Workspace', { delay: 50 });+ .pressSequentially('Test Workspace', { delay: 50 });await page.getByTestId('create-workspace-create-button').click();await page.waitForTimeout(1000);@@ -25,12 +25,13 @@ test('Create new workspace, then delete it', async ({ page, workspace }) => {await openWorkspaceSettingPanel(page, 'Test Workspace');await page.getByTestId('delete-workspace-button').click();const workspaceNameDom = await page.getByTestId('workspace-name');- const currentWorkspaceName = await workspaceNameDom.evaluate(+ const currentWorkspaceName = (await workspaceNameDom.evaluate(node => node.textContent- );+ )) as string;+ expect(currentWorkspaceName).toBeDefined();await page.getByTestId('delete-workspace-input')- .type(currentWorkspaceName as string);+ .pressSequentially(currentWorkspaceName);const promise = page.getByTestId('affine-notification').waitFor({ state: 'attached' });@@ -46,7 +47,7 @@ test('Create new workspace, then delete it', async ({ page, workspace }) => {expect(currentWorkspace.flavour).toContain('local');});-//FIXME: this test is broken+test('Delete last workspace', async ({ page }) => {await openHomePage(page);await waitForEditorLoad(page);@@ -59,12 +60,14 @@ test('Delete last workspace', async ({ page }) => {await page.getByTestId('delete-workspace-button').click();await page.getByTestId('delete-workspace-input')- .type(currentWorkspaceName as string);+ .pressSequentially(currentWorkspaceName as string);await page.getByTestId('delete-workspace-confirm-button').click();await openHomePage(page);await expect(page.getByTestId('new-workspace')).toBeVisible();await page.getByTestId('new-workspace').click();- await page.type('[data-testid="create-workspace-input"]', 'Test Workspace');+ await page+ .locator('[data-testid="create-workspace-input"]')+ .pressSequentially('Test Workspace');await page.getByTestId('create-workspace-create-button').click();await page.waitForTimeout(1000);await page.waitForSelector('[data-testid="workspace-name"]');diff --git a/tests/affine-local/e2e/local-first-trash-page.spec.ts b/tests/affine-local/e2e/local-first-trash-page.spec.tsindex d8a186628a..dd2c2ef9e6 100644--- a/tests/affine-local/e2e/local-first-trash-page.spec.ts+++ b/tests/affine-local/e2e/local-first-trash-page.spec.ts@@ -52,7 +52,7 @@ test('New a page , then delete it in page, blockHub and option menu will not appawait waitForEditorLoad(page);await clickNewPageButton(page);const title = getBlockSuiteEditorTitle(page);- await title.type('test');+ await title.pressSequentially('test');await clickPageMoreActions(page);await page.getByTestId('editor-option-menu-delete').click();await page.getByTestId('confirm-delete-page').click();diff --git a/tests/affine-local/e2e/quick-search.spec.ts b/tests/affine-local/e2e/quick-search.spec.tsindex f1adb90c88..fb2d5f041f 100644--- a/tests/affine-local/e2e/quick-search.spec.ts+++ b/tests/affine-local/e2e/quick-search.spec.ts@@ -219,7 +219,7 @@ test('assert the recent browse pages are on the recent list', async ({await clickNewPageButton(page);{const title = getBlockSuiteEditorTitle(page);- await title.type('sgtokidoki', {+ await title.pressSequentially('sgtokidoki', {delay: 50,});}@@ -231,7 +231,7 @@ test('assert the recent browse pages are on the recent list', async ({await addNewPage.click();{const title = getBlockSuiteEditorTitle(page);- await title.type('theliquidhorse', {+ await title.pressSequentially('theliquidhorse', {delay: 50,});}@@ -242,7 +242,7 @@ test('assert the recent browse pages are on the recent list', async ({await addNewPage.click();{const title = getBlockSuiteEditorTitle(page);- await title.type('battlekot', {+ await title.pressSequentially('battlekot', {delay: 50,});}@@ -271,7 +271,7 @@ test('assert the recent browse pages are on the recent list', async ({await page.waitForTimeout(200);{const title = getBlockSuiteEditorTitle(page);- await title.type('affine is the best', {+ await title.pressSequentially('affine is the best', {delay: 50,});}