Skip to content

Commit

Permalink
Change error when importing v1 pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
DaoDaoNoCode committed Jan 16, 2025
1 parent 7ffc255 commit fa555b1
Show file tree
Hide file tree
Showing 10 changed files with 802 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PipelineImportModal extends Modal {
}

findSubmitButton() {
return this.findFooter().findByTestId('import-button');
return this.findFooter().findByTestId('modal-submit-button');
}

findUploadPipelineRadio() {
Expand Down Expand Up @@ -56,7 +56,7 @@ class PipelineImportModal extends Modal {
}

findImportModalError() {
return this.find().findByTestId('import-modal-error');
return this.find().findByTestId('error-message-alert');
}

mockCreatePipelineAndVersion(params: CreatePipelineAndVersionKFData, namespace: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PipelineImportModal extends Modal {
}

findSubmitButton() {
return this.findFooter().findByRole('button', { name: 'Upload', hidden: true });
return cy.findByTestId('modal-submit-button');
}

findVersionNameInput() {
Expand Down Expand Up @@ -51,7 +51,7 @@ class PipelineImportModal extends Modal {
}

findImportModalError() {
return this.find().findByTestId('import-modal-error');
return this.find().findByTestId('error-message-alert');
}

selectPipelineByName(name: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import type { PipelineKF, PipelineVersionKF } from '~/concepts/pipelines/kfTypes
import { tablePagination } from '~/__tests__/cypress/cypress/pages/components/Pagination';
import { verifyRelativeURL } from '~/__tests__/cypress/cypress/utils/url';
import { pipelineRunsGlobal } from '~/__tests__/cypress/cypress/pages/pipelines/pipelineRunsGlobal';
import { argoAlert } from '~/__tests__/cypress/cypress/pages/pipelines/argoAlert';

const projectName = 'test-project-name';
const initialMockPipeline = buildMockPipeline({ display_name: 'Test pipeline' });
Expand All @@ -43,6 +44,7 @@ const initialMockPipelineVersion = buildMockPipelineVersion({
const pipelineYamlPath = './cypress/tests/mocked/pipelines/mock-upload-pipeline.yaml';
const argoWorkflowPipeline = './cypress/tests/mocked/pipelines/argo-workflow-pipeline.yaml';
const tooLargePipelineYAMLPath = './cypress/tests/mocked/pipelines/not-a-pipeline-2-megabytes.yaml';
const v1PipelineYamlPath = './cypress/tests/mocked/pipelines/v1-pipeline.yaml';

describe('Pipelines', () => {
it('Empty state', () => {
Expand Down Expand Up @@ -644,6 +646,26 @@ describe('Pipelines', () => {
pipelineImportModal.findImportModalError().contains('Unsupported pipeline version');
});

it('fails to import a v1 pipeline', () => {
initIntercepts({});
pipelinesGlobal.visit(projectName);

// Open the "Import pipeline" modal
pipelinesGlobal.findImportPipelineButton().click();

// Fill out the "Import pipeline" modal and submit
pipelineImportModal.shouldBeOpen();
pipelineImportModal.fillPipelineName('New pipeline');
pipelineImportModal.fillPipelineDescription('New pipeline description');
pipelineImportModal.uploadPipelineYaml(v1PipelineYamlPath);
pipelineImportModal.submit();

pipelineImportModal.findImportModalError().should('exist');
pipelineImportModal.findImportModalError().contains('Pipeline update and recompile required');
argoAlert.findCloudServiceReleaseNotesLink().should('exist');
argoAlert.findSelfManagedReleaseNotesLink().should('exist');
});

it('imports a new pipeline by url', () => {
initIntercepts({});
pipelinesGlobal.visit(projectName);
Expand Down
Loading

0 comments on commit fa555b1

Please sign in to comment.