diff --git a/web/cypress.config.ts b/web/cypress.config.ts index 172007a4..4e7273a8 100644 --- a/web/cypress.config.ts +++ b/web/cypress.config.ts @@ -2,6 +2,7 @@ import { defineConfig } from 'cypress'; import * as fs from 'fs-extra'; import * as console from 'console'; import * as path from 'path'; +import registerCypressGrep from '@cypress/grep/src/plugin'; export default defineConfig({ screenshotsFolder: './cypress/screenshots', @@ -38,6 +39,8 @@ export default defineConfig({ viewportWidth: 1920, viewportHeight: 1080, setupNodeEvents(on, config) { + registerCypressGrep(config); + on( 'before:browser:launch', ( diff --git a/web/cypress/README.md b/web/cypress/README.md index 79a53090..91b40170 100644 --- a/web/cypress/README.md +++ b/web/cypress/README.md @@ -166,5 +166,42 @@ It runs the Monitoring Regression tests npx cypress run --spec "cypress/e2e/monitoring/regression/**" ``` +### Running tests by tags + +Tests are organized using tags for selective execution: + +**Available tags:** +- `@smoke` - Fast BVT tests for basic functionality validation +- `@regression` - Comprehensive regression tests +- `@slow` - Long-running e2e tests (15+ minutes) +- `@demo` - Interactive demo tests (skipped in CI) + +**Run smoke tests only:** +```bash +npx cypress run --env grepTags=@smoke +``` + +**Run all tests except slow and demo:** +```bash +npx cypress run --env grepTags="-@slow -@demo" +``` + +**Run smoke and regression tests:** +```bash +npx cypress run --env grepTags="@smoke @regression" +``` + +**Run tests with multiple tags (AND logic):** +```bash +npx cypress run --env grepTags="@smoke+@slow" +``` + +**Filter by tag within a specific spec:** +```bash +npx cypress run --spec "cypress/e2e/incidents/**" --env grepTags=@regression +``` + +For more details on tag filtering, see [@cypress/grep documentation](https://github.com/cypress-io/cypress/tree/develop/npm/grep). + ### Testing recording You can access the recording for your test under monitoring-plugin/web/cypress/videos folder \ No newline at end of file diff --git a/web/cypress/e2e/coo/01.coo_bvt.cy.ts b/web/cypress/e2e/coo/01.coo_bvt.cy.ts index ae6250c4..b4ffe407 100644 --- a/web/cypress/e2e/coo/01.coo_bvt.cy.ts +++ b/web/cypress/e2e/coo/01.coo_bvt.cy.ts @@ -18,7 +18,7 @@ const MP = { operatorName: 'Cluster Monitoring Operator', }; -describe('BVT: COO', () => { +describe('BVT: COO', { tags: '@smoke' }, () => { before(() => { cy.beforeBlockCOO(MCP, MP); diff --git a/web/cypress/e2e/coo/01.coo_ivt.cy.ts b/web/cypress/e2e/coo/01.coo_ivt.cy.ts index 3595cc75..62127fd4 100644 --- a/web/cypress/e2e/coo/01.coo_ivt.cy.ts +++ b/web/cypress/e2e/coo/01.coo_ivt.cy.ts @@ -18,7 +18,7 @@ const KBV = { } }; -describe('IVT: Monitoring UIPlugin + Virtualization', () => { +describe('IVT: Monitoring UIPlugin + Virtualization', { tags: '@smoke' }, () => { before(() => { cy.beforeBlockVirtualization(KBV); diff --git a/web/cypress/e2e/incidents/00.coo_incidents_e2e.cy.ts b/web/cypress/e2e/incidents/00.coo_incidents_e2e.cy.ts index 7ae7ae5b..4cb1a2a6 100644 --- a/web/cypress/e2e/incidents/00.coo_incidents_e2e.cy.ts +++ b/web/cypress/e2e/incidents/00.coo_incidents_e2e.cy.ts @@ -21,7 +21,7 @@ const MP = { operatorName: 'Cluster Monitoring Operator', }; -describe('BVT: Incidents - e2e', () => { +describe('BVT: Incidents - e2e', { tags: ['@smoke', '@slow'] }, () => { let currentAlertName: string; before(() => { diff --git a/web/cypress/e2e/incidents/01.incidents.cy.ts b/web/cypress/e2e/incidents/01.incidents.cy.ts index 8d0508fd..372c5343 100644 --- a/web/cypress/e2e/incidents/01.incidents.cy.ts +++ b/web/cypress/e2e/incidents/01.incidents.cy.ts @@ -31,7 +31,7 @@ const NAMESPACE = 'openshift-monitoring'; const SEVERITY = 'Critical'; const ALERT_DESC = 'This is an alert meant to ensure that the entire alerting pipeline is functional. This alert is always firing, therefore it should always be firing in Alertmanager and always fire against a receiver. There are integrations with various notification mechanisms that send a notification when this alert is not firing. For example the "DeadMansSnitch" integration in PagerDuty.' const ALERT_SUMMARY = 'An alert that should always be firing to certify that Alertmanager is working properly.' -describe('BVT: Incidents - UI', () => { +describe('BVT: Incidents - UI', { tags: '@smoke' }, () => { before(() => { cy.beforeBlockCOO(MCP, MP); }); diff --git a/web/cypress/e2e/incidents/02.incidents-mocking-example.cy.ts b/web/cypress/e2e/incidents/02.incidents-mocking-example.cy.ts index 7ab11f7d..0469ae02 100644 --- a/web/cypress/e2e/incidents/02.incidents-mocking-example.cy.ts +++ b/web/cypress/e2e/incidents/02.incidents-mocking-example.cy.ts @@ -26,7 +26,7 @@ const MP = { operatorName: 'Cluster Monitoring Operator', }; -describe('Incidents - Mocking Examples', () => { +describe('Incidents - Mocking Examples', { tags: '@demo' }, () => { before(() => { cy.beforeBlockCOO(MCP, MP); @@ -37,21 +37,29 @@ describe('Incidents - Mocking Examples', () => { incidentsPage.goTo(); }); - it('1. Mock healthy cluster from fixture', () => { + it('1. Mock silenced and firing incidents with mixed severity', () => { + cy.log('Setting up silenced critical and firing warning incidents'); + cy.mockIncidentFixture('incident-scenarios/silenced-and-firing-mixed-severity.yaml'); + + cy.log('One silenced critical incident (resolved) and one firing warning incident should be visible'); + cy.pause(); + }); + + it('2. Mock healthy cluster from fixture', () => { cy.log('Setting up healthy cluster scenario from fixture'); cy.mockIncidentFixture('incident-scenarios/0-healthy-cluster.yaml'); cy.pause(); }); - it('2. Mock single incident with critical and warning alerts', () => { + it('3. Mock single incident with critical and warning alerts', () => { cy.log('Setting up single incident with critical and warning alerts from fixture'); cy.mockIncidentFixture('incident-scenarios/1-single-incident-firing-critical-and-warning-alerts.yaml'); cy.log('Single incident with mixed severity alerts should be visible'); cy.pause(); }); - it('3. Mock multi-incidents with resolved and firing alerts', () => { + it('4. Mock multi-incidents with resolved and firing alerts', () => { cy.log('Setting up multi-incidents with resolved and firing alerts from fixture'); cy.mockIncidentFixture('incident-scenarios/2-multi-incidents-multi-alerts-resolved-and-firing.yaml'); @@ -59,7 +67,7 @@ describe('Incidents - Mocking Examples', () => { cy.pause(); }); - it('4. Mock multi-severity overlapping incidents', () => { + it('5. Mock multi-severity overlapping incidents', () => { cy.log('Setting up multi-severity overlapping incidents from fixture'); cy.mockIncidentFixture('incident-scenarios/3-multi-severity-overlapping-incidents.yaml'); @@ -67,7 +75,7 @@ describe('Incidents - Mocking Examples', () => { cy.pause(); }); - it('5. Mock single incident with escalating severity alerts', () => { + it('6. Mock single incident with escalating severity alerts', () => { cy.log('Setting up single incident with escalating severity alerts from fixture'); cy.mockIncidentFixture('incident-scenarios/5-escalating-severity-incident.yaml'); @@ -76,7 +84,7 @@ describe('Incidents - Mocking Examples', () => { }); - it('6. Mock empty incident state', () => { + it('7. Mock empty incident state', () => { cy.log('Setting up empty incident state'); cy.mockIncidents([]); diff --git a/web/cypress/e2e/monitoring/01.bvt_monitoring.cy.ts b/web/cypress/e2e/monitoring/01.bvt_monitoring.cy.ts index b035114f..07c37950 100644 --- a/web/cypress/e2e/monitoring/01.bvt_monitoring.cy.ts +++ b/web/cypress/e2e/monitoring/01.bvt_monitoring.cy.ts @@ -17,7 +17,7 @@ const MP = { operatorName: 'Cluster Monitoring Operator', }; -describe('BVT: Monitoring', () => { +describe('BVT: Monitoring', { tags: '@smoke' }, () => { before(() => { cy.beforeBlock(MP); diff --git a/web/cypress/e2e/monitoring/regression/01.reg_alerts.cy.ts b/web/cypress/e2e/monitoring/regression/01.reg_alerts.cy.ts index 671fa1b6..b7cd30dc 100644 --- a/web/cypress/e2e/monitoring/regression/01.reg_alerts.cy.ts +++ b/web/cypress/e2e/monitoring/regression/01.reg_alerts.cy.ts @@ -18,7 +18,7 @@ const MP = { operatorName: 'Cluster Monitoring Operator', }; -describe('Regression: Monitoring - Alerts', () => { +describe('Regression: Monitoring - Alerts', { tags: '@regression' }, () => { before(() => { cy.beforeBlock(MP); diff --git a/web/cypress/e2e/monitoring/regression/02.reg_metrics.cy.ts b/web/cypress/e2e/monitoring/regression/02.reg_metrics.cy.ts index 4956b5a7..9c181ac6 100644 --- a/web/cypress/e2e/monitoring/regression/02.reg_metrics.cy.ts +++ b/web/cypress/e2e/monitoring/regression/02.reg_metrics.cy.ts @@ -9,7 +9,7 @@ const MP = { operatorName: 'Cluster Monitoring Operator', }; -describe('Regression: Monitoring - Metrics', () => { +describe('Regression: Monitoring - Metrics', { tags: '@regression' }, () => { before(() => { cy.beforeBlock(MP); diff --git a/web/cypress/e2e/monitoring/regression/03.reg_legacy_dashboards.cy.ts b/web/cypress/e2e/monitoring/regression/03.reg_legacy_dashboards.cy.ts index be932da6..f3b143db 100644 --- a/web/cypress/e2e/monitoring/regression/03.reg_legacy_dashboards.cy.ts +++ b/web/cypress/e2e/monitoring/regression/03.reg_legacy_dashboards.cy.ts @@ -14,7 +14,7 @@ const MP = { operatorName: 'Cluster Monitoring Operator', }; -describe('Regression: Monitoring - Dashboards (Legacy)', () => { +describe('Regression: Monitoring - Dashboards (Legacy)', { tags: '@regression' }, () => { before(() => { cy.beforeBlock(MP); diff --git a/web/cypress/support/index.ts b/web/cypress/support/index.ts index 6705b322..0214cb6a 100644 --- a/web/cypress/support/index.ts +++ b/web/cypress/support/index.ts @@ -1,3 +1,5 @@ +import '@cypress/grep'; + import './selectors'; import './commands/selector-commands'; import './commands/auth-commands';