From 4906931c444c8cc491382557a4894a6f0f6017d1 Mon Sep 17 00:00:00 2001 From: Keita Nonaka Date: Wed, 30 Oct 2024 13:06:20 -0700 Subject: [PATCH] test: unify test cases --- .../src/e2e/tests/experimentList.spec.ts | 44 ++++++------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/webui/react/src/e2e/tests/experimentList.spec.ts b/webui/react/src/e2e/tests/experimentList.spec.ts index fa52cc7513e..eab5739043d 100644 --- a/webui/react/src/e2e/tests/experimentList.spec.ts +++ b/webui/react/src/e2e/tests/experimentList.spec.ts @@ -399,6 +399,20 @@ test.describe('Experiment List', () => { }); }); + test('Archive/Unarchive an experiment', async () => { + projectDetailsPage._page.setDefaultTimeout(60_000); + + const row = projectDetailsPage.f_experimentList.dataGrid.getRowByIndex(0); + + const experimentActionDropdown = await row.experimentActionDropdown.open(); + await experimentActionDropdown.menuItem('Stop').pwLocator.click(); + await expect((await row.getCellByColumnName('State')).pwLocator).toHaveText('canceled'); + await experimentActionDropdown.menuItem('Archive').pwLocator.click(); + await expect(experimentActionDropdown.menuItem('Unarchive').pwLocator).toBeVisible(); + await experimentActionDropdown.menuItem('Unarchive').pwLocator.click(); + await expect(experimentActionDropdown.menuItem('Archive').pwLocator).toBeVisible(); + }); + test.describe('Experiment List Pagination', () => { test.beforeAll(({ newProject }) => { Array(51) @@ -677,35 +691,5 @@ test.describe('Experiment List', () => { ); await expect(newProjectRows.length).toBe(1); }); - - test('Archive an experiment', async () => { - if (experimentId === undefined) throw new Error('No experiment ID was found'); - - const newExperimentRow = - await projectDetailsPage.f_experimentList.dataGrid.getRowByColumnValue( - 'ID', - experimentId.toString(), - ); - - const experimentActionDropdown = await newExperimentRow.experimentActionDropdown.open(); - - await experimentActionDropdown.menuItem('Archive').pwLocator.click(); - await expect(experimentActionDropdown.menuItem('Unarchive').pwLocator).toBeVisible(); - }); - - test('Unarchive an experiment', async () => { - if (experimentId === undefined) throw new Error('No experiment ID was found'); - - const newExperimentRow = - await projectDetailsPage.f_experimentList.dataGrid.getRowByColumnValue( - 'ID', - experimentId.toString(), - ); - - const experimentActionDropdown = await newExperimentRow.experimentActionDropdown.open(); - - await experimentActionDropdown.menuItem('Unarchive').pwLocator.click(); - await expect(experimentActionDropdown.menuItem('Archive').pwLocator).toBeVisible(); - }); }); });