Skip to content

Commit

Permalink
refactor: Update data-test attributes and improve selectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodallacqua-hpe committed Oct 22, 2024
1 parent f335f37 commit 74d1e28
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 2 additions & 0 deletions webui/react/src/components/ExperimentMoveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ const ExperimentMoveModalComponent: React.FC<Props> = ({
name="workspaceId"
rules={[{ message: 'Workspace is required', required: true }]}>
<Select
data-test="workspace"
filterOption={(input, option) =>
(option?.title?.toString() ?? '').toLowerCase().includes(input.toLowerCase())
}
Expand Down Expand Up @@ -200,6 +201,7 @@ const ExperimentMoveModalComponent: React.FC<Props> = ({
Failed: () => null, // Inform the user if this fails to load
Loaded: (loadableProjects) => (
<Select
data-test="project"
filterOption={(input, option) =>
(option?.title?.toString() ?? '').toLowerCase().includes(input.toLowerCase())
}
Expand Down
4 changes: 2 additions & 2 deletions webui/react/src/e2e/models/components/ExperimentMoveModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"]',
});
}
20 changes: 8 additions & 12 deletions webui/react/src/e2e/tests/experimentList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});

0 comments on commit 74d1e28

Please sign in to comment.