Skip to content

Commit

Permalink
Merge pull request #2904 from dpanshug/experiment-lastrun
Browse files Browse the repository at this point in the history
Cypress test for experiments table time
  • Loading branch information
openshift-merge-bot[bot] authored Jun 12, 2024
2 parents f17df69 + 74e1339 commit fa1489f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ class ExperimentsRow extends TableRow {
findCheckbox() {
return this.find().find(`[data-label=Checkbox]`).find('input');
}

findExperimentCreatedTime() {
return this.find().find(`[data-label="Created"]`);
}

findExperimentLastRunTime() {
return this.find().find(`[data-label="Last run started"]`);
}
}

class ExperimentsTable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@ const mockExperiments = [
buildMockExperimentKF({
display_name: 'Test experiment 1',
experiment_id: '1',
last_run_created_at: '2024-02-31T15:46:33Z',
}),
buildMockExperimentKF({
display_name: 'Test experiment 2',
experiment_id: '2',
last_run_created_at: '1970-01-01T00:00:00Z',
}),
buildMockExperimentKF({
display_name: 'Test experiment 3',
experiment_id: '3',
last_run_created_at: '',
}),
];

Expand All @@ -63,6 +66,27 @@ describe('Experiments', () => {
experimentsTabs.getArchivedExperimentsTable().findEmptyState().should('exist');
});

it('experiments table time', () => {
experimentsTabs.findActiveTab().click();
const activeExperimentsTable = experimentsTabs.getActiveExperimentsTable();
activeExperimentsTable
.getRowByName('Test experiment 1')
.findExperimentLastRunTime()
.contains('3 months ago');

// Last run time when experiment is just created
activeExperimentsTable
.getRowByName('Test experiment 2')
.findExperimentLastRunTime()
.contains('-');

// Last run time when empty
activeExperimentsTable
.getRowByName('Test experiment 3')
.findExperimentLastRunTime()
.contains('-');
});

it('filters by experiment name', () => {
experimentsTabs.findActiveTab().click();
// Verify initial run rows exist
Expand Down

0 comments on commit fa1489f

Please sign in to comment.