@@ -6,6 +6,7 @@ import Shadow = Cypress.Shadow;
66import 'cypress-wait-until' ;
77import { guidedTour } from '../views/tour' ;
88import { nav } from '../views/nav' ;
9+ import './nav' ;
910import { operatorHubPage } from '../views/operator-hub-page' ;
1011
1112
@@ -42,11 +43,6 @@ declare global {
4243 bySemanticElement ( element : string , text ?: string ) : Chainable < JQuery < HTMLElement > > ;
4344 byAriaLabel ( label : string , options ?: Partial < Loggable & Timeoutable & Withinable & Shadow > ) : Chainable < JQuery < HTMLElement > > ;
4445 byPFRole ( role : string , options ?: Partial < Loggable & Timeoutable & Withinable & Shadow > ) : Chainable < JQuery < HTMLElement > > ;
45- }
46- }
47-
48- declare global {
49- interface Chainable {
5046 switchPerspective ( perspective : string ) ;
5147 uiLogin ( provider : string , username : string , password : string ) ;
5248 uiLogout ( ) ;
@@ -546,6 +542,7 @@ Cypress.Commands.add('beforeBlockCOO', (MCP: { namespace: string, operatorName:
546542 expect ( result . code ) . to . eq ( 0 ) ;
547543 cy . log ( `Monitoring plugin pod is now running in namespace: ${ MCP . namespace } ` ) ;
548544 } ) ;
545+ cy . exec ( `oc label namespace openshift-cluster-observability-operator openshift.io/cluster-monitoring="true" --kubeconfig ${ Cypress . env ( 'KUBECONFIG_PATH' ) } ` )
549546 //TODO: https://issues.redhat.com/browse/OCPBUGS-58468 - console reload and logout was happening more often
550547 // cy.get('.pf-v5-c-alert, .pf-v6-c-alert', { timeout: readyTimeoutMilliseconds })
551548 // .contains('Web console update is available')
@@ -612,6 +609,8 @@ Cypress.Commands.add('afterBlockCOO', (MCP: { namespace: string, operatorName: s
612609 `oc adm policy remove-cluster-role-from-user cluster-admin ${ Cypress . env ( 'LOGIN_USERNAME' ) } --kubeconfig ${ Cypress . env ( 'KUBECONFIG_PATH' ) } ` ,
613610 ) ;
614611
612+ cy . executeAndDelete ( `oc label namespace openshift-cluster-observability-operator openshift.io/cluster-monitoring- --kubeconfig ${ Cypress . env ( 'KUBECONFIG_PATH' ) } ` )
613+
615614 //TODO: https://issues.redhat.com/browse/OCPBUGS-58468 - console reload and logout was happening more often
616615 // cy.get('.pf-v5-c-alert, .pf-v6-c-alert', { timeout: 120000 })
617616 // .contains('Web console update is available')
@@ -626,4 +625,26 @@ Cypress.Commands.add('afterBlockCOO', (MCP: { namespace: string, operatorName: s
626625
627626 }
628627 cy . log ( 'After block COO completed' ) ;
628+ } ) ;
629+
630+ // Apply incident fixture manifests to the cluster
631+ Cypress . Commands . add ( 'createKubePodCrashLoopingAlert' , ( ) => {
632+ const kubeconfigPath = Cypress . env ( 'KUBECONFIG_PATH' ) ;
633+ cy . exec (
634+ `oc apply -f ./cypress/fixtures/incidents/prometheus_rule_pod_crash_loop.yaml --kubeconfig ${ kubeconfigPath } ` ,
635+ ) ;
636+ cy . exec (
637+ `oc apply -f ./cypress/fixtures/incidents/pod_crash_loop.yaml --kubeconfig ${ kubeconfigPath } ` ,
638+ ) ;
639+ } ) ;
640+
641+ // Clean up incident fixture manifests from the cluster
642+ Cypress . Commands . add ( 'cleanupIncidentsFixtures' , ( ) => {
643+ const kubeconfigPath = Cypress . env ( 'KUBECONFIG_PATH' ) ;
644+ cy . executeAndDelete (
645+ `oc delete -f ./cypress/fixtures/incidents/pod_crash_loop.yaml --ignore-not-found=true --kubeconfig ${ kubeconfigPath } ` ,
646+ ) ;
647+ cy . executeAndDelete (
648+ `oc delete -f ./cypress/fixtures/incidents/prometheus_rule_pod_crash_loop.yaml --ignore-not-found=true --kubeconfig ${ kubeconfigPath } ` ,
649+ ) ;
629650} ) ;
0 commit comments