Skip to content

Commit c883fba

Browse files
committed
UI check
1 parent 5c565e4 commit c883fba

2 files changed

Lines changed: 80 additions & 20 deletions

File tree

web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts

Lines changed: 74 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,95 @@ const MP = {
1818
operatorName: 'Cluster Monitoring Operator',
1919
};
2020

21+
const expectedAlerts = ['Watchdog', 'Watchdog-spoke', 'ClusterCPUHealth-jb'];
22+
23+
// ignore error message
24+
Cypress.on('uncaught:exception', (err) => {
25+
const ignoreList = [
26+
'Unauthorized',
27+
"Cannot read properties of null (reading 'default')",
28+
'ResizeObserver loop limit exceeded',
29+
];
30+
if (ignoreList.some((txt) => err.message.includes(txt))) {
31+
console.warn('⚠️ Ignored frontend exception:', err.message);
32+
return false;
33+
}
34+
});
35+
2136
describe('ACM Alerting UI', () => {
2237
before(() => {
2338
cy.beforeBlockCOO(MCP, MP);
2439
cy.log('=== [Setup] Installing ACM operator and MultiCluster Observability ===');
2540
// install acm through shell script
2641
cy.exec('bash ./cypress/fixtures/coo/acm-install.sh', {
27-
env: { KUBECONFIG: Cypress.env('KUBECONFIG_PATH'), },
28-
failOnNonZeroExit: false,
29-
timeout: 600000, // long time script
42+
env: { KUBECONFIG: Cypress.env('KUBECONFIG_PATH'), },
43+
failOnNonZeroExit: false,
44+
timeout: 1200000, // long time script
3045
});
3146
// update UIPlugin with the acm related content, (OCP enabled since installed from operatorHub)
3247
cy.exec(`oc apply -f ./cypress/fixtures/coo/acm-uiplugin.yaml --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`);
3348
// add thanos-ruler-custom-rules
3449
cy.exec(`oc apply -f ./cypress/fixtures/coo/acm-alerrule-test.yaml --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`);
3550
});
3651

37-
it('Admin perspective - Observe Menu', () => {
38-
//cy.visit('/');
39-
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
40-
commonPages.titleShouldHaveText('Alerting');
41-
42-
// TO DO:
43-
// Fleet Management => local-cluster => Observe => Alerting
44-
52+
it('Navigate to Fleet Management > local-cluster > Observe > Alerting', () => {
53+
// wait for console page loading completed
54+
cy.get('body', { timeout: 60000 }).should('contain.text', 'Administrator');
55+
// click Fleet Management
56+
cy.get('[data-test-id="perspective-switcher-toggle"]', { timeout: 20000 })
57+
.should('be.visible')
58+
.click();
59+
// select “Fleet Management”
60+
cy.get('[data-test-id="perspective-switcher-menu-option"]')
61+
.contains('Fleet Management')
62+
.should('be.visible')
63+
.click();
64+
65+
// close pop-up window
66+
cy.get('body').then(($body) => {
67+
const modalCloseBtn = $body.find('button[data-ouia-component-id="clustersOnboardingModal-ModalBoxCloseButton"]');
68+
if (modalCloseBtn.length > 0) {
69+
cy.wrap(modalCloseBtn)
70+
.should('be.visible')
71+
.should('not.be.disabled')
72+
.click({ force: true });
73+
cy.log('✅ Closed onboarding modal');
74+
} else {
75+
cy.log('ℹ️ No onboarding modal found');
76+
}
77+
});
78+
79+
// click “local-cluster” when visible
80+
cy.contains('a', 'local-cluster', { timeout: 90000 })
81+
.should('be.visible')
82+
.should('not.be.disabled')
83+
.click({ force: true });
84+
85+
// click side menu -> Observe -> Alerting
86+
cy.contains('Observe', { timeout: 20000 }).should('be.visible').click();
87+
cy.contains('Alerting', { timeout: 20000 }).should('be.visible').click();
88+
89+
// Wait for alert tab content to become visible
90+
cy.get('section#alerts-tab-content', { timeout: 60000 })
91+
.should('be.visible');
92+
93+
// confirm Alerting page loading completed then check three alert exist
94+
cy.get('body', { timeout: 60000 }).should('contain.text', 'Alerting');
95+
expectedAlerts.forEach((alert) => {
96+
cy.contains('a[data-test-id="alert-resource-link"]', alert, { timeout: 60000 })
97+
.should('be.visible');
98+
});
99+
100+
cy.log('✅ Verified all expected alerts are visible on the Alerting page');
45101
cy.log('✅ ACM Alerting UI test completed successfully');
46102
});
47103

48-
after(() => {
49-
cy.log('=== [Teardown] Uninstalling ACM operator and cleaning up ===');
50-
cy.exec('bash ./cypress/fixtures/coo/acm-uninstall.sh', {
51-
env: { KUBECONFIG: Cypress.env('KUBECONFIG_PATH') },
52-
failOnNonZeroExit: false,
53-
timeout: 600000,
104+
after(() => {
105+
cy.log('=== [Teardown] Uninstalling ACM operator and cleaning up ===');
106+
cy.exec('bash ./cypress/fixtures/coo/acm-uninstall.sh', {
107+
env: { KUBECONFIG: Cypress.env('KUBECONFIG_PATH') },
108+
failOnNonZeroExit: false,
109+
timeout: 600000,
110+
});
54111
});
55112
});
56-
});

web/cypress/fixtures/coo/acm-install.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ oc wait -n open-cluster-management --for=condition=Available deploy/search-colle
5757
oc wait -n open-cluster-management --for=condition=Available deploy/search-indexer --timeout=300s
5858
oc -n open-cluster-management get pod
5959
#create multi-cluster
60-
oc create ns open-cluster-management-observability || true
60+
if ! oc get ns open-cluster-management-observability >/dev/null 2>&1; then
61+
echo "[INFO] Creating namespace open-cluster-management-observability"
62+
oc create ns open-cluster-management-observability
63+
else
64+
echo "[INFO] Namespace open-cluster-management-observability already exists"
65+
fi
6166
oc apply -f -<<EOF
6267
apiVersion: apps/v1
6368
kind: Deployment
@@ -110,7 +115,6 @@ metadata:
110115
name: minio
111116
namespace: open-cluster-management-observability
112117
spec:
113-
storageClassName: gp3-csi
114118
accessModes:
115119
- ReadWriteOnce
116120
resources:

0 commit comments

Comments
 (0)