mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
test: remove deprecated api usage (#4577)
This commit is contained in:
@@ -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 });
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"]');
|
||||
|
||||
@@ -52,7 +52,7 @@ test('New a page , then delete it in page, blockHub and option menu will not app
|
||||
await 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();
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user