From 74e13392ba72ef2ffd3e6a5dfd1a701ce8883511 Mon Sep 17 00:00:00 2001 From: Dipanshu Gupta Date: Wed, 12 Jun 2024 20:21:35 +0530 Subject: [PATCH] Cypress test for experiments table time --- .../cypress/pages/pipelines/experiments.ts | 8 +++++++ .../tests/mocked/pipelines/experiments.cy.ts | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/frontend/src/__tests__/cypress/cypress/pages/pipelines/experiments.ts b/frontend/src/__tests__/cypress/cypress/pages/pipelines/experiments.ts index 1e11d33846..c9941d06b7 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/pipelines/experiments.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/pipelines/experiments.ts @@ -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 { diff --git a/frontend/src/__tests__/cypress/cypress/tests/mocked/pipelines/experiments.cy.ts b/frontend/src/__tests__/cypress/cypress/tests/mocked/pipelines/experiments.cy.ts index 3cdcccbbc2..c1d606d412 100644 --- a/frontend/src/__tests__/cypress/cypress/tests/mocked/pipelines/experiments.cy.ts +++ b/frontend/src/__tests__/cypress/cypress/tests/mocked/pipelines/experiments.cy.ts @@ -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: '', }), ]; @@ -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