Skip to content

Commit

Permalink
Add E2E test to verify YAML generated from Create PipelineRun form
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanGreene authored and tekton-robot committed Dec 13, 2022
1 parent e58b8cd commit 653262b
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions packages/e2e/cypress/e2e/run/create-pipelinerun.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,60 @@ spec:
.should('have.text', 'Succeeded');
});

it('should populate YAML editor based on form inputs', function () {
const uniqueNumber = Date.now();

const pipelineName = `simple-pipeline-${uniqueNumber}`;
const pipelineRunName = `run-${uniqueNumber}`;
const pipeline = `apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: ${pipelineName}
namespace: ${namespace}
spec:
tasks:
- name: hello
taskSpec:
steps:
- name: echo
image: busybox
script: |
#!/bin/ash
echo "Hello World!"
`;
cy.exec(`echo "${pipeline}" | kubectl apply -f -`);
cy.visit(
`/#/pipelineruns/create?namespace=${namespace}&pipelineName=${pipelineName}`
);
cy.get('[id=create-pipelinerun--namespaces-dropdown]').should(
'have.value',
namespace
);
cy.get('[id=create-pipelinerun--pipelines-dropdown]').should(
'have.value',
pipelineName
);

cy.get('#create-pipelinerun--pipelinerunname').type(pipelineRunName);

cy.get('#create-pipelinerun--timeouts--pipeline').type('10m');

cy.contains('button', 'YAML Mode').click();
cy.url().should('include', 'mode=yaml');

cy.contains('.cm-content', `name: ${pipelineRunName}`);
cy.contains('.cm-content', `name: ${pipelineName}`);
cy.contains('.cm-content', 'pipeline: 10m');

cy.contains('button', 'Create').click();

cy.contains(pipelineRunName).parent().click();

cy.get('header[class="tkn--pipeline-run-header"]')
.find('span[class="tkn--status-label"]', { timeout: 15000 })
.should('have.text', 'Succeeded');
});

it('should create pipelinerun yaml mode', function () {
const uniqueNumber = Date.now();

Expand Down

0 comments on commit 653262b

Please sign in to comment.