Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add experiment list test for stop row action #10059

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions webui/react/src/e2e/fixtures/api.project.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,25 @@ export class ApiProjectFixture extends apiFixture(ProjectsApi) {
* @param {number} id The id of the project.
*/
async deleteProject(id: number): Promise<void> {
try {
await this.api.deleteProject(id);
} catch (error) {
if (error instanceof Response && error.body) {
const bodyText = error.text();
throw new Error(
`Delete Project Request failed. Status: ${error.status} Request: ${JSON.stringify({
id,
})} Response: ${bodyText}`,
);
}
}
await expect
.poll(
async () => {
const projectResp = await this.api.deleteProject(id).catch(async function (error) {
const respBody = await streamConsumers.text(error.body);
if (error.status === 404) {
return { completed: true };
}
throw new Error(
`Delete Project Request failed. Status: ${error.status} Request: ${JSON.stringify(
id,
)} Response: ${respBody}`,
);
});
return projectResp.completed;
},
() =>
this.api
.getProject(id)
.then(() => false)
.catch((res) => res.status === 404),
{
message: `Delete Project Request failed ${JSON.stringify(id)}`,
timeout: 15_000,
Expand Down
4 changes: 2 additions & 2 deletions webui/react/src/e2e/fixtures/api.search.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ export class ApiSearchFixture extends apiFixture(InternalApi) {
entrypoint: 'echo bonjour!',
name: safeName('apisearch'),
searcher: {
max_trials: 1,
metric: 'x',
name: 'custom',
unit: 'batches',
name: 'random',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we got rid of the custom searcher last week.

},
...config,
};
Expand Down
33 changes: 33 additions & 0 deletions webui/react/src/e2e/tests/experimentList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ test.describe('Experiment List', () => {
await waitTableStable();
await expect.soft((await row.getCellByColumnName('Name')).pwLocator).toHaveText(editedValue);
});

// await test.step('Stop', async () => {
// // what happens if the experiment is already stopped?
// });
Expand All @@ -346,6 +347,38 @@ test.describe('Experiment List', () => {
// await test.step('Hyperparameter Search', async () => {});
});

test('DataGrid Action Stop', async ({ apiSearches, newProject }) => {
const search = await apiSearches.new({}, { projectId: newProject.response.project.id });
await test.step('filter to experiment', async () => {
const tableFilter =
await projectDetailsPage.f_experimentList.tableActionBar.tableFilter.open();
await tableFilter.filterForm.filter.filterFields.columnName.selectMenuOption('ID');
await tableFilter.filterForm.filter.filterFields.operator.selectMenuOption('=');
await tableFilter.filterForm.filter.filterFields.valueNumber.pwLocator.fill(
search.id.toString(),
);

await expect(projectDetailsPage.f_experimentList.tableActionBar.count.pwLocator).toHaveText(
/^1 /,
);
await tableFilter.close();
});
await test.step('stop experiment', async () => {
const row = projectDetailsPage.f_experimentList.dataGrid.getRowByIndex(0);
await row.experimentActionDropdown.open();
await row.experimentActionDropdown.pwLocator.getByRole('menuitem', { name: 'Stop' }).click();
await expect((await row.getCellByColumnName('State')).pwLocator).toHaveText('canceled');
});
await test.step('stop menu item should be gone', async () => {
const row = projectDetailsPage.f_experimentList.dataGrid.getRowByIndex(0);
await row.experimentActionDropdown.open();
await expect(row.experimentActionDropdown.pwLocator).toBeVisible();
await expect(
row.experimentActionDropdown.pwLocator.getByRole('menuitem', { name: 'Stop' }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i prefer experimentActionDropdown.menuItem but i'm happy as long as it works

).toHaveCount(0);
});
});

test('DataGrid Action Pause', async () => {
// datagrid can be slow, perhaps related to [ET-677]
projectDetailsPage._page.setDefaultTimeout(10000);
Expand Down
Loading