Skip to content

Commit b75e34b

Browse files
Merge pull request #543 from etmurasaki/automation-kubevirt
OU-989: Kubevirt with fixes after namespace level and session handler
2 parents 1084dd6 + 174bed2 commit b75e34b

24 files changed

+684
-126
lines changed

web/cypress/README.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,33 @@ Set the following var to enable Cypress session management for faster test execu
7272
export CYPRESS_SESSION=true
7373
```
7474

75+
Integration Testing variables
76+
77+
Set the var to skip Openshift Virtualization and all the required operators installation.
78+
```bash
79+
export CYPRESS_SKIP_KBV_INSTALL=false
80+
```
81+
82+
Set the var to install Openshift Virtualization from redhat-operators catalog source.
83+
```bash
84+
export CYPRESS_KBV_UI_INSTALL=true
85+
```
86+
87+
Set the var to install Openshift Virtualization Operator using Konflux bundle.
88+
```bash
89+
export CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE=<KBV image>
90+
```
91+
92+
# Set the var to use custom Openshift Virtualization Operator bundle image
93+
```bash
94+
export CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE=<KBV bundle image>
95+
```
96+
97+
Set the var to use Openshift Virtualization Operator FBC image
98+
```bash
99+
export CYPRESS_FBC_STAGE_KBV_IMAGE=<KBV FBC image>
100+
```
101+
75102
### Environment Configuration Script
76103

77104
The `configure-env.sh` script provides an interactive way to set up all the required environment variables. This script eliminates the need to manually export each variable and helps find the correct kubeconfig file.
@@ -106,11 +133,22 @@ npx cypress open
106133
npx cypress run
107134
```
108135

109-
To run a specific file
136+
Some examples to run a specific file(s)
137+
138+
It runs the COO BVT only
110139
```bash
111140
cd monitoring-plugin/web/cypress
112-
npx cypress run --spec "cypress/e2e/bvt.cy.ts"
113-
npx cypress run --spec "cypress/e2e/coo_bvt.cy.ts"
141+
npx cypress run --spec "cypress/e2e/coo/01.coo_bvt.cy.ts"
142+
```
143+
144+
It runs the Monitoring BVT only
145+
```bash
146+
npx cypress run --spec "cypress/e2e/monitoring/01.bvt_monitoring.cy.ts"
147+
```
148+
149+
It runs the Monitoring Regression tests
150+
```bash
151+
npx cypress run --spec "cypress/e2e/monitoring/regression/**"
114152
```
115153

116154
### Testing recording

web/cypress/configure-env.sh

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ print_current_config() {
174174
print_var "CYPRESS_MCP_CONSOLE_IMAGE" "${CYPRESS_MCP_CONSOLE_IMAGE-}"
175175
print_var "CYPRESS_TIMEZONE" "${CYPRESS_TIMEZONE-}"
176176
print_var "CYPRESS_SESSION" "${CYPRESS_SESSION-}"
177+
print_var "CYPRESS_SKIP_KBV_INSTALL" "${CYPRESS_SKIP_KBV_INSTALL-}"
178+
print_var "CYPRESS_KBV_UI_INSTALL" "${CYPRESS_KBV_UI_INSTALL-}"
179+
print_var "CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE" "${CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE-}"
180+
print_var "CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE" "${CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE-}"
181+
print_var "CYPRESS_FBC_STAGE_KBV_IMAGE" "${CYPRESS_FBC_STAGE_KBV_IMAGE-}"
177182
}
178183

179184
main() {
@@ -216,7 +221,11 @@ main() {
216221
local def_mcp_console_image=${CYPRESS_MCP_CONSOLE_IMAGE-}
217222
local def_timezone=${CYPRESS_TIMEZONE-}
218223
local def_session=${CYPRESS_SESSION-}
219-
224+
local def_skip_kbv=${CYPRESS_SKIP_KBV_INSTALL-}
225+
local def_kbv_ui_install=${CYPRESS_KBV_UI_INSTALL-}
226+
local def_konflux_kbv_bundle=${CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE-}
227+
local def_custom_kbv_bundle=${CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE-}
228+
local def_fbc_stage_kbv_image=${CYPRESS_FBC_STAGE_KBV_IMAGE-}
220229
# Required basics
221230
local base_url
222231
while true; do
@@ -412,6 +421,26 @@ main() {
412421
local session="false"
413422
[[ "$session_ans" == "y" ]] && session="true"
414423

424+
local skip_kbv_install_ans
425+
skip_kbv_install_ans=$(ask_yes_no "Skip Openshift Virtualization installation? (sets CYPRESS_SKIP_KBV_INSTALL)" "$(bool_to_default_yn "$def_skip_kbv")")
426+
local skip_kbv_install="false"
427+
[[ "$skip_kbv_install_ans" == "y" ]] && skip_kbv_install="true"
428+
429+
local kbv_ui_install_ans
430+
kbv_ui_install_ans=$(ask_yes_no "Install KBV from redhat-operators? (sets CYPRESS_KBV_UI_INSTALL)" "$(bool_to_default_yn "$def_kbv_ui_install")")
431+
local kbv_ui_install="false"
432+
[[ "$kbv_ui_install_ans" == "y" ]] && kbv_ui_install="true"
433+
434+
local konflux_kbv_bundle
435+
konflux_kbv_bundle=$(ask "Konflux KBV bundle image (CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE)" "$def_konflux_kbv_bundle")
436+
437+
local custom_kbv_bundle
438+
custom_kbv_bundle=$(ask "Custom KBV bundle image (CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE)" "$def_custom_kbv_bundle")
439+
440+
local fbc_stage_kbv_image
441+
fbc_stage_kbv_image=$(ask "KBV FBC image (CYPRESS_FBC_STAGE_KBV_IMAGE)" "$def_fbc_stage_kbv_image")
442+
443+
415444
# Build export lines with safe quoting
416445
local -a export_lines
417446
export_lines+=("export CYPRESS_BASE_URL='$(printf %s "$base_url" | escape_for_single_quotes)'" )
@@ -437,6 +466,22 @@ main() {
437466
fi
438467
export_lines+=("export CYPRESS_SESSION='$(printf %s "$session" | escape_for_single_quotes)'" )
439468

469+
if [[ -n "$skip_kbv_install" ]]; then
470+
export_lines+=("export CYPRESS_SKIP_KBV_INSTALL='$(printf %s "$skip_kbv_install" | escape_for_single_quotes)'" )
471+
fi
472+
if [[ -n "$kbv_ui_install" ]]; then
473+
export_lines+=("export CYPRESS_KBV_UI_INSTALL='$(printf %s "$kbv_ui_install" | escape_for_single_quotes)'" )
474+
fi
475+
if [[ -n "$konflux_kbv_bundle" ]]; then
476+
export_lines+=("export CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE='$(printf %s "$konflux_kbv_bundle" | escape_for_single_quotes)'" )
477+
fi
478+
if [[ -n "$custom_kbv_bundle" ]]; then
479+
export_lines+=("export CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE='$(printf %s "$custom_kbv_bundle" | escape_for_single_quotes)'" )
480+
fi
481+
if [[ -n "$fbc_stage_kbv_image" ]]; then
482+
export_lines+=("export CYPRESS_FBC_STAGE_KBV_IMAGE='$(printf %s "$fbc_stage_kbv_image" | escape_for_single_quotes)'" )
483+
fi
484+
440485
echo ""
441486
if is_sourced; then
442487
# Export directly into current shell
@@ -467,6 +512,11 @@ main() {
467512
[[ -n "${CYPRESS_MCP_CONSOLE_IMAGE-}$mcp_console_image" ]] && echo " CYPRESS_MCP_CONSOLE_IMAGE=${CYPRESS_MCP_CONSOLE_IMAGE:-$mcp_console_image}"
468513
[[ -n "${CYPRESS_TIMEZONE-}$timezone" ]] && echo " CYPRESS_TIMEZONE=${CYPRESS_TIMEZONE:-$timezone}"
469514
echo " CYPRESS_SESSION=${CYPRESS_SESSION:-$session}"
515+
echo " CYPRESS_SKIP_KBV_INSTALL=${CYPRESS_SKIP_KBV_INSTALL:-$skip_kbv_install}"
516+
echo " CYPRESS_KBV_UI_INSTALL=${CYPRESS_KBV_UI_INSTALL:-$kbv_ui_install}"
517+
[[ -n "${CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE-}$konflux_kbv_bundle" ]] && echo " CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE=${CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE:-$konflux_kbv_bundle}"
518+
[[ -n "${CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE-}$custom_kbv_bundle" ]] && echo " CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE=${CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE:-$custom_kbv_bundle}"
519+
[[ -n "${CYPRESS_FBC_STAGE_KBV_IMAGE-}$fbc_stage_kbv_image" ]] && echo " CYPRESS_FBC_STAGE_KBV_IMAGE=${CYPRESS_FBC_STAGE_KBV_IMAGE:-$fbc_stage_kbv_image}"
470520
}
471521

472522
main "$@"
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { Classes } from '../../../src/components/data-test';
2+
import { commonPages } from '../../views/common';
3+
import { nav } from '../../views/nav';
4+
import { guidedTour } from '../../views/tour';
5+
6+
// Set constants for the operators that need to be installed for tests.
7+
const KBV = {
8+
namespace: 'openshift-cnv',
9+
packageName: 'kubevirt-hyperconverged',
10+
operatorName: 'kubevirt-hyperconverged-operator.v4.19.0',
11+
config: {
12+
kind: 'HyperConverged',
13+
name: 'kubevirt-hyperconverged',
14+
},
15+
crd: {
16+
kubevirt: 'kubevirts.kubevirt.io',
17+
hyperconverged: 'hyperconvergeds.hco.kubevirt.io',
18+
}
19+
};
20+
21+
const MCP = {
22+
namespace: 'openshift-cluster-observability-operator',
23+
packageName: 'cluster-observability-operator',
24+
operatorName: 'Cluster Observability Operator',
25+
config: {
26+
kind: 'UIPlugin',
27+
name: 'monitoring',
28+
},
29+
};
30+
31+
const MP = {
32+
namespace: 'openshift-monitoring',
33+
operatorName: 'Cluster Monitoring Operator',
34+
};
35+
36+
describe('IVT: Monitoring UIPlugin + Virtualization', () => {
37+
38+
before(() => {
39+
cy.beforeBlockVirtualization(KBV);
40+
cy.beforeBlockCOO(MCP, MP);
41+
});
42+
43+
it('1. Virtualization perspective - Observe Menu', () => {
44+
cy.log('Virtualization perspective - Observe Menu and verify all submenus');
45+
cy.switchPerspective('Virtualization');
46+
cy.byAriaLabel('Welcome modal').should('be.visible');
47+
guidedTour.closeKubevirtTour();
48+
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
49+
commonPages.titleShouldHaveText('Alerting');
50+
nav.tabs.switchTab('Silences');
51+
nav.tabs.switchTab('Alerting rules');
52+
cy.get(Classes.HorizontalNav).contains('Incidents').should('not.exist');
53+
nav.sidenav.clickNavLink(['Observe', 'Dashboards (Perses)']);
54+
commonPages.titleShouldHaveText('Dashboards');
55+
cy.switchPerspective('Administrator');
56+
57+
});
58+
59+
/**
60+
* TODO: To be replaced by COO validation such as Dashboards (Perses) scenarios
61+
*/
62+
63+
});

web/cypress/e2e/monitoring/01.bvt_monitoring.cy.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { overviewPage } from '../../views/overview-page';
1010
import common = require('mocha/lib/interfaces/common');
1111
import { AlertsAlertState, SilenceComment, SilenceState, WatchdogAlert } from '../../fixtures/monitoring/constants';
1212
import { alerts } from '../../fixtures/monitoring/alert';
13+
import { alertingRuleListPage } from '../../views/alerting-rule-list-page';
1314
// Set constants for the operators that need to be installed for tests.
1415
const MP = {
1516
namespace: 'openshift-monitoring',
@@ -29,6 +30,7 @@ describe('BVT: Monitoring', () => {
2930
commonPages.detailsPage.administration_clusterSettings();
3031
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
3132
commonPages.titleShouldHaveText('Alerting');
33+
cy.changeNamespace('All Projects');
3234
nav.tabs.switchTab('Silences');
3335
silencesListPage.firstTimeEmptyState();
3436
nav.sidenav.clickNavLink(['Observe', 'Metrics']);
@@ -71,6 +73,7 @@ describe('BVT: Monitoring', () => {
7173
nav.sidenav.clickNavLink(['Home', 'Overview']);
7274
overviewPage.clickClusterUtilizationViewCPU();
7375
commonPages.titleShouldHaveText('Metrics');
76+
commonPages.projectDropdownShouldExist();
7477
});
7578

7679

@@ -79,7 +82,6 @@ describe('BVT: Monitoring', () => {
7982
cy.log('5.1. use sidebar nav to go to Observe > Alerting');
8083
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
8184
commonPages.titleShouldHaveText('Alerting');
82-
commonPages.projectDropdownShouldNotExist();
8385
listPage.tabShouldHaveText('Alerts');
8486
listPage.tabShouldHaveText('Silences');
8587
listPage.tabShouldHaveText('Alerting rules');
@@ -206,6 +208,12 @@ describe('BVT: Monitoring', () => {
206208
listPage.filter.selectFilterOption(false, SilenceState.ACTIVE, true);
207209
silencesListPage.rows.shouldBe(`${WatchdogAlert.ALERTNAME}`, SilenceState.ACTIVE);
208210

211+
cy.log('6.9.1 verify on Alerting Rules list page again');
212+
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
213+
nav.tabs.switchTab('Alerting rules');
214+
listPage.filter.byName(`${WatchdogAlert.ALERTNAME}`);
215+
alertingRuleListPage.ARShouldBe(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`, 1, AlertsAlertState.SILENCED);
216+
209217
cy.log('6.10 verify on Alerts list page again');
210218
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
211219
listPage.filter.clearAllFilters();
@@ -216,7 +224,9 @@ describe('BVT: Monitoring', () => {
216224
cy.log('6.11 expires the Silence');
217225
listPage.ARRows.expandRow();
218226
listPage.ARRows.clickAlert();
219-
detailsPage.expireSilence(true);
227+
detailsPage.clickOnSilencedBy(`${WatchdogAlert.ALERTNAME}`);
228+
silenceDetailsPage.expireSilence(true, true);
229+
220230

221231
cy.log('6.12 verify on Alerts list page again');
222232
nav.sidenav.clickNavLink(['Observe', 'Alerting']);

web/cypress/e2e/monitoring/regression/01.reg_alerts.cy.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ describe('Regression: Monitoring - Alerts', () => {
2626

2727
it('1. Admin perspective - Alerting > Alerts page - Filtering', () => {
2828
cy.log('1.1 Header components');
29+
2930
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
3031
alerts.getWatchdogAlert();
31-
32+
cy.changeNamespace("All Projects");
3233
listPage.filter.selectFilterOption(true, AlertingRulesAlertState.PENDING, false);
3334
listPage.filter.selectFilterOption(false, AlertingRulesAlertState.SILENCED, false);
3435
listPage.filter.selectFilterOption(false, Severity.CRITICAL, false);
@@ -78,14 +79,12 @@ describe('Regression: Monitoring - Alerts', () => {
7879
cy.log('3.1 use sidebar nav to go to Observe > Alerting');
7980
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
8081
alerts.getWatchdogAlert();
81-
8282
listPage.ARRows.shouldBeLoaded();
8383

8484
cy.log('3.2 filter to Watchdog alert');
8585
listPage.filter.byName(`${WatchdogAlert.ALERTNAME}`);
8686
listPage.ARRows.countShouldBe(1);
8787

88-
8988
cy.log('3.3 silence alert');
9089
listPage.ARRows.expandRow();
9190
listPage.ARRows.silenceAlert();
@@ -124,14 +123,14 @@ describe('Regression: Monitoring - Alerts', () => {
124123
commonPages.titleShouldHaveText(`${WatchdogAlert.ALERTNAME}`);
125124
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
126125
nav.tabs.switchTab('Silences');
126+
cy.changeNamespace('openshift-monitoring');
127127

128128
cy.log('3.8 Assert Kebab on Silence List page for Expired alert');
129129
silencesListPage.emptyState();
130130
listPage.filter.removeMainTag(MainTagState.SILENCE_STATE);
131131
listPage.filter.selectFilterOption(true, SilenceState.EXPIRED, false);
132132
listPage.filter.selectFilterOption(false, SilenceState.ACTIVE, false);
133133
listPage.filter.selectFilterOption(false, SilenceState.PENDING, true);
134-
silencesListPage.filter.byName(`${WatchdogAlert.ALERTNAME}`);
135134
silencesListPage.rows.assertExpiredAlertKebab('0');
136135

137136
cy.log('3.9 Click on Expired alert and Assert Actions button');
@@ -194,6 +193,7 @@ describe('Regression: Monitoring - Alerts', () => {
194193
silenceAlertPage.clickCancelButton();
195194
commonPages.titleShouldHaveText(`${WatchdogAlert.ALERTNAME}`);
196195
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
196+
listPage.filter.byName(`${WatchdogAlert.ALERTNAME}`);
197197
listPage.ARRows.countShouldBe(1);
198198
});
199199

0 commit comments

Comments
 (0)