Skip to content

ODC-7674: Configure CI and enable create-from-add-options.feature test file #172

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

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions integration-tests/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ async function setupNodeEvents(
rules: [
{
test: /\.tsx?$/,
type: 'javascript/auto',
use: [
{
loader: 'ts-loader',
Expand All @@ -37,6 +38,16 @@ async function setupNodeEvents(
},
],
},
{
test: /node_modules\/yaml\/browser\/dist\/.*/,
type: 'javascript/auto',
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
},
],
},
},
Expand Down Expand Up @@ -80,8 +91,8 @@ export default defineConfig({
pageLoadTimeout: 90000,
requestTimeout: 15000,
responseTimeout: 15000,
screenshotsFolder: './screenshots',
videosFolder: './videos',
screenshotsFolder: './gui_test_screenshots/cypress/screenshots',
videosFolder: './gui_test_screenshots/cypress/videos',
video: true,
reporter: '../node_modules/cypress-multi-reporters',
reporterOptions: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Feature: Create Pipeline from Add Options
| nodejs-top |


@smoke
@smoke @broken-test
Scenario Outline: Search the created pipeline from Add options in pipelines page: P-01-TC05
Given user created workload "<name>" from add page with pipeline
And user is at pipelines page
Expand Down
10 changes: 7 additions & 3 deletions integration-tests/cypress/support/commands/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { checkErrors } from '../../../../tests/support/index';
import { verifyAndInstallPipelinesOperator } from '../pages/functions/installOperatorOnCluster';
import { checkDeveloperPerspective } from '../../../../tests/views/checkDeveloperPerspective';
// import { verifyAndInstallPipelinesOperator } from '../pages/functions/installOperatorOnCluster';
import { installPipelinesOperatorUsingCLI } from '../pages/functions/installOperatorOnClusterUsingCLI';

before(() => {
cy.login();
cy.document().its('readyState').should('eq', 'complete');
verifyAndInstallPipelinesOperator();
// verifyAndInstallPipelinesOperator();
installPipelinesOperatorUsingCLI();
checkDeveloperPerspective();
});

after(() => {
const namespaces: string[] = Cypress.env('NAMESPACE') || [];
cy.log(`Deleting "${namespaces}" namespace`);
cy.exec(`oc delete namespace ${namespaces}`, {
failOnNonZeroExit: false,
timeout: 180000,
timeout: 200000,
});
});

Expand Down
30 changes: 30 additions & 0 deletions integration-tests/cypress/support/constants/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,33 @@ export enum nodeActions {
EditDeploymentConfig = 'Edit DeploymentConfig',
EditResourceLimits = 'Edit resource limits',
}

export enum operatorNamespaces {
PipelinesOperator = 'openshift-operators',
ServerlessOperator = 'openshift-serverless',
ShipwrightOperator = 'openshift-operators',
BuildsForOpenshiftOperator = 'openshift-operators',
WebTerminalOperator = 'openshift-operators',
RedHatIntegrationCamelK = 'openshift-operators',
DevWorkspaceOperator = 'openshift-operators',
}

export enum operatorSubscriptions {
PipelinesOperator = 'openshift-pipelines-operator',
ServerlessOperator = 'serverless-operator',
ShipwrightOperator = 'shipwright-operator',
BuildsForOpenshiftOperator = 'openshift-builds-operator',
WebTerminalOperator = 'web-terminal',
RedHatIntegrationCamelK = 'red-hat-camel-k',
DevWorkspaceOperator = 'devworkspace-operator',
}

export enum operatorPackage {
PipelinesOperator = 'openshift-pipelines-operator-rh',
ServerlessOperator = 'serverless-operator',
ShipwrightOperator = 'shipwright-operator',
BuildsForOpenshiftOperator = 'openshift-builds-operator',
WebTerminalOperator = 'web-terminal',
RedHatIntegrationCamelK = 'red-hat-camel-k',
DevWorkspaceOperator = 'devworkspace-operator',
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const catalogPO = {
builderImage: '[data-test="tab BuilderImage"]',
},
cards: {
nodeJsBuilderImage: 'a[data-test="BuilderImage-Node.js"]',
nodeJsBuilderImage: '[data-test="BuilderImage-Node.js"]',
},
sidePane: {
dialog: '[role="dialog"]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const globalPO = {
addNavigation: '[data-test-id="+Add-header"]',
topologyNavigation: '[data-test-id="topology-header"]',
topologySwitcher: 'button[data-test-id="topology-switcher-view"]',
userMenu: '[data-test="user-dropdown"]',
userMenu: '[data-test^="user-dropdown"]',
save: '[data-test="save-changes"]',
errorAlert: '[aria-label="Danger Alert"]',
successAlert: '[aria-label="Success Alert"]',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const operatorsPO = {
},
installOperators: {
title: 'h1.co-m-pane__heading',
noOperatorsFound: '[data-test="msg-box-title"]',
noOperatorsFound: '[data-test="console-empty-state"]',
noOperatorsDetails: '[data-test="msg-box-detail"]',
search: 'input[data-test-id="item-filter"]',
noOperatorFoundMessage: 'div.cos-status-box__title',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ export const pipelinesPO = {
pipelinesTab: '[data-test-id="horizontal-link-Pipelines"]',
repositoriesTab: '[data-test-id="horizontal-link-Repositories"]',
pipelinesTable: {
table: 'div[role="grid"]',
table: 'table[role="grid"]',
pipelineName: 'tr td:nth-child(1)',
pipelineRunName: 'tr td:nth-child(2)',
kebabMenu: '[data-test="kebab-button"]',
kebabMenu: '[data-test-id="kebab-button"]',
columnValues: '[aria-label="Pipelines"] tbody tr td',
columnNames: 'div[aria-label="Pipelines"] thead tr th',
pipelineRunIcon: '[title="PipelineRun"]',
Expand Down
1 change: 1 addition & 0 deletions integration-tests/cypress/support/pages/add-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const addPage = {
cy.testA11y('Import from Git Page');
detailsPage.titleShouldContain(pageTitle.Git);
break;
case 'Software Catalog':
case 'Developer Catalog':
case 'From Catalog':
case addOptions.DeveloperCatalog:
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/cypress/support/pages/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ export const kebabMenu = {
.type(name);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000);
cy.get('div[role="grid"]').should('be.visible');
cy.get('div[role="grid"]').within(() => {
cy.get('table[role="grid"]').contains('Pipeline').should('be.visible');
cy.get('[data-test-rows="resource-row"]').within(() => {
cy.get('tr td:nth-child(1)').each(($el, index) => {
if ($el.text().includes(name)) {
cy.get('tbody tr')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const checkOperatorvailabilityStatus = (operatorName: string) => {
cy.exec(`source ./cypress/testData/krew-install.sh ${operatorName}`, {
failOnNonZeroExit: false,
}).then(function (result) {
cy.log(`Operator availability check :`);
cy.log(result.stdout || result.stderr);
if (result.stdout.includes(`"${operatorName}" not found`)) {
throw new Error(
`Failed to install ${operatorName} Operator - Operator not available.`,
);
}
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
import { operatorNamespaces, operatorSubscriptions } from '../../constants';
import {
createKnativeEventingUsingCLI,
createKnativeKafkaUsingCLI,
createKnativeServingUsingCLI,
} from './knativeSubscriptions';

// export const checkRedHatIntegrationCamelKOperatorStatus = (retries: number = 5) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we remove the commented out part in all places?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// const namespace = operatorNamespaces.RedHatIntegrationCamelK;
// const resourceName = 'camel-k-operator';
// if (retries === 0) {
// throw new Error('Failed to install Red Hat Camel K Operator - Pod timeout');
// } else {
// cy.exec(
// `oc wait --for=condition=ready pod -l name=${resourceName} -n ${namespace} --timeout=300s`,
// {
// failOnNonZeroExit: false,
// },
// ).then(function (result) {
// if (result.stdout.includes('condition met')) {
// cy.log(`Success: ${result.stdout}`);
// } else {
// cy.log(result.stderr);
// cy.wait(30000);
// checkRedHatIntegrationCamelKOperatorStatus(retries - 1);
// }
// });
// }
// };

// export const checkWebterminalOperatorStatus = (retries: number = 5) => {
// const namespace = operatorNamespaces.WebTerminalOperator;
// const resourceName = 'web-terminal-controller';
// if (retries === 0) {
// throw new Error('Failed to install Webterminal Operator - Pod timeout');
// } else {
// cy.exec(
// `oc wait --for=condition=ready pod -l app.kubernetes.io/name=${resourceName} -n ${namespace} --timeout=300s`,
// {
// failOnNonZeroExit: false,
// },
// ).then(function (result) {
// if (result.stdout.includes('condition met')) {
// cy.log(`Success: ${result.stdout}`);
// } else {
// cy.log(result.stderr);
// cy.wait(30000);
// checkWebterminalOperatorStatus(retries - 1);
// }
// });
// }
// };

// export const checkDevWorkspaceOperatorStatus = (retries: number = 5) => {
// const namespace = operatorNamespaces.DevWorkspaceOperator;
// const controllerResourceName = 'devworkspace-controller';
// const serverResourceName = 'devworkspace-webhook-server';

// if (retries === 0) {
// throw new Error('Failed to install devworkspace operator - Pod timeout');
// } else {
// cy.exec(
// `oc wait --for=condition=ready pod -l app.kubernetes.io/name=${controllerResourceName} -n ${namespace} --timeout=300s`,
// {
// failOnNonZeroExit: false,
// },
// ).then(function (result) {
// if (result.stdout.includes('condition met')) {
// cy.log(`Success: ${result.stdout}`);
// } else {
// cy.log(result.stderr);
// cy.wait(30000);
// checkDevWorkspaceOperatorStatus(retries - 1);
// }
// });
// cy.exec(
// `oc wait --for=condition=ready pod -l app.kubernetes.io/name=${serverResourceName} -n ${namespace} --timeout=300s`,
// {
// failOnNonZeroExit: false,
// },
// ).then(function (result) {
// if (result.stdout.includes('condition met')) {
// cy.log(`Success: ${result.stdout}`);
// } else {
// cy.log(result.stderr);
// cy.wait(30000);
// checkDevWorkspaceOperatorStatus(retries - 1);
// }
// });
// }
// };

// export const checkShipwrightOperatorStatus = (retries: number = 5) => {
// const namespace = operatorNamespaces.ShipwrightOperator;
// const resourceName = operatorSubscriptions.ShipwrightOperator;
// if (retries === 0) {
// throw new Error('Failed to install Shipwright Operator - Pod timeout');
// } else {
// cy.exec(
// `oc wait --for=condition=ready pod -l app=${resourceName} -n ${namespace} --timeout=300s`,
// {
// failOnNonZeroExit: false,
// },
// ).then(function (result) {
// if (result.stdout.includes('condition met')) {
// cy.log(`Success: ${result.stdout}`);
// } else {
// cy.log(result.stderr);
// cy.wait(30000);
// checkShipwrightOperatorStatus(retries - 1);
// }
// });
// }
// };

// export const checkBuildsForOpenshiftOperatorStatus = (retries: number = 5) => {
// const namespace = operatorNamespaces.BuildsForOpenshiftOperator;
// const resourceName = operatorSubscriptions.BuildsForOpenshiftOperator;
// if (retries === 0) {
// throw new Error('Failed to install Builds for Openshift Operator - Pod timeout');
// } else {
// cy.exec(
// `oc wait --for=condition=ready pod -l app=${resourceName} -n ${namespace} --timeout=300s`,
// {
// failOnNonZeroExit: false,
// },
// ).then(function (result) {
// if (result.stdout.includes('condition met')) {
// cy.log(`Success: ${result.stdout}`);
// } else {
// cy.log(result.stderr);
// cy.wait(30000);
// checkBuildsForOpenshiftOperatorStatus(retries - 1);
// }
// });
// }
// };

export const checkPipelineOperatorStatus = (retries = 5) => {
const namespace = operatorNamespaces.PipelinesOperator;
const resourceName = operatorSubscriptions.PipelinesOperator;
if (retries === 0) {
throw new Error('Failed to install Pipelines Operator - Pod timeout');
} else {
cy.exec(
`oc wait --for=condition=ready pod -l app=${resourceName} -n ${namespace} --timeout=300s`,
{
failOnNonZeroExit: false,
},
).then(function (result) {
if (result.stdout.includes('condition met')) {
cy.log(`Success: ${result.stdout}`);
} else {
cy.log(result.stderr);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(30000);
checkPipelineOperatorStatus(retries - 1);
}
});
}
};

export const checkKnativeOperatorStatus = () => {
const checkInstanceStatus = (
resourceName: string,
instanceName: string,
namespace: string,
) => {
cy.exec(
`oc wait ${resourceName} --for=condition=Ready --timeout=2m -n ${namespace} ${instanceName}`,
{
failOnNonZeroExit: false,
},
).then(function (result) {
if (result.stdout.includes('condition met')) {
cy.log(result.stdout);
} else if (resourceName === 'KnativeServing') {
createKnativeServingUsingCLI();
} else if (resourceName === 'KnativeEventing') {
createKnativeEventingUsingCLI();
} else if (resourceName === 'KnativeKafka') {
createKnativeKafkaUsingCLI();
}
});
};
const checkKnativeServingStatus = () => {
const namespace = 'knative-serving';
const instanceName = 'knative-serving';
const resourceName = 'KnativeServing';
checkInstanceStatus(resourceName, instanceName, namespace);
};

const checkKnativeEventingStatus = () => {
const namespace = 'knative-eventing';
const instanceName = 'knative-eventing';
const resourceName = 'KnativeEventing';
checkInstanceStatus(resourceName, instanceName, namespace);
};

const checkKnativeKafkaStatus = () => {
const namespace = 'knative-eventing';
const instanceName = 'knative-kafka';
const resourceName = 'KnativeKafka';
checkInstanceStatus(resourceName, instanceName, namespace);
};

checkKnativeServingStatus();
checkKnativeEventingStatus();
checkKnativeKafkaStatus();
};
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const tableFunctions = {
},

selectKebabMenu: (name: string) => {
cy.get('div[role="grid"]').within(() => {
cy.get('[data-test-rows="resource-row"]').within(() => {
cy.get('tr td:nth-child(1)').each(($el, index) => {
if ($el.text().includes(name)) {
cy.get('tbody tr')
Expand Down
Loading