From fc6d11be45eb80b3a64bd826a6fe3977258c3daa Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Thu, 7 Mar 2024 21:49:36 +0800 Subject: [PATCH] test: fix e2e --- .../grid-card/__e2e__/schemaInitializer.test.ts | 6 +++--- .../data-blocks/list/__e2e__/schemaInitializer.test.ts | 6 +++--- .../data-blocks/table/__e2e__/schemaSettings.test.ts | 4 ++-- packages/core/test/src/e2e/e2eUtils.ts | 2 +- .../src/client/__e2e__/schemaInitailizer.test.ts | 2 +- .../src/client/__e2e__/schemaInitailizer.test.ts | 2 +- .../src/client/__e2e__/schemaSettings.test.ts | 2 +- .../plugin-gantt/src/client/__e2e__/drag.test.ts | 2 +- .../src/client/__e2e__/schemaSettings.test.ts | 8 ++++---- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/schemaInitializer.test.ts index 87b151f241..8357c3a511 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/grid-card/__e2e__/schemaInitializer.test.ts @@ -53,7 +53,7 @@ test.describe('configure item actions', () => { await mockRecord('general'); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-gridCard:configureActionsItem-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-gridCard:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -68,7 +68,7 @@ test.describe('configure item actions', () => { await expect(page.getByLabel('action-Action.Link-Delete-destroy-general-grid-card').first()).toBeVisible(); // delete buttons - await page.getByLabel('schema-initializer-ActionBar-gridCard:configureActionsItem-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-gridCard:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -88,7 +88,7 @@ test.describe('configure item actions', () => { await mockRecord('general'); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-gridCard:configureActionsItem-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-gridCard:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'Customize' }).hover(); await page.getByRole('menuitem', { name: 'Popup' }).click(); await page.getByRole('menuitem', { name: 'Update record' }).click(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/list/__e2e__/schemaInitializer.test.ts b/packages/core/client/src/modules/blocks/data-blocks/list/__e2e__/schemaInitializer.test.ts index f7f6b64aa8..e1c6e7293c 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/list/__e2e__/schemaInitializer.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/list/__e2e__/schemaInitializer.test.ts @@ -51,7 +51,7 @@ test.describe('configure item actions', () => { await mockRecord('general'); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-list:configureActionsItem-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-list:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -66,7 +66,7 @@ test.describe('configure item actions', () => { await expect(page.getByLabel('action-Action.Link-Delete-destroy-general-list').first()).toBeVisible(); // delete buttons - await page.getByLabel('schema-initializer-ActionBar-list:configureActionsItem-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-list:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); await page.getByRole('menuitem', { name: 'Delete' }).click(); @@ -86,7 +86,7 @@ test.describe('configure item actions', () => { await mockRecord('general'); await nocoPage.goto(); - await page.getByLabel('schema-initializer-ActionBar-list:configureActionsItem-general').first().hover(); + await page.getByLabel('schema-initializer-ActionBar-list:configureItemActions-general').first().hover(); await page.getByRole('menuitem', { name: 'Customize' }).hover(); await page.getByRole('menuitem', { name: 'Popup' }).click(); await page.getByRole('menuitem', { name: 'Update record' }).click(); diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts index 72d09da6ad..6a5072a210 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaSettings.test.ts @@ -567,7 +567,7 @@ test.describe('actions schema settings', () => { test.describe('popup', () => { const addSomeCustomActions = async (page: Page) => { // 先删除掉之前的 actions - await page.getByRole('button', { name: 'Actions' }).hover(); + await page.getByRole('button', { name: 'Actions', exact: true }).hover(); await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-general').hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); @@ -624,7 +624,7 @@ test.describe('actions schema settings', () => { test.describe('update record', () => { const addSomeCustomActions = async (page: Page) => { // 先删除掉之前的 actions - await page.getByRole('button', { name: 'Actions' }).hover(); + await page.getByRole('button', { name: 'Actions', exact: true }).hover(); await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-general').hover(); await page.getByRole('menuitem', { name: 'View' }).click(); await page.getByRole('menuitem', { name: 'Edit' }).click(); diff --git a/packages/core/test/src/e2e/e2eUtils.ts b/packages/core/test/src/e2e/e2eUtils.ts index 3bb8af129a..1dc9fe9c00 100644 --- a/packages/core/test/src/e2e/e2eUtils.ts +++ b/packages/core/test/src/e2e/e2eUtils.ts @@ -864,7 +864,7 @@ export async function expectInitializerMenu({ showMenu, supportedOptions, page } * @param name */ export const createBlockInPage = async (page: Page, name: string) => { - await page.getByLabel('schema-initializer-Grid-BlockInitializers').hover(); + await page.getByLabel('schema-initializer-Grid-page:addBlock').hover(); if (name === 'Form') { await page.getByText('Form', { exact: true }).first().hover(); diff --git a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaInitailizer.test.ts b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaInitailizer.test.ts index 000201fbe4..a9d77f2d69 100644 --- a/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaInitailizer.test.ts +++ b/packages/plugins/@nocobase/plugin-action-duplicate/src/client/__e2e__/schemaInitailizer.test.ts @@ -11,7 +11,7 @@ test.describe('TableActionColumnInitializers & DetailsActionInitializers & ReadP const nocoPage = await mockPage(oneEmptyTableBlockWithCustomizeActions).waitForInit(); await mockRecords('general', 3); await nocoPage.goto(); - await page.getByRole('button', { name: 'Actions' }).hover(); + await page.getByRole('button', { name: 'Actions', exact: true }).hover(); await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-general').hover(); await page.getByRole('menuitem', { name: 'Duplicate' }).click(); await expect(page.getByLabel('action-Action.Link-Duplicate-duplicate-general-table-0')).toBeVisible(); diff --git a/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/schemaInitailizer.test.ts b/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/schemaInitailizer.test.ts index 21676b1e5c..16182a2ab6 100644 --- a/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/schemaInitailizer.test.ts +++ b/packages/plugins/@nocobase/plugin-action-print/src/client/__e2e__/schemaInitailizer.test.ts @@ -17,7 +17,7 @@ test.describe('ReadPrettyFormActionInitializers & CalendarFormActionInitializers await mockRecord('general', { singleLineText: 'test' }); await nocoPage.goto(); await page.getByTitle('test').click(); - await page.getByLabel('schema-initializer-ActionBar-calendar:configureActionsForm-general').hover(); + await page.getByLabel('schema-initializer-ActionBar-details:configureActions-general').hover(); await page.getByRole('menuitem', { name: 'Print' }).click(); await page.getByLabel('action-Action-Print-print-general-form').click(); }); diff --git a/packages/plugins/@nocobase/plugin-custom-request/src/client/__e2e__/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-custom-request/src/client/__e2e__/schemaSettings.test.ts index a3bd9265be..bb4a46bc24 100644 --- a/packages/plugins/@nocobase/plugin-custom-request/src/client/__e2e__/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-custom-request/src/client/__e2e__/schemaSettings.test.ts @@ -5,7 +5,7 @@ test('edit button', async ({ page, mockPage, mockRecord }) => { await mockRecord('t_unp4scqamw9'); // 新建一个 custom request action - await page.getByRole('button', { name: 'Actions' }).hover(); + await page.getByRole('button', { name: 'Actions', exact: true }).hover(); await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-').hover(); await page.getByRole('menuitem', { name: 'Customize right' }).hover(); await page.getByRole('menuitem', { name: 'Custom request' }).click(); diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/drag.test.ts b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/drag.test.ts index 4874963eb9..c054f0d15d 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/drag.test.ts +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/drag.test.ts @@ -16,7 +16,7 @@ test('drag and adjust start time, end time, and progress', async ({ page, mockPa await page.getByRole('option', { name: 'Week' }).click(); await page.getByRole('menuitem', { name: 'Time scale' }).hover(); await page.mouse.move(300, 0); - await page.getByRole('button', { name: 'Actions' }).click(); + await page.getByRole('button', { name: 'Actions', exact: true }).click(); await expect(page.locator('.calendarBottomText').first()).toHaveText(/W/); await page.locator('.bar ').hover(); const draggableElement = await page.getByLabel('task-bar').getByRole('button').first(); diff --git a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaSettings.test.ts b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaSettings.test.ts index e57c904394..8db3544bad 100644 --- a/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaSettings.test.ts +++ b/packages/plugins/@nocobase/plugin-gantt/src/client/__e2e__/schemaSettings.test.ts @@ -43,7 +43,7 @@ test.describe('configure params in gantt block', () => { await page.getByLabel('designer-schema-settings-CardItem-Gantt.Designer-general').hover(); await page.getByRole('menuitem', { name: 'Title field' }).click(); await page.getByRole('option', { name: 'Single line text2' }).locator('div').click(); - await page.getByRole('button', { name: 'Actions' }).click(); + await page.getByRole('button', { name: 'Actions', exact: true }).click(); await page.mouse.move(300, 0); const barLabel = page.getByLabel('block-item-gantt').locator('.barLabel'); await barLabel.hover(); @@ -57,7 +57,7 @@ test.describe('configure params in gantt block', () => { await page.getByRole('menuitem', { name: 'Start date field' }).click(); await page.getByRole('option', { name: 'Start date time2' }).locator('div').click(); await page.mouse.move(300, 0); - await page.getByRole('button', { name: 'Actions' }).click(); + await page.getByRole('button', { name: 'Actions', exact: true }).click(); await page.locator('.bar').hover({ position: { x: 20, y: 10 } }); await expect(page.getByLabel('nb-gantt-tooltip')).toHaveText( new RegExp(String(getYmd(new Date(mockData['startDatetime2'])))), @@ -72,7 +72,7 @@ test.describe('configure params in gantt block', () => { await page.getByRole('menuitem', { name: 'End date field' }).click(); await page.getByRole('option', { name: 'End date time2' }).locator('div').click(); await page.mouse.move(300, 0); - await page.getByRole('button', { name: 'Actions' }).click(); + await page.getByRole('button', { name: 'Actions', exact: true }).click(); await page.locator('.bar').hover({ position: { x: 20, y: 10 } }); await expect(page.getByLabel('nb-gantt-tooltip')).toHaveText( new RegExp(String(getYmd(new Date(mockData['endDatetime2'])))), @@ -88,7 +88,7 @@ test.describe('configure params in gantt block', () => { await page.getByRole('option', { name: 'Week' }).click(); await page.getByRole('menuitem', { name: 'Time scale' }).hover(); await page.mouse.move(300, 0); - await page.getByRole('button', { name: 'Actions' }).click(); + await page.getByRole('button', { name: 'Actions', exact: true }).click(); await page.locator('.bar').hover({ position: { x: 20, y: 10 } }); await expect(page.locator('.calendarBottomText').first()).toHaveText(/W/); });