Skip to content

Commit a2ba45e

Browse files
author
Sanket Pathak
committed
Configure CI and enable create-from-add-options.feature test file
1 parent a63741b commit a2ba45e

37 files changed

+746
-59
lines changed

integration-tests/cypress.config.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ async function setupNodeEvents(
2222
rules: [
2323
{
2424
test: /\.tsx?$/,
25+
type: 'javascript/auto',
2526
use: [
2627
{
2728
loader: 'ts-loader',
@@ -37,6 +38,16 @@ async function setupNodeEvents(
3738
},
3839
],
3940
},
41+
{
42+
test: /node_modules\/yaml\/browser\/dist\/.*/,
43+
type: 'javascript/auto',
44+
use: {
45+
loader: 'babel-loader',
46+
options: {
47+
presets: ['@babel/preset-env'],
48+
},
49+
},
50+
},
4051
],
4152
},
4253
},
@@ -80,8 +91,8 @@ export default defineConfig({
8091
pageLoadTimeout: 90000,
8192
requestTimeout: 15000,
8293
responseTimeout: 15000,
83-
screenshotsFolder: './screenshots',
84-
videosFolder: './videos',
94+
screenshotsFolder: './gui_test_screenshots/cypress/screenshots',
95+
videosFolder: './gui_test_screenshots/cypress/videos',
8596
video: true,
8697
reporter: '../node_modules/cypress-multi-reporters',
8798
reporterOptions: {

integration-tests/cypress/features/pipelines/create-from-add-options.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Feature: Create Pipeline from Add Options
6161
| nodejs-top |
6262

6363

64-
@smoke
64+
@smoke @broken-test
6565
Scenario Outline: Search the created pipeline from Add options in pipelines page: P-01-TC05
6666
Given user created workload "<name>" from add page with pipeline
6767
And user is at pipelines page

integration-tests/cypress/support/commands/hooks.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
import { checkErrors } from '../../../../tests/support/index';
2-
import { verifyAndInstallPipelinesOperator } from '../pages/functions/installOperatorOnCluster';
2+
import { checkDeveloperPerspective } from '../../../../tests/views/checkDeveloperPerspective';
3+
// import { verifyAndInstallPipelinesOperator } from '../pages/functions/installOperatorOnCluster';
4+
import { installPipelinesOperatorUsingCLI } from '../pages/functions/installOperatorOnClusterUsingCLI';
35

46
before(() => {
57
cy.login();
68
cy.document().its('readyState').should('eq', 'complete');
7-
verifyAndInstallPipelinesOperator();
9+
// verifyAndInstallPipelinesOperator();
10+
installPipelinesOperatorUsingCLI();
11+
checkDeveloperPerspective();
812
});
913

1014
after(() => {
1115
const namespaces: string[] = Cypress.env('NAMESPACE') || [];
1216
cy.log(`Deleting "${namespaces}" namespace`);
1317
cy.exec(`oc delete namespace ${namespaces}`, {
1418
failOnNonZeroExit: false,
15-
timeout: 180000,
19+
timeout: 200000,
1620
});
1721
});
1822

integration-tests/cypress/support/constants/global.ts

+30
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,33 @@ export enum nodeActions {
6262
EditDeploymentConfig = 'Edit DeploymentConfig',
6363
EditResourceLimits = 'Edit resource limits',
6464
}
65+
66+
export enum operatorNamespaces {
67+
PipelinesOperator = 'openshift-operators',
68+
ServerlessOperator = 'openshift-serverless',
69+
ShipwrightOperator = 'openshift-operators',
70+
BuildsForOpenshiftOperator = 'openshift-operators',
71+
WebTerminalOperator = 'openshift-operators',
72+
RedHatIntegrationCamelK = 'openshift-operators',
73+
DevWorkspaceOperator = 'openshift-operators',
74+
}
75+
76+
export enum operatorSubscriptions {
77+
PipelinesOperator = 'openshift-pipelines-operator',
78+
ServerlessOperator = 'serverless-operator',
79+
ShipwrightOperator = 'shipwright-operator',
80+
BuildsForOpenshiftOperator = 'openshift-builds-operator',
81+
WebTerminalOperator = 'web-terminal',
82+
RedHatIntegrationCamelK = 'red-hat-camel-k',
83+
DevWorkspaceOperator = 'devworkspace-operator',
84+
}
85+
86+
export enum operatorPackage {
87+
PipelinesOperator = 'openshift-pipelines-operator-rh',
88+
ServerlessOperator = 'serverless-operator',
89+
ShipwrightOperator = 'shipwright-operator',
90+
BuildsForOpenshiftOperator = 'openshift-builds-operator',
91+
WebTerminalOperator = 'web-terminal',
92+
RedHatIntegrationCamelK = 'red-hat-camel-k',
93+
DevWorkspaceOperator = 'devworkspace-operator',
94+
}

integration-tests/cypress/support/page-objects/add-flow-po.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const catalogPO = {
3535
builderImage: '[data-test="tab BuilderImage"]',
3636
},
3737
cards: {
38-
nodeJsBuilderImage: 'a[data-test="BuilderImage-Node.js"]',
38+
nodeJsBuilderImage: '[data-test="BuilderImage-Node.js"]',
3939
},
4040
sidePane: {
4141
dialog: '[role="dialog"]',

integration-tests/cypress/support/page-objects/global-po.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const globalPO = {
33
addNavigation: '[data-test-id="+Add-header"]',
44
topologyNavigation: '[data-test-id="topology-header"]',
55
topologySwitcher: 'button[data-test-id="topology-switcher-view"]',
6-
userMenu: '[data-test="user-dropdown"]',
6+
userMenu: '[data-test^="user-dropdown"]',
77
save: '[data-test="save-changes"]',
88
errorAlert: '[aria-label="Danger Alert"]',
99
successAlert: '[aria-label="Success Alert"]',

integration-tests/cypress/support/page-objects/operators-po.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const operatorsPO = {
2828
},
2929
installOperators: {
3030
title: 'h1.co-m-pane__heading',
31-
noOperatorsFound: '[data-test="msg-box-title"]',
31+
noOperatorsFound: '[data-test="console-empty-state"]',
3232
noOperatorsDetails: '[data-test="msg-box-detail"]',
3333
search: 'input[data-test-id="item-filter"]',
3434
noOperatorFoundMessage: 'div.cos-status-box__title',

integration-tests/cypress/support/page-objects/pipelines-po.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,10 @@ export const pipelinesPO = {
276276
pipelinesTab: '[data-test-id="horizontal-link-Pipelines"]',
277277
repositoriesTab: '[data-test-id="horizontal-link-Repositories"]',
278278
pipelinesTable: {
279-
table: 'div[role="grid"]',
279+
table: 'table[role="grid"]',
280280
pipelineName: 'tr td:nth-child(1)',
281281
pipelineRunName: 'tr td:nth-child(2)',
282-
kebabMenu: '[data-test="kebab-button"]',
282+
kebabMenu: '[data-test-id="kebab-button"]',
283283
columnValues: '[aria-label="Pipelines"] tbody tr td',
284284
columnNames: 'div[aria-label="Pipelines"] thead tr th',
285285
pipelineRunIcon: '[title="PipelineRun"]',

integration-tests/cypress/support/pages/add-page.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const addPage = {
1515
cy.testA11y('Import from Git Page');
1616
detailsPage.titleShouldContain(pageTitle.Git);
1717
break;
18+
case 'Software Catalog':
1819
case 'Developer Catalog':
1920
case 'From Catalog':
2021
case addOptions.DeveloperCatalog:

integration-tests/cypress/support/pages/app.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ export const kebabMenu = {
354354
.type(name);
355355
// eslint-disable-next-line cypress/no-unnecessary-waiting
356356
cy.wait(3000);
357-
cy.get('div[role="grid"]').should('be.visible');
358-
cy.get('div[role="grid"]').within(() => {
357+
cy.get('table[role="grid"]').contains('Pipeline').should('be.visible');
358+
cy.get('[data-test-rows="resource-row"]').within(() => {
359359
cy.get('tr td:nth-child(1)').each(($el, index) => {
360360
if ($el.text().includes(name)) {
361361
cy.get('tbody tr')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export const checkOperatorvailabilityStatus = (operatorName: string) => {
2+
cy.exec(`source ./cypress/testData/krew-install.sh ${operatorName}`, {
3+
failOnNonZeroExit: false,
4+
}).then(function (result) {
5+
cy.log(`Operator availability check :`);
6+
cy.log(result.stdout || result.stderr);
7+
if (result.stdout.includes(`"${operatorName}" not found`)) {
8+
throw new Error(
9+
`Failed to install ${operatorName} Operator - Operator not available.`,
10+
);
11+
}
12+
});
13+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
import { operatorNamespaces, operatorSubscriptions } from '../../constants';
2+
import {
3+
createKnativeEventingUsingCLI,
4+
createKnativeKafkaUsingCLI,
5+
createKnativeServingUsingCLI,
6+
} from './knativeSubscriptions';
7+
8+
// export const checkRedHatIntegrationCamelKOperatorStatus = (retries: number = 5) => {
9+
// const namespace = operatorNamespaces.RedHatIntegrationCamelK;
10+
// const resourceName = 'camel-k-operator';
11+
// if (retries === 0) {
12+
// throw new Error('Failed to install Red Hat Camel K Operator - Pod timeout');
13+
// } else {
14+
// cy.exec(
15+
// `oc wait --for=condition=ready pod -l name=${resourceName} -n ${namespace} --timeout=300s`,
16+
// {
17+
// failOnNonZeroExit: false,
18+
// },
19+
// ).then(function (result) {
20+
// if (result.stdout.includes('condition met')) {
21+
// cy.log(`Success: ${result.stdout}`);
22+
// } else {
23+
// cy.log(result.stderr);
24+
// cy.wait(30000);
25+
// checkRedHatIntegrationCamelKOperatorStatus(retries - 1);
26+
// }
27+
// });
28+
// }
29+
// };
30+
31+
// export const checkWebterminalOperatorStatus = (retries: number = 5) => {
32+
// const namespace = operatorNamespaces.WebTerminalOperator;
33+
// const resourceName = 'web-terminal-controller';
34+
// if (retries === 0) {
35+
// throw new Error('Failed to install Webterminal Operator - Pod timeout');
36+
// } else {
37+
// cy.exec(
38+
// `oc wait --for=condition=ready pod -l app.kubernetes.io/name=${resourceName} -n ${namespace} --timeout=300s`,
39+
// {
40+
// failOnNonZeroExit: false,
41+
// },
42+
// ).then(function (result) {
43+
// if (result.stdout.includes('condition met')) {
44+
// cy.log(`Success: ${result.stdout}`);
45+
// } else {
46+
// cy.log(result.stderr);
47+
// cy.wait(30000);
48+
// checkWebterminalOperatorStatus(retries - 1);
49+
// }
50+
// });
51+
// }
52+
// };
53+
54+
// export const checkDevWorkspaceOperatorStatus = (retries: number = 5) => {
55+
// const namespace = operatorNamespaces.DevWorkspaceOperator;
56+
// const controllerResourceName = 'devworkspace-controller';
57+
// const serverResourceName = 'devworkspace-webhook-server';
58+
59+
// if (retries === 0) {
60+
// throw new Error('Failed to install devworkspace operator - Pod timeout');
61+
// } else {
62+
// cy.exec(
63+
// `oc wait --for=condition=ready pod -l app.kubernetes.io/name=${controllerResourceName} -n ${namespace} --timeout=300s`,
64+
// {
65+
// failOnNonZeroExit: false,
66+
// },
67+
// ).then(function (result) {
68+
// if (result.stdout.includes('condition met')) {
69+
// cy.log(`Success: ${result.stdout}`);
70+
// } else {
71+
// cy.log(result.stderr);
72+
// cy.wait(30000);
73+
// checkDevWorkspaceOperatorStatus(retries - 1);
74+
// }
75+
// });
76+
// cy.exec(
77+
// `oc wait --for=condition=ready pod -l app.kubernetes.io/name=${serverResourceName} -n ${namespace} --timeout=300s`,
78+
// {
79+
// failOnNonZeroExit: false,
80+
// },
81+
// ).then(function (result) {
82+
// if (result.stdout.includes('condition met')) {
83+
// cy.log(`Success: ${result.stdout}`);
84+
// } else {
85+
// cy.log(result.stderr);
86+
// cy.wait(30000);
87+
// checkDevWorkspaceOperatorStatus(retries - 1);
88+
// }
89+
// });
90+
// }
91+
// };
92+
93+
// export const checkShipwrightOperatorStatus = (retries: number = 5) => {
94+
// const namespace = operatorNamespaces.ShipwrightOperator;
95+
// const resourceName = operatorSubscriptions.ShipwrightOperator;
96+
// if (retries === 0) {
97+
// throw new Error('Failed to install Shipwright Operator - Pod timeout');
98+
// } else {
99+
// cy.exec(
100+
// `oc wait --for=condition=ready pod -l app=${resourceName} -n ${namespace} --timeout=300s`,
101+
// {
102+
// failOnNonZeroExit: false,
103+
// },
104+
// ).then(function (result) {
105+
// if (result.stdout.includes('condition met')) {
106+
// cy.log(`Success: ${result.stdout}`);
107+
// } else {
108+
// cy.log(result.stderr);
109+
// cy.wait(30000);
110+
// checkShipwrightOperatorStatus(retries - 1);
111+
// }
112+
// });
113+
// }
114+
// };
115+
116+
// export const checkBuildsForOpenshiftOperatorStatus = (retries: number = 5) => {
117+
// const namespace = operatorNamespaces.BuildsForOpenshiftOperator;
118+
// const resourceName = operatorSubscriptions.BuildsForOpenshiftOperator;
119+
// if (retries === 0) {
120+
// throw new Error('Failed to install Builds for Openshift Operator - Pod timeout');
121+
// } else {
122+
// cy.exec(
123+
// `oc wait --for=condition=ready pod -l app=${resourceName} -n ${namespace} --timeout=300s`,
124+
// {
125+
// failOnNonZeroExit: false,
126+
// },
127+
// ).then(function (result) {
128+
// if (result.stdout.includes('condition met')) {
129+
// cy.log(`Success: ${result.stdout}`);
130+
// } else {
131+
// cy.log(result.stderr);
132+
// cy.wait(30000);
133+
// checkBuildsForOpenshiftOperatorStatus(retries - 1);
134+
// }
135+
// });
136+
// }
137+
// };
138+
139+
export const checkPipelineOperatorStatus = (retries = 5) => {
140+
const namespace = operatorNamespaces.PipelinesOperator;
141+
const resourceName = operatorSubscriptions.PipelinesOperator;
142+
if (retries === 0) {
143+
throw new Error('Failed to install Pipelines Operator - Pod timeout');
144+
} else {
145+
cy.exec(
146+
`oc wait --for=condition=ready pod -l app=${resourceName} -n ${namespace} --timeout=300s`,
147+
{
148+
failOnNonZeroExit: false,
149+
},
150+
).then(function (result) {
151+
if (result.stdout.includes('condition met')) {
152+
cy.log(`Success: ${result.stdout}`);
153+
} else {
154+
cy.log(result.stderr);
155+
// eslint-disable-next-line cypress/no-unnecessary-waiting
156+
cy.wait(30000);
157+
checkPipelineOperatorStatus(retries - 1);
158+
}
159+
});
160+
}
161+
};
162+
163+
export const checkKnativeOperatorStatus = () => {
164+
const checkInstanceStatus = (
165+
resourceName: string,
166+
instanceName: string,
167+
namespace: string,
168+
) => {
169+
cy.exec(
170+
`oc wait ${resourceName} --for=condition=Ready --timeout=2m -n ${namespace} ${instanceName}`,
171+
{
172+
failOnNonZeroExit: false,
173+
},
174+
).then(function (result) {
175+
if (result.stdout.includes('condition met')) {
176+
cy.log(result.stdout);
177+
} else if (resourceName === 'KnativeServing') {
178+
createKnativeServingUsingCLI();
179+
} else if (resourceName === 'KnativeEventing') {
180+
createKnativeEventingUsingCLI();
181+
} else if (resourceName === 'KnativeKafka') {
182+
createKnativeKafkaUsingCLI();
183+
}
184+
});
185+
};
186+
const checkKnativeServingStatus = () => {
187+
const namespace = 'knative-serving';
188+
const instanceName = 'knative-serving';
189+
const resourceName = 'KnativeServing';
190+
checkInstanceStatus(resourceName, instanceName, namespace);
191+
};
192+
193+
const checkKnativeEventingStatus = () => {
194+
const namespace = 'knative-eventing';
195+
const instanceName = 'knative-eventing';
196+
const resourceName = 'KnativeEventing';
197+
checkInstanceStatus(resourceName, instanceName, namespace);
198+
};
199+
200+
const checkKnativeKafkaStatus = () => {
201+
const namespace = 'knative-eventing';
202+
const instanceName = 'knative-kafka';
203+
const resourceName = 'KnativeKafka';
204+
checkInstanceStatus(resourceName, instanceName, namespace);
205+
};
206+
207+
checkKnativeServingStatus();
208+
checkKnativeEventingStatus();
209+
checkKnativeKafkaStatus();
210+
};

integration-tests/cypress/support/pages/functions/common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const tableFunctions = {
7878
},
7979

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

0 commit comments

Comments
 (0)