Skip to content

Commit

Permalink
refactor(e2e): Remove unused V1Workspace import and clean up test code.
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagodallacqua-hpe committed Oct 16, 2024
1 parent 8ad53e0 commit 1c8ec33
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions webui/react/src/e2e/tests/experimentList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ProjectDetails } from 'e2e/models/pages/ProjectDetails';
import { detExecSync, fullPath } from 'e2e/utils/detCLI';
import { safeName } from 'e2e/utils/naming';
import { repeatWithFallback } from 'e2e/utils/polling';
import { V1Project, V1Workspace } from 'services/api-ts-sdk';
import { V1Project } from 'services/api-ts-sdk';
import { ExperimentBase } from 'types';

test.describe('Experiment List', () => {
Expand Down Expand Up @@ -563,48 +563,30 @@ test.describe('Experiment List', () => {

test.describe('Row Actions', () => {
let destinationProject: V1Project;
let destinationWorkspace: V1Workspace;
let experimentId: number;

// create a new project, workspace and experiment
test.beforeAll(async ({ backgroundApiProject, backgroundApiWorkspace }) => {
destinationWorkspace = (await backgroundApiWorkspace.createWorkspace(
backgroundApiWorkspace.new(),
)).workspace;
test.beforeAll(async ({ backgroundApiProject, newProject: { response: { project } } }) => {
destinationProject = (await backgroundApiProject.createProject(
destinationWorkspace.id,
backgroundApiProject.new(),
project.workspaceId,
backgroundApiProject.new({ projectProps: { workspaceId: project.workspaceId } }),
)).project;

const expId = Number(detExecSync(
`experiment create ${fullPath('examples/tutorials/mnist_pytorch/adaptive.yaml')} --paused --project_id ${destinationProject.id}`,
`experiment create ${fullPath('examples/tutorials/mnist_pytorch/adaptive.yaml')} --paused --project_id ${project.id}`,
).split(' ')[2]); // returns in the format "Created experiment <exp_id>"

if (!Number.isNaN(expId)) experimentId = expId;
});

test.beforeEach(async ({ authedPage, newProject }) => {
test.slow();
projectDetailsPage = new ProjectDetails(authedPage);

await projectDetailsPage.gotoProject(newProject.response.project.id);

const grid = projectDetailsPage.f_experimentList.dataGrid;

await grid.setColumnHeight();
await grid.headRow.setColumnDefs();
});

// cleanup
test.afterAll(async ({ backgroundApiProject, backgroundApiWorkspace }) => {
test.afterAll(async ({ backgroundApiProject }) => {
if (experimentId !== undefined) {
detExecSync(`experiment kill ${experimentId}`);
detExecSync(`experiment delete ${experimentId} --y`);
}

await backgroundApiProject.deleteProject(destinationProject.id);
await backgroundApiWorkspace.deleteWorkspace(destinationProject.id);

});

test('move experiment', async () => {
Expand All @@ -615,7 +597,6 @@ test.describe('Experiment List', () => {
const menuMove = await newExperimentRow.experimentActionDropdown.open();

await menuMove.menuItem('Move').pwLocator.click();
await menuMove.moveModal.destinationWorkspace.pwLocator.fill(destinationProject.workspaceName ?? '');
await menuMove.moveModal.destinationProject.pwLocator.waitFor({ state: 'visible' });
await menuMove.moveModal.destinationProject.pwLocator.fill(destinationProject.name);
await menuMove.moveModal.footer.submit.pwLocator.click();
Expand Down

0 comments on commit 1c8ec33

Please sign in to comment.