Skip to content

Commit

Permalink
ci: add e2e bulk kill test (#9868)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtonG authored Sep 3, 2024
1 parent 590c362 commit 8cacba6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
2 changes: 1 addition & 1 deletion webui/react/src/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Pick between live and static
1. `det deploy local cluster-up --no-gpu --master-port=8080`
2. `SERVER_ADDRESS="http://localhost:3001" npm run build --prefix webui/react`
3. Optional `npm run preview --prefix webui/react` to run the preview app. Won't be used if `CI=true`.
4. To run the tests: `PW_SERVER_ADDRESS="http://localhost:3001" PW_USER_NAME="admin" PW_PASSWORD="" npm run e2e --prefix webui/react`
4. To run the tests: `PW_BASE_URL="http://localhost:3001" PW_USERNAME="admin" PW_PASSWORD="" npm run e2e --prefix webui/react`
- Provide `-- -p=firefox` to choose one browser to run on. Full list of projects located in [playwright config](/webui/react/playwright.config.ts).

## Run Tests
Expand Down
44 changes: 41 additions & 3 deletions webui/react/src/e2e/tests/experimentList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ test.describe('Experiment List', () => {
await expect(
projectDetailsPageSetup.f_experimentList.tableActionBar.count.pwLocator,
).toContainText('experiment');
detExecSync(
`experiment create ${fullPath('examples/tutorials/mnist_pytorch/adaptive.yaml')} --paused --project_id ${newProject.response.project.id}`,
);
Array(3)
.fill(null)
.forEach(() => {
detExecSync(
`experiment create ${fullPath('examples/tutorials/mnist_pytorch/adaptive.yaml')} --paused --project_id ${newProject.response.project.id}`,
);
});
await expect(
projectDetailsPageSetup.f_experimentList.dataGrid.rows.pwLocator,
).not.toHaveCount(0, { timeout: 10_000 });
Expand Down Expand Up @@ -311,4 +315,38 @@ test.describe('Experiment List', () => {
await row.experimentActionDropdown.pause.pwLocator.click();
await expect.soft((await row.getCellByColumnName('State')).pwLocator).toHaveText('paused');
});

test('Datagrid Bulk Action', async () => {
// should probably go last/before move
await test.step('Kill', async () => {
type RowType = typeof projectDetailsPage.f_experimentList.dataGrid.rows;
const rows = [0, 1].map((idx) => {
return projectDetailsPage.f_experimentList.dataGrid.getRowByIndex(idx);
});
const expectStateForRow = async (state: string, row: RowType) => {
const stateColumn = await row.getCellByColumnName('State');
await expect(stateColumn.pwLocator).toHaveText(state);
};
await rows.reduce(async (memo, row) => {
await memo;
await expectStateForRow('paused', row);
await row.clickColumn('Select');
}, Promise.resolve());

await projectDetailsPage.f_experimentList.tableActionBar.actions.kill.select();

// TODO: modal component model assumes buttons are attached to form
await projectDetailsPage.pwLocator.getByRole('button', { name: 'kill' }).click();

await expect(async () => {
await Promise.all([
...rows.map(expectStateForRow.bind(this, 'canceled')),
expectStateForRow(
'paused',
projectDetailsPage.f_experimentList.dataGrid.getRowByIndex(2),
),
]);
}).toPass();
});
});
});

0 comments on commit 8cacba6

Please sign in to comment.