Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1908375: added pipelines workspaces scripts #7574

Merged
merged 1 commit into from Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,71 +1,73 @@
@pipelines
Feature: Workspaces
As a user, I want to add or remove secrets details to pipeline

Background:
Given user has installed OpenShift Pipelines operator
And user has selected namespace "aut-pipeline-workspaces"
And user is at pipelines page
Background:
Given user has installed OpenShift Pipelines operator
And user has created or selected namespace "aut-pipelines-workspaces"
And user is at pipelines page


@regression, @smoke, @manual
Scenario: Create the pipeline with workspace : P-12-TC01
Given user is at Edit Yaml page
When user enters yaml content "pipeline-with-workspaces.yaml" in editor
And user clicks on create button in Edit Yaml file
Then user will be redirected to Pipeline Details page with header name "test-workspace-pipeline"
@smoke
Scenario: Create the pipeline with workspace from yaml view : P-12-TC01
Given user is at Edit Yaml page
When user fills the yaml editor with sample "s2i-build-and-deploy-pipeline-using-workspace"
# When user enters yaml content "pipeline-with-workspace.yaml" in editor
And user clicks on create button in Edit Yaml file
Then user will be redirected to Pipeline Details page with header name "s2i-build-and-deploy"


@regression, @manual
Scenario: Types of volume present in shared workspace : P-12-TC02
Given user created pipeline with workspace
When user clicks kebab menu for the pipeline "test-workspace-pipeline"
And user selects "Start" option from kebab menu for pipeline "test-workspace-pipeline"
And user selects shared workspaces drop down
Then user is able to see different shared workspaces like Empty Directory, Config Map, Secret, PVC
@regression
Scenario: Types of volume present in shared workspace : P-12-TC02
Given user created pipeline with workspace
And user is at pipelines page
When user selects "Start" option from kebab menu for pipeline "test-workspace-pipeline"
And user selects shared workspaces drop down
Then user is able to see different shared workspaces like Empty Directory, Config Map, Secret, PVC


@regression, @manual
Scenario: Start the pipeline with Empty workspace : P-12-TC03
Given user created pipeline with workspace
When user clicks kebab menu for the pipeline "test-workspace-pipeline"
And user selects "Start" option from kebab menu for pipeline "test-workspace-pipeline"
And user enters first param as "param-1"
And user selects volume type "Empty Directory" from shared workspaces dorp down
And user selects Start button
Then user will be redirected to Pipeline Run Details page
@regression
Scenario Outline: Start the pipeline with "<volume_tyoe>" : P-12-TC03
Given user created pipeline with workspace
When user selects "Start" option from kebab menu for pipeline "test-workspace-pipeline"
And user fills the Parameters in Start Pipeline modal
And user selects volume type "<volume_tyoe>" from workspaces dorp down
And user selects Start button
Then user will be redirected to Pipeline Run Details page

Examples:
| volume_tyoe |
| Empty Directory |

Scenario: Start the pipeline with ConfigMap : P-12-TC04
Given user created pipeline with workspace
And user created Config Map using yaml "pipeline-configMap.yaml"
When user clicks kebab menu for the pipeline "test-workspace-pipeline"
And user selects "Start" option from kebab menu for pipeline "test-workspace-pipeline"
And user enters first param as "param-1"
And user selects volume type "Config Map" from shared workspaces dorpdown
And user selects "sensitive-recipe-storage" from Config Map drop down
And user selects Start button
Then user will be redirected to Pipeline Run Details page

Scenario: Start the pipeline with ConfigMap : P-12-TC04
Given user created pipeline with workspace
And user created Config Map using yaml "pipeline-configMap.yaml"
When user selects "Start" option from kebab menu for pipeline "test-workspace-pipeline"
And user enters first param as "param-1"
And user selects volume type "Config Map" from workspaces dorpdown
And user selects "sensitive-recipe-storage" from Config Map drop down
And user selects Start button
Then user will be redirected to Pipeline Run Details page

Scenario: Start the pipeline with Secret : P-12-TC05
Given user created pipeline with workspace
And user created Secret using yaml "pipeline-secret.yaml"
When user clicks kebab menu for the pipeline "test-workspace-pipeline"
And user selects "Start" option from kebab menu for pipeline "test-workspace-pipeline"
And user enters first param as "param-1"
And user selects volume type "Secret" from shared workspaces dorpdown
And user selects "secret-password" from Secret drop down
And user selects Start button
Then user will be redirected to Pipeline Run Details page

Scenario: Start the pipeline with Secret : P-12-TC05
Given user created pipeline with workspace
And user created Secret using yaml "pipeline-secret.yaml"
When user selects "Start" option from kebab menu for pipeline "test-workspace-pipeline"
And user enters first param as "param-1"
And user selects volume type "Secret" from shared workspaces dorpdown
And user selects "secret-password" from Secret drop down
And user selects Start button
Then user will be redirected to Pipeline Run Details page

Scenario: Start the pipeline with PVC : P-12-TC06
Given user created pipeline with workspace
And user created Secret using yaml "pipeline-secret.yaml"
When user clicks kebab menu for the pipeline "test-workspace-pipeline"
And user selects "Start" option from kebab menu for pipeline "test-workspace-pipeline"
And user enters first param as "param-1"
And user selects volume type "PVC" from shared workspaces dorpdown
And user selects "shared-task-storage" from PVC drop down
And user selects Start button
Then user will be redirected to Pipeline Run Details page

Scenario: Start the pipeline with PVC : P-12-TC06
Given user created pipeline with workspace
And user created Secret using yaml "pipeline-secret.yaml"
When user selects "Start" option from kebab menu for pipeline "test-workspace-pipeline"
And user enters first param as "param-1"
And user selects volume type "PVC" from shared workspaces dorpdown
And user selects "shared-task-storage" from PVC drop down
And user selects Start button
Then user will be redirected to Pipeline Run Details page
Expand Up @@ -7,6 +7,8 @@ export const pipelineBuilderPO = {
create: '[data-test-id="submit-button"]',
cancel: '[data-test-id="reset-button"]',
add: 'button.pf-c-button.pf-m-link.pf-m-inline',
yamlView: '#form-radiobutton-editorType-yaml-field',
pipelineBuilderView: '#form-radiobutton-editorType-form-field',
addParams: {
name: '#form-input-formData-params-0-name-field',
description: '#form-input-formData-params-0-description-field',
Expand All @@ -24,8 +26,20 @@ export const pipelineBuilderPO = {
},
yamlCreatePipeline: {
helpText: 'p.help-block',
create: '[data-test="save-changes"]',
cancel: '#cancel',
create: '[data-test-id="submit-button"]',
cancel: '[data-test-id="reset-button"]',
yamlEditor: '[data-mode-id="yaml"]',
samples: {
s2iPipelineWithWorkspace:
'div.osc-yaml-editor__sidebar ol li:nth-child(3) > button:nth-child(3)',
dockerPipelineWithResource:
'div.osc-yaml-editor__sidebar ol li:nth-child(2) > button:nth-child(3)',
dockerBuildAndDeployPipeline:
'div.osc-yaml-editor__sidebar ol li:nth-child(1) > button:nth-child(3)',
simplePipeline: 'div.osc-yaml-editor__sidebar ol li:nth-child(4) > button:nth-child(3)',
s2iPipelineWithResource:
'div.osc-yaml-editor__sidebar ol li:nth-child(5) > button:nth-child(3)',
},
},
sidePane: {
dialog: 'div.odc-sidebar',
Expand Down
@@ -1,4 +1,4 @@
import { pipelineBuilderPO, pipelineDetailsPO } from '../../pageObjects/pipelines-po';
import { pipelineBuilderPO, pipelineDetailsPO, pipelinesPO } from '../../pageObjects/pipelines-po';
import { pipelineDetailsPage } from './pipelineDetails-page';

export const pipelineBuilderPage = {
Expand Down Expand Up @@ -63,10 +63,15 @@ export const pipelineBuilderPage = {
},
clickCreateButton: () => cy.get(pipelineBuilderPO.create).click(),
editYaml: () => {
cy.byButtonText('Edit YAML').click();
cy.get('form[name="form"]').should('be.visible');
cy.byTestID('confirm-action').click();
cy.get('[data-mode-id="yaml"]').should('be.visible');
cy.get(pipelinesPO.createPipeline).click();
cy.get(pipelineBuilderPO.yamlView).click();
},
enterYaml: (yamlContent: string) => {
cy.get(pipelineBuilderPO.yamlCreatePipeline.yamlEditor)
.click()
.focused()
.type('{ctrl}a')
.type(yamlContent);
},
createPipelineFromBuilderPage: (pipelineName: string, taskName: string = 'kn') => {
pipelineBuilderPage.enterPipelineName(pipelineName);
Expand Down Expand Up @@ -99,4 +104,25 @@ export const pipelineBuilderPage = {
pipelineBuilderPage.clickCreateButton();
pipelineDetailsPage.verifyTitle(pipelineName);
},
selectSampleInYamlView: (yamlSample: string) => {
switch (yamlSample) {
case 's2i-build-and-deploy-pipeline-using-workspace':
cy.get(pipelineBuilderPO.yamlCreatePipeline.samples.s2iPipelineWithWorkspace).click();
break;
case 'docker-build-and-deploy-pipeline-using-pipeline-resource':
cy.get(pipelineBuilderPO.yamlCreatePipeline.samples.dockerPipelineWithResource).click();
break;
case 'docker-build-and-deploy-pipeline':
cy.get(pipelineBuilderPO.yamlCreatePipeline.samples.dockerBuildAndDeployPipeline).click();
break;
case 'simple-pipeline':
cy.get(pipelineBuilderPO.yamlCreatePipeline.samples.simplePipeline).click();
break;
case 's2i-build-and-deploy-pipeline-using-pipeline-resource':
cy.get(pipelineBuilderPO.yamlCreatePipeline.samples.s2iPipelineWithResource).click();
break;
default:
break;
}
},
};
Expand Up @@ -215,4 +215,23 @@ export const startPipelineInPipelinesPage = {
.scrollIntoView()
.should('be.visible');
},
selectWorkSpace: (option: string) => {
cy.get(pipelinesPO.startPipeline.sharedWorkspace).click();
switch (option) {
case 'Empty Directory':
cy.byTestDropDownMenu('EmptyDirectory').click();
break;
case 'Config Map':
cy.byTestDropDownMenu('ConfigMap').click();
break;
case 'Secret':
cy.byTestDropDownMenu('Secret').click();
break;
case 'PVC':
cy.byTestDropDownMenu('PVC').click();
break;
default:
break;
}
},
};
@@ -0,0 +1,66 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
import { pipelineBuilderPage } from '../../pages/pipelines/pipelineBuilder-page';
import { pipelinesPO, pipelineBuilderPO } from '../../pageObjects/pipelines-po';
import { pipelineDetailsPage } from '../../pages/pipelines/pipelineDetails-page';
import { startPipelineInPipelinesPage } from '../../pages/pipelines/pipelines-page';

When('user enters yaml content {string} in editor', (pipelineYamlFile: string) => {
cy.fixture(`pipelines/pipelines-workspaces/${pipelineYamlFile}`).then((yaml) => {
cy.log(yaml);
pipelineBuilderPage.enterYaml(yaml);
});
});

When('user clicks on create button in Edit Yaml file', () => {
cy.get(pipelineBuilderPO.yamlCreatePipeline.create).click();
});

Given('user is at Edit Yaml page', () => {
pipelineBuilderPage.editYaml();
});

Given('user created pipeline with workspace', () => {
pipelineBuilderPage.editYaml();
pipelineBuilderPage.selectSampleInYamlView('s2i-build-and-deploy-pipeline-using-workspace');
// Instead of copy parseTwoDigitYear, we are using samples
// cy.fixture(`pipelines/pipelines-workspaces/pipeline-with-workspace.yaml`).then((yaml) => {
// cy.log(yaml);
// pipelineBuilderPage.enterYaml(yaml);
// });
cy.get(pipelineBuilderPO.yamlCreatePipeline.create).click();
});

Then(
'user is able to see different shared workspaces like Empty Directory, Config Map, Secret, PVC',
() => {
cy.byTestDropDownMenu('EmptyDirectory').should('be.visible');
cy.byTestDropDownMenu('ConfigMap').should('be.visible');
cy.byTestDropDownMenu('Secret').should('be.visible');
cy.byTestDropDownMenu('PVC').should('be.visible');
},
);

When('user selects shared workspaces drop down', () => {
cy.get(pipelinesPO.startPipeline.sharedWorkspace).click();
});

Then(
'user will be redirected to Pipeline Details page with header name {string}',
(pipelineName: string) => {
pipelineDetailsPage.verifyTitle(pipelineName);
},
);

When('user fills the yaml editor with sample {string}', (yamlSample: string) => {
pipelineBuilderPage.selectSampleInYamlView(yamlSample);
});

When('user fills the Parameters in Start Pipeline modal', () => {
cy.get('input[label="IMAGE_NAME"]').type('');
cy.get('input[label="GIT_REPO"]').type('');
cy.get('input[label="GIT_REVISION"]').type('');
});

When('user selects volume type {string} from workspaces dorp down', (volumeType: string) => {
startPipelineInPipelinesPage.selectWorkSpace(volumeType);
});
@@ -1,19 +1,59 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: test-workspace-pipeline
name: s2i-build-and-deploy
spec:
params:
- name: first-param
description: this is the first param for Pipeline
- name: IMAGE_NAME
type: string
- name: GIT_REPO
type: string
- name: GIT_REVISION
type: string
workspaces:
- name: shared-workspace
description: this is a shared workspace
- name: workspace
tasks:
- name: first-task
- name: fetch-repository
taskRef:
name: test-workspace-task
kind: Task
name: git-clone
kind: ClusterTask
workspaces:
- name: messages
workspace: shared-workspace
- name: output
workspace: workspace
params:
- name: url
value: $(params.GIT_REPO)
- name: revision
value: $(params.GIT_REVISION)
- name: subdirectory
value: ""
- name: deleteExisting
value: "true"

- name: build
taskRef:
name: s2i-java-8
kind: ClusterTask
runAfter:
- fetch-repository
workspaces:
- name: source
workspace: workspace
params:
- name: IMAGE
value: $(params.IMAGE_NAME)
- name: TLSVERIFY
value: "false"

- name: deploy
taskRef:
name: openshift-client
kind: ClusterTask
runAfter:
- build
params:
- name: ARGS
value:
- "new-app"
- "--docker-image"
- "$(params.IMAGE_NAME)"