Skip to content

Commit 6738163

Browse files
authored
Adding basic helmops tests (#407)
* Adding basic helmops tests * Removing trace of .only. Adding extra check for test 190 not detecting DOCTYPE visible * Adding ability to target default clusters when deploying helmops * Changing repoName for each case
1 parent 78a4f7a commit 6738163

File tree

2 files changed

+59
-8
lines changed

2 files changed

+59
-8
lines changed

tests/cypress/e2e/unit_tests/p1_2_fleet.spec.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,53 @@ describe('Test move cluster to newly created workspace and deploy application to
10651065
});
10661066

10671067
if (!/\/2\.11/.test(Cypress.env('rancher_version'))) {
1068-
describe('Test no HTML error messages in HelmOps', { tags: '@p1_2' }, () => {
1068+
describe('Test HelmOps', { tags: '@p1_2' }, () => {
1069+
1070+
qase(165,
1071+
it('FLEET-165: Test basic HelmOps creation', { tags: '@fleet-165' }, () => {
1072+
1073+
cy.addHelmOp({
1074+
fleetNamespace: 'fleet-local',
1075+
repoName: 'helmapp-grafana',
1076+
repoUrl: 'https://grafana.github.io/helm-charts',
1077+
chart: 'grafana',
1078+
});
1079+
1080+
cy.verifyTableRow(0, 'Active', '1/1');
1081+
})
1082+
);
1083+
1084+
qase(197,
1085+
it('FLEET-197: Test Helmops creation with a fixed version', { tags: '@fleet-197' }, () => {
1086+
1087+
cy.addHelmOp({
1088+
fleetNamespace: 'fleet-default',
1089+
repoName: 'helmapp-grafana-fixed-version',
1090+
repoUrl: 'https://grafana.github.io/helm-charts',
1091+
chart: 'grafana',
1092+
version: '10.1.0',
1093+
deployTo: 'All Clusters'
1094+
});
1095+
1096+
cy.verifyTableRow(0, 'Active', '10.1.0');
1097+
})
1098+
);
1099+
1100+
qase(198,
1101+
it('FLEET-198: Test incorrect chart version cannot be installed', { tags: '@fleet-198' }, () => {
1102+
1103+
cy.addHelmOp({
1104+
fleetNamespace: 'fleet-local',
1105+
repoName: 'helmapp-grafana-bad-version',
1106+
repoUrl: 'https://grafana.github.io/helm-charts',
1107+
chart: 'grafana',
1108+
version: '999999999'
1109+
});
1110+
1111+
cy.verifyTableRow(0, 'Error', '0/0');
1112+
cy.contains('Could not get a chart version: no chart version found for grafana-999999999').should('be.visible');
1113+
})
1114+
);
10691115

10701116
qase(190,
10711117
it('FLEET-190: Test Faulty Helm Ops display short error message', { tags: '@fleet-190' }, () => {
@@ -1078,6 +1124,7 @@ if (!/\/2\.11/.test(Cypress.env('rancher_version'))) {
10781124
});
10791125

10801126
cy.contains('Could not get a chart version: failed to read helm repo from https://github.com/rancher/index.yaml, error code: 404').should('be.visible');
1127+
cy.contains('DOCTYPE html').should('not.exist');
10811128

10821129
})
10831130
);

tests/cypress/support/commands.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ Cypress.Commands.add('addHelmOp', ({ fleetNamespace='fleet-local', repoName, rep
215215
cy.accesMenuSelection('Continuous Delivery', 'Resources', 'Helm Ops');
216216
cy.fleetNamespaceToggle(fleetNamespace);
217217
cy.clickButton('Create Helm Op');
218-
219218

220219
cy.typeValue('Name', repoName);
221220
cy.clickButton('Next');
@@ -231,14 +230,19 @@ Cypress.Commands.add('addHelmOp', ({ fleetNamespace='fleet-local', repoName, rep
231230
cy.typeIntoCanvasTermnal(values);
232231
cy.clickButton('Next');
233232
}
234-
233+
235234
// TODO: add logic if we want to select specific cluster.
236235
if (deployTo) {
237-
cy.contains(deployTo).should('be.visible').click();
238-
cy.typeValue('Service Account Name', serviceAccountName);
239-
cy.typeValue('Target Namespace', targetNamespace);
240-
// Here we do not add click Next as is present in the follosing step
241-
}
236+
cy.contains('Target details').should('be.visible').click();
237+
if (deployTo === 'Manually selected clusters') {
238+
cy.typeValue('Service Account Name', serviceAccountName);
239+
cy.typeValue('Target Namespace', targetNamespace);
240+
}
241+
else {
242+
cy.get('div[data-testid="fleet-target-cluster-radio-button"]').contains(deployTo).should('be.visible').click();
243+
}
244+
// Here we do not add click Next as is present in the following step
245+
}
242246

243247
cy.get('span.controls').contains('Advanced').should('be.visible').click();
244248

0 commit comments

Comments
 (0)