diff --git a/frontend/src/__tests__/cypress/cypress/e2e/pipelines/PipelineRunsGlobal.cy.ts b/frontend/src/__tests__/cypress/cypress/e2e/pipelines/PipelineRunsGlobal.cy.ts new file mode 100644 index 0000000000..d59b00b5a5 --- /dev/null +++ b/frontend/src/__tests__/cypress/cypress/e2e/pipelines/PipelineRunsGlobal.cy.ts @@ -0,0 +1,49 @@ +import { mockStatus } from '~/__mocks__/mockStatus'; +import { mockDashboardConfig } from '~/__mocks__/mockDashboardConfig'; +import { mockDataSciencePipelineApplicationK8sResource } from '~/__mocks__/mockDataSciencePipelinesApplicationK8sResource'; +import { mockRouteK8sResource } from '~/__mocks__/mockRouteK8sResource'; +import { mockK8sResourceList } from '~/__mocks__/mockK8sResourceList'; +import { mockProjectK8sResource } from '~/__mocks__/mockProjectK8sResource'; +import { pipelineRunsGlobal } from '~/__tests__/cypress/cypress/pages/pipelines'; + +const projectName = 'test-project-name'; + +describe('Pipeline Runs Global', () => { + beforeEach(() => { + initIntercepts(); + pipelineRunsGlobal.visit(projectName); + }); + + it('renders the page with scheduled and triggered runs table data', () => { + // TODO + }); +}); + +const initIntercepts = () => { + cy.intercept('/api/status', mockStatus()); + cy.intercept('/api/config', mockDashboardConfig({})); + cy.intercept( + { + pathname: `/api/k8s/apis/datasciencepipelinesapplications.opendatahub.io/v1alpha1/namespaces/${projectName}/datasciencepipelinesapplications/pipelines-definition`, + }, + mockDataSciencePipelineApplicationK8sResource({ namespace: projectName }), + ); + cy.intercept( + { + pathname: `/api/k8s/apis/route.openshift.io/v1/namespaces/${projectName}/routes/ds-pipeline-pipelines-definition`, + }, + mockRouteK8sResource({ + notebookName: 'ds-pipeline-pipelines-definition', + namespace: projectName, + }), + ); + cy.intercept( + { + pathname: '/api/k8s/apis/project.openshift.io/v1/projects', + }, + mockK8sResourceList([ + mockProjectK8sResource({ k8sName: projectName }), + mockProjectK8sResource({ k8sName: `${projectName}-2`, displayName: 'Test Project 2' }), + ]), + ); +}; diff --git a/frontend/src/__tests__/cypress/cypress/pages/pipelines/index.ts b/frontend/src/__tests__/cypress/cypress/pages/pipelines/index.ts index 6197933415..f0990a286e 100644 --- a/frontend/src/__tests__/cypress/cypress/pages/pipelines/index.ts +++ b/frontend/src/__tests__/cypress/cypress/pages/pipelines/index.ts @@ -3,3 +3,6 @@ export * from './pipelinesTable'; export * from './pipelinesGlobal'; export * from './pipelineImportModal'; export * from './pipelineVersionImportModal'; +export * from './pipelineRunsGlobal'; +export * from './pipelineRunTable'; +export * from './pipelineRunJobTable'; diff --git a/frontend/src/__tests__/cypress/cypress/pages/pipelines/pipelineRunJobTable.ts b/frontend/src/__tests__/cypress/cypress/pages/pipelines/pipelineRunJobTable.ts new file mode 100644 index 0000000000..b333864bce --- /dev/null +++ b/frontend/src/__tests__/cypress/cypress/pages/pipelines/pipelineRunJobTable.ts @@ -0,0 +1,9 @@ +class PipelineRunJobTable { + private testId = 'pipeline-run-job-table'; + + find() { + return cy.findByTestId(this.testId); + } +} + +export const pipelineRunJobTable = new PipelineRunJobTable(); diff --git a/frontend/src/__tests__/cypress/cypress/pages/pipelines/pipelineRunTable.ts b/frontend/src/__tests__/cypress/cypress/pages/pipelines/pipelineRunTable.ts new file mode 100644 index 0000000000..42a8ffcd25 --- /dev/null +++ b/frontend/src/__tests__/cypress/cypress/pages/pipelines/pipelineRunTable.ts @@ -0,0 +1,9 @@ +class PipelineRunTable { + private testId = 'pipeline-run-table'; + + find() { + return cy.findByTestId(this.testId); + } +} + +export const pipelineRunTable = new PipelineRunTable(); diff --git a/frontend/src/__tests__/cypress/cypress/pages/pipelines/pipelineRunsGlobal.ts b/frontend/src/__tests__/cypress/cypress/pages/pipelines/pipelineRunsGlobal.ts new file mode 100644 index 0000000000..8aff1bf902 --- /dev/null +++ b/frontend/src/__tests__/cypress/cypress/pages/pipelines/pipelineRunsGlobal.ts @@ -0,0 +1,30 @@ +class PipelineRunsGlobal { + private testId = 'pipeline-runs-global-page'; + + visit(projectName: string) { + cy.visitWithLogin(`/pipelineRuns/${projectName}`); + this.find(); + } + + find() { + return cy.findByTestId(this.testId); + } + + findScheduledTab() { + return cy.findByRole('tab', { name: 'Scheduled runs tab' }); + } + + findTriggeredTab() { + return cy.findByRole('tab', { name: 'Triggered runs tab' }); + } + + findProjectSelect() { + return this.find().findByTestId('project-selector-dropdown'); + } + + selectProjectByName(name: string) { + this.findProjectSelect().findDropdownItem(name).click(); + } +} + +export const pipelineRunsGlobal = new PipelineRunsGlobal(); diff --git a/frontend/src/concepts/pipelines/content/tables/pipelineRun/PipelineRunTable.tsx b/frontend/src/concepts/pipelines/content/tables/pipelineRun/PipelineRunTable.tsx index 31796dc57f..4f58c4d36c 100644 --- a/frontend/src/concepts/pipelines/content/tables/pipelineRun/PipelineRunTable.tsx +++ b/frontend/src/concepts/pipelines/content/tables/pipelineRun/PipelineRunTable.tsx @@ -120,6 +120,7 @@ const PipelineRunTable: React.FC = ({ )} variant={TableVariant.compact} getColumnSort={getTableColumnSort({ columns: pipelineRunColumns, ...tableProps })} + data-testid="pipeline-run-table" /> = ({ )} variant={TableVariant.compact} getColumnSort={getTableColumnSort({ columns: pipelineRunJobColumns, ...tableProps })} + data-testid="pipeline-run-job-table" /> = ({ @@ -51,6 +52,7 @@ const ApplicationsPage: React.FC = ({ headerContent, provideChildrenPadding, jobReferenceName, + testId, }) => { const renderHeader = () => ( @@ -136,11 +138,11 @@ const ApplicationsPage: React.FC = ({ }; return ( - <> +
{breadcrumb && {breadcrumb}} {renderHeader()} {renderContents()} - +
); }; diff --git a/frontend/src/pages/pipelines/global/pipelines/GlobalPipelines.tsx b/frontend/src/pages/pipelines/global/pipelines/GlobalPipelines.tsx index 8a938c4119..218aad3136 100644 --- a/frontend/src/pages/pipelines/global/pipelines/GlobalPipelines.tsx +++ b/frontend/src/pages/pipelines/global/pipelines/GlobalPipelines.tsx @@ -14,22 +14,19 @@ const GlobalPipelines: React.FC = () => { const pipelinesAPi = usePipelinesAPI(); return ( -
- - } - getRedirectPath={(namespace) => `/pipelines/${namespace}`} - > - - - - - - -
+ } + getRedirectPath={(namespace) => `/pipelines/${namespace}`} + testId="pipelines-global-page" + > + + + + + + ); }; diff --git a/frontend/src/pages/pipelines/global/runs/GlobalPipelineRuns.tsx b/frontend/src/pages/pipelines/global/runs/GlobalPipelineRuns.tsx index b972740461..d63a0e85a1 100644 --- a/frontend/src/pages/pipelines/global/runs/GlobalPipelineRuns.tsx +++ b/frontend/src/pages/pipelines/global/runs/GlobalPipelineRuns.tsx @@ -14,6 +14,7 @@ const GlobalPipelineRuns: React.FC = () => ( description={pipelineRunsPageDescription} getRedirectPath={(namespace) => `/pipelineRuns/${namespace}`} overrideChildPadding + testId="pipeline-runs-global-page" > diff --git a/frontend/src/pages/pipelines/global/runs/GlobalPipelineRunsTabs.tsx b/frontend/src/pages/pipelines/global/runs/GlobalPipelineRunsTabs.tsx index 9fa0728d20..fa11f07c79 100644 --- a/frontend/src/pages/pipelines/global/runs/GlobalPipelineRunsTabs.tsx +++ b/frontend/src/pages/pipelines/global/runs/GlobalPipelineRunsTabs.tsx @@ -31,7 +31,7 @@ const GlobalPipelineRunsTab: React.FC = () => { Scheduled} - aria-label="Scheduled tab" + aria-label="Scheduled runs tab" className="odh-tabcontent-fix" >