From 74d1e28664b9aca8c569128078f78a9828146437 Mon Sep 17 00:00:00 2001 From: Thiago Dallacqua Date: Tue, 22 Oct 2024 14:14:45 -0300 Subject: [PATCH] refactor: Update data-test attributes and improve selectors. --- .../src/components/ExperimentMoveModal.tsx | 2 ++ .../models/components/ExperimentMoveModal.ts | 4 ++-- .../src/e2e/tests/experimentList.spec.ts | 20 ++++++++----------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/webui/react/src/components/ExperimentMoveModal.tsx b/webui/react/src/components/ExperimentMoveModal.tsx index 07e380ea5c88..f46f1b643577 100644 --- a/webui/react/src/components/ExperimentMoveModal.tsx +++ b/webui/react/src/components/ExperimentMoveModal.tsx @@ -169,6 +169,7 @@ const ExperimentMoveModalComponent: React.FC = ({ name="workspaceId" rules={[{ message: 'Workspace is required', required: true }]}> (option?.title?.toString() ?? '').toLowerCase().includes(input.toLowerCase()) } diff --git a/webui/react/src/e2e/models/components/ExperimentMoveModal.ts b/webui/react/src/e2e/models/components/ExperimentMoveModal.ts index b6c71be3ea58..cd90cd80334a 100644 --- a/webui/react/src/e2e/models/components/ExperimentMoveModal.ts +++ b/webui/react/src/e2e/models/components/ExperimentMoveModal.ts @@ -7,10 +7,10 @@ import { Select } from 'e2e/models/common/hew/Select'; export default class ExperimentMoveModal extends Modal { readonly destinationWorkspace = new Select({ parent: this, - selector: 'input[id="workspace"]', + selector: '[data-test="workspace"]', }); readonly destinationProject = new Select({ parent: this, - selector: 'input[id="projectId"]', + selector: '[data-test="project"]', }); } diff --git a/webui/react/src/e2e/tests/experimentList.spec.ts b/webui/react/src/e2e/tests/experimentList.spec.ts index 271c1f2b7bcf..a45b572d2ea5 100644 --- a/webui/react/src/e2e/tests/experimentList.spec.ts +++ b/webui/react/src/e2e/tests/experimentList.spec.ts @@ -623,26 +623,22 @@ test.describe('Experiment List', () => { const menuMove = await newExperimentRow.experimentActionDropdown.open(); await menuMove.menuItem('Move').pwLocator.click(); - await menuMove.moveModal.destinationWorkspace.pwLocator.fill(workspace.name); await menuMove.moveModal.destinationWorkspace.selectMenuOption(workspace.name); await menuMove.moveModal.destinationProject.pwLocator.waitFor({ state: 'visible' }); - await menuMove.moveModal.destinationProject.pwLocator.fill(destinationProject.name); - await menuMove.moveModal.destinationWorkspace.selectMenuOption(destinationProject.name); + await menuMove.moveModal.destinationProject.selectMenuOption(destinationProject.name); await menuMove.moveModal.footer.submit.pwLocator.click(); await menuMove.moveModal.pwLocator.waitFor({ state: 'hidden' }); await newExperimentRow.pwLocator.waitFor({ state: 'hidden' }); await projectDetailsPage.gotoProject(destinationProject.id); - await waitTableStable(); - await expect( - ( - await projectDetailsPage.f_experimentList.dataGrid.getRowByColumnValue( - 'ID', - experimentId.toString(), - ) - ).pwLocator, - ).toBeVisible(); + const grid = projectDetailsPage.f_experimentList.dataGrid; + await grid.setColumnHeight(); + await grid.headRow.setColumnDefs(); + const newProjectRows = await projectDetailsPage.f_experimentList.dataGrid.filterRows(() => + Promise.resolve(true), + ); + await expect(newProjectRows.length).toBe(1); }); }); });