Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions web/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -38,6 +39,8 @@ export default defineConfig({
viewportWidth: 1920,
viewportHeight: 1080,
setupNodeEvents(on, config) {
registerCypressGrep(config);

on(
'before:browser:launch',
(
Expand Down
37 changes: 37 additions & 0 deletions web/cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion web/cypress/e2e/coo/01.coo_bvt.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const MP = {
operatorName: 'Cluster Monitoring Operator',
};

describe('BVT: COO', () => {
describe('BVT: COO', { tags: '@smoke' }, () => {

before(() => {
cy.beforeBlockCOO(MCP, MP);
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/e2e/coo/01.coo_ivt.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const KBV = {
}
};

describe('IVT: Monitoring UIPlugin + Virtualization', () => {
describe('IVT: Monitoring UIPlugin + Virtualization', { tags: '@smoke' }, () => {

before(() => {
cy.beforeBlockVirtualization(KBV);
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/e2e/incidents/00.coo_incidents_e2e.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/e2e/incidents/01.incidents.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
22 changes: 15 additions & 7 deletions web/cypress/e2e/incidents/02.incidents-mocking-example.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -37,37 +37,45 @@ 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');

cy.log('Multiple incidents with mixed alert states should be visible');
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');

cy.log('Overlapping incidents with different severity distributions should be visible');
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');

Expand All @@ -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([]);

Expand Down
2 changes: 1 addition & 1 deletion web/cypress/e2e/monitoring/01.bvt_monitoring.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const MP = {
operatorName: 'Cluster Monitoring Operator',
};

describe('BVT: Monitoring', () => {
describe('BVT: Monitoring', { tags: '@smoke' }, () => {

before(() => {
cy.beforeBlock(MP);
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/e2e/monitoring/regression/01.reg_alerts.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const MP = {
operatorName: 'Cluster Monitoring Operator',
};

describe('Regression: Monitoring - Alerts', () => {
describe('Regression: Monitoring - Alerts', { tags: '@regression' }, () => {

before(() => {
cy.beforeBlock(MP);
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/e2e/monitoring/regression/02.reg_metrics.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const MP = {
operatorName: 'Cluster Monitoring Operator',
};

describe('Regression: Monitoring - Metrics', () => {
describe('Regression: Monitoring - Metrics', { tags: '@regression' }, () => {

before(() => {
cy.beforeBlock(MP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions web/cypress/support/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import '@cypress/grep';

import './selectors';
import './commands/selector-commands';
import './commands/auth-commands';
Expand Down