diff --git a/webui/react/src/e2e/README.md b/webui/react/src/e2e/README.md index f3eee40bc39..0dd240107a9 100644 --- a/webui/react/src/e2e/README.md +++ b/webui/react/src/e2e/README.md @@ -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 diff --git a/webui/react/src/e2e/tests/experimentList.spec.ts b/webui/react/src/e2e/tests/experimentList.spec.ts index d9adb2ff48e..eac8583f70e 100644 --- a/webui/react/src/e2e/tests/experimentList.spec.ts +++ b/webui/react/src/e2e/tests/experimentList.spec.ts @@ -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 }); @@ -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(); + }); + }); });