Skip to content

Commit

Permalink
[RHOAIENG-1124] Initial pipeline runs global page test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jpuzz0 committed Jan 25, 2024
1 parent 2a0e69e commit d9976c7
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -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' }),
]),
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class PipelineRunJobTable {
private testId = 'pipeline-run-job-table';

find() {
return cy.findByTestId(this.testId);
}
}

export const pipelineRunJobTable = new PipelineRunJobTable();
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class PipelineRunTable {
private testId = 'pipeline-run-table';

find() {
return cy.findByTestId(this.testId);
}
}

export const pipelineRunTable = new PipelineRunTable();
Original file line number Diff line number Diff line change
@@ -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();
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const PipelineRunTable: React.FC<PipelineRunTableProps> = ({
)}
variant={TableVariant.compact}
getColumnSort={getTableColumnSort({ columns: pipelineRunColumns, ...tableProps })}
data-testid="pipeline-run-table"
/>
<DeletePipelineRunsModal
toDeleteResources={deleteResources}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const PipelineRunJobTable: React.FC<PipelineRunTableProps> = ({
)}
variant={TableVariant.compact}
getColumnSort={getTableColumnSort({ columns: pipelineRunJobColumns, ...tableProps })}
data-testid="pipeline-run-job-table"
/>
<DeletePipelineRunsModal
toDeleteResources={deleteResources}
Expand Down
26 changes: 14 additions & 12 deletions frontend/src/pages/pipelines/global/runs/GlobalPipelineRuns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ import PipelineRunVersionsContextProvider from '~/pages/pipelines/global/runs/Pi
import GlobalPipelineRunsTabs from './GlobalPipelineRunsTabs';

const GlobalPipelineRuns: React.FC = () => (
<PipelineCoreApplicationPage
title={pipelineRunsPageTitle}
description={pipelineRunsPageDescription}
getRedirectPath={(namespace) => `/pipelineRuns/${namespace}`}
overrideChildPadding
>
<EnsureAPIAvailability>
<PipelineRunVersionsContextProvider>
<GlobalPipelineRunsTabs />
</PipelineRunVersionsContextProvider>
</EnsureAPIAvailability>
</PipelineCoreApplicationPage>
<div data-testid="pipeline-runs-global-page">
<PipelineCoreApplicationPage
title={pipelineRunsPageTitle}
description={pipelineRunsPageDescription}
getRedirectPath={(namespace) => `/pipelineRuns/${namespace}`}
overrideChildPadding
>
<EnsureAPIAvailability>
<PipelineRunVersionsContextProvider>
<GlobalPipelineRunsTabs />
</PipelineRunVersionsContextProvider>
</EnsureAPIAvailability>
</PipelineCoreApplicationPage>
</div>
);

export default GlobalPipelineRuns;
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const GlobalPipelineRunsTab: React.FC = () => {
<Tab
eventKey={PipelineRunType.Scheduled}
title={<TabTitleText>Scheduled</TabTitleText>}
aria-label="Scheduled tab"
aria-label="Scheduled runs tab"
className="odh-tabcontent-fix"
>
<PageSection isFilled variant="light">
Expand Down

0 comments on commit d9976c7

Please sign in to comment.