Skip to content

Commit

Permalink
Add e2e test for the new timeout option in Start Pipeline modal
Browse files Browse the repository at this point in the history
  • Loading branch information
sanketpathak committed Aug 8, 2024
1 parent ef54e93 commit 99458c7
Show file tree
Hide file tree
Showing 12 changed files with 286 additions and 86 deletions.
11 changes: 4 additions & 7 deletions __mocks__/serverFlags.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
export declare interface window {
SERVER_FLAGS: {
basePath: '/',
consolePlugins: [],
};
windowError?: string;
}
window.SERVER_FLAGS = {
basePath: '/',
consolePlugins: [],
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,23 @@ Feature: Pipeline Runs
| pipeline-git-resource | openshift-client |


# To run the folowing test, Red Hat OpenShift Pipelines operator subscription to be updated to refer to main branch of console plugin until this feature is released in operator versioned 1.16.
# To change the subscription to main, follow the below steps
# Go to Installed operators and select Red Hat OpenShift Pipelines operator
# Click on Edit subscription in Actions dropdown
# Add below lines under spec and Save
# config:
# env:
# - name: IMAGE_PIPELINES_CONSOLE_PLUGIN
# value: 'ghcr.io/openshift-pipelines/console-plugin:main'
# After the change remove the broken-test label and run the test
@smoke
Scenario Outline: Start the pipeline with one resource: P-07-TC02
Given pipeline "<pipeline_name>" consists of task "<task_name>" with one git resource
And user is at pipelines page
When user selects "Start" option from kebab menu for pipeline "<pipeline_name>"
And user enters git url as "https://github.com/sclorg/nodejs-ex.git" in start pipeline modal
And user enters timeout value as "1" and "Hr"
And user clicks Start button in start pipeline modal
Then user will be redirected to Pipeline Run Details page
And user is able to see the pipelineRuns with status as Running
Expand All @@ -44,7 +55,7 @@ Feature: Pipeline Runs
When user clicks Last Run value of "<pipeline_name>"
Then user will be redirected to Pipeline Run Details page
And user is able to see Details, YAML, TaskRuns, Parameters, Logs, Events and Output tabs
And Details tab is displayed with field names Name, Namespace, Labels, Annotations, Created At, Owner, Status, Pipeline and Triggered by
And Details tab is displayed with field names Name, Namespace, Labels, Annotations, Created At, Owner, Status and Pipeline
And Actions dropdown display on the top right corner of the page

Examples:
Expand All @@ -57,7 +68,7 @@ Feature: Pipeline Runs
Given pipeline run is displayed for "pipeline-rerun-0" without resource
And user is at the Pipeline Run Details page of pipeline "pipeline-rerun-0"
When user clicks Actions menu on the top right corner of the page
Then Actions menu display with the options "Rerun", "Delete PipelineRun"
Then Actions menu display with the options "rerun", "delete" PipelineRun


@regression
Expand Down Expand Up @@ -375,22 +386,23 @@ Feature: Pipeline Runs
And user is at the Pipeline Details page of pipeline "pipeline-stop"
When user starts the pipeline "pipeline-stop" in Pipeline Details page
And user selects option "Stop" from Actions menu drop down
Then status displays as "Cancelled" in pipeline run details page
Then status displays as "Cancelling" in pipeline run details page

@regression
Marking following tests as manual to recheck them again. Not working with the present scenario
@regression @manual
Scenario: SBOM information on the pipelineRun detail page: P-07-TC38
Given user has created a pipelineRun with sbom task "pipelinerun-with-sbom-link"
When user navigates to PipelineRun Details page "pipelinerun-with-sbom-link"
Then user can see Download SBOM and View SBOM section in PipelineRun details page


@regression
@regression @manual
Scenario: Output of the pipelinerun: P-07-TC39
Given user has created a pipelineRun with sbom task "pipelinerun-with-sbom-link"
When user navigates to output tab of pipelineRun details page "pipelinerun-with-sbom-link"
Then user can see the results in the output tab

@regression
@regression @manual
Scenario: CVE information in the pipelinerun list and details page: P-07-TC40
Given user has created a PipelineRun with scan task "pipelinerun-with-scan-task"
When user navigates to PipelineRun list page
Expand All @@ -399,7 +411,7 @@ Feature: Pipeline Runs
And user can see the vulnerabilities section in the details page "pipelinerun-with-scan-task"


@regression
@regression @manual
Scenario: View SBOM link in the pipelinerun list kebab action: P-07-TC41
Given user has created a pipelineRun with sbom task "pipelinerun-with-sbom-link"
When user navigates to PipelineRun list page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export const pipelinesPO = {
table: 'div[role="grid"]',
pipelineName: 'tr td:nth-child(1)',
pipelineRunName: 'tr td:nth-child(2)',
kebabMenu: '[data-test-id="kebab-button"]',
kebabMenu: '[data-test="kebab-button"]',
columnValues: '[aria-label="Pipelines"] tbody tr td',
columnNames: 'div[aria-label="Pipelines"] thead tr th',
pipelineRunIcon: '[title="PipelineRun"]',
Expand All @@ -302,7 +302,7 @@ export const pipelinesPO = {
remove: '#confirm-action',
},
startPipeline: {
sectionTitle: 'h2.odc-form-section__heading',
sectionTitle: '[class*="form__section-title"]',
gitResourceDropdown: '[for="form-input-parameters-1-value-field"]', // '[id*="dropdown-resources-0"]',
gitUrl: '#form-input-parameters-1-value-field',
revision: '#form-input-parameters-2-value-field',
Expand Down
1 change: 0 additions & 1 deletion integration-tests/cypress/support/pages/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const app = {
cy.get('.co-m-loader', { timeout }).should('not.exist');
}
});
cy.get('[class*="spinner"]', { timeout }).should('not.exist');
cy.get('.skeleton-catalog--grid', { timeout }).should('not.exist');
cy.get('.loading-skeleton--table', { timeout }).should('not.exist');
cy.byTestID('skeleton-detail-view', { timeout }).should('not.exist');
Expand Down
62 changes: 58 additions & 4 deletions integration-tests/cypress/support/pages/functions/common.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,67 @@
import { guidedTour } from '../../../../../tests/views/guided-tour';
import { globalPO } from '../../page-objects/global-po';
import { app } from '../app';

export const actionsDropdownMenu = {
verifyActionsMenu: () => cy.get(globalPO.actionsMenu).should('be.visible'),
clickActionMenu: () => cy.get(globalPO.actionsMenu).click(),
verifyActionsMenu: () =>
cy.get('button[class*=-menu-toggle]').should('be.visible'),
clickActionMenu: () =>
cy.get('button[class*=-menu-toggle]').contains('Actions').click(),
selectAction: (action: string) => {
actionsDropdownMenu.clickActionMenu();
cy.byTestActionID(action).click();
cy.get('ul[role="menu"]').should('be.visible');
switch (action) {
case 'Start': {
cy.get('[data-test="start-pipeline"] button[role="menuitem"]')
.should('be.visible')
.click({ force: true });
break;
}
case 'Start last run': {
cy.get('[data-test="start-last-run"] button[role="menuitem"]')
.should('be.visible')
.click({ force: true });
break;
}
case 'Add Trigger': {
cy.get('[data-test="add-trigger"] button[role="menuitem"]')
.should('be.visible')
.click({ force: true });
break;
}
case 'Remove Trigger': {
cy.get('[data-test="remove-trigger"] button[role="menuitem"]')
.should('be.visible')
.click({ force: true });
break;
}
case 'Edit labels': {
cy.get('[data-test="edit-labels"] button[role="menuitem"]')
.should('be.visible')
.click({ force: true });
break;
}
case 'Edit annotations': {
cy.get('[data-test="edit-annotations"] button[role="menuitem"]')
.should('be.visible')
.click({ force: true });
break;
}
case 'Edit Pipeline': {
cy.get('[data-test="edit"] button[role="menuitem"]')
.should('be.visible')
.click({ force: true });
break;
}
case 'Delete Pipeline': {
cy.get('[data-test="delete"] button[role="menuitem"]')
.should('be.visible')
.click({ force: true });
break;
}
default: {
throw new Error('action is not available');
}
}
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const waitForPipelineTasks = (retries = 30) => {
});
};

export const waitForDynamicPlugin = (retries: number = 5) => {
export const waitForDynamicPlugin = () => {
operatorsPage.navigateToInstallOperatorsPage();
operatorsPage.verifyInstalledOperator(operators.PipelinesOperator);
cy.get('[data-test-operator-row="Red Hat OpenShift Pipelines"]')
Expand Down
4 changes: 4 additions & 0 deletions integration-tests/cypress/support/pages/git-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ export const gitPage = {
/* eslint-disable-next-line cypress/unsafe-to-chain-command */
cy.get(gitPO.pipeline.buildDropdown).scrollIntoView().click();
cy.get(gitPO.pipeline.addPipeline).should('be.visible').click();
cy.get(gitPO.pipeline.buildDropdown).should(
'contain.text',
'Build using pipelines',
);
},
clickCreate: () =>
/* eslint-disable-next-line cypress/unsafe-to-chain-command */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { detailsPage } from '../../../../../tests/views/details-page';
import { modal } from '../../../../../tests/views/modal';
import { pipelineActions } from '../../constants';
import { pageTitle } from '../../constants/pageTitle';
import {
pipelineDetailsPO,
Expand Down Expand Up @@ -58,15 +57,31 @@ export const pipelineRunDetailsPage = {
actionsDropdownMenu.clickActionMenu();
switch (action) {
case 'Rerun': {
cy.byTestActionID(pipelineActions.Rerun).click();
cy.get(
'[data-test="rerun-pipelineRun"] button[role="menuitem"]',
).click();
cy.get(pipelineRunDetailsPO.details.sectionTitle).should('be.visible');
break;
}
case 'Delete Pipeline Run': {
cy.byTestActionID(pipelineActions.DeletePipelineRun).click();
cy.get(
'[data-test="delete-pipelineRun"] button[role="menuitem"]',
).click();
modal.modalTitleShouldContain('Delete Pipeline?');
break;
}
case 'Cancel': {
cy.get('[data-test="cancel-pipelineRun"] button[role="menuitem"]')
.should('be.visible')
.click({ force: true });
break;
}
case 'Stop': {
cy.get('[data-test="stop-pipelineRun"] button[role="menuitem"]')
.should('be.visible')
.click({ force: true });
break;
}
default: {
throw new Error(`${action} is not available in dropdown menu`);
}
Expand Down Expand Up @@ -99,7 +114,7 @@ export const pipelineRunDetailsPage = {
cy.get('.odc-pipeline-run-details__customDetails').within(() => {
cy.contains('dl dt', 'Status').should('be.visible');
cy.contains('dl dt', 'Pipeline').should('be.visible');
cy.contains('dl dt', 'Triggered by:').should('be.visible');
// cy.contains('dl dt', 'Triggered by:').should('be.visible');
});
},
verifyDetailsFields: () => {
Expand Down Expand Up @@ -201,7 +216,7 @@ export const pipelineRunsPage = {
cy.get('tbody tr')
.eq(index)
.within(() => {
cy.get(`button[data-test-id="kebab-button"]`)
cy.get(`button[data-test="kebab-button"]`)
.should('be.visible')
.click({ force: true });
});
Expand Down
Loading

0 comments on commit 99458c7

Please sign in to comment.