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
53 changes: 18 additions & 35 deletions .cursor/commands/generate-regression-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ description: Generate automated regression test from test documentation

Generate automated regression tests from test documentation in [`docs/incident_detection/tests/`](../../docs/incident_detection/tests/), following the style of existing tests in `@incidents/` and using `@incidents-page.ts` Page Object Model.


## Process

### 1. Parse Test Documentation
Expand Down Expand Up @@ -92,25 +91,17 @@ Verifies: OU-XXX
*/

import { incidentsPage } from "../../../views/incidents-page";

const MCP = {
namespace: "openshift-cluster-observability-operator",
packageName: "cluster-observability-operator",
operatorName: "Cluster Observability Operator",
config: {
kind: "UIPlugin",
name: "monitoring",
},
};

const MP = {
namespace: "openshift-monitoring",
operatorName: "Cluster Monitoring Operator",
};
import {
CLUSTER_MONITORING_OPERATOR,
CLUSTER_OBSERVABILITY_OPERATOR,
} from "../../../support/operators";

describe("Regression: [Section Name]", () => {
before(() => {
cy.beforeBlockCOO(MCP, MP);
cy.beforeBlockCOO(
CLUSTER_OBSERVABILITY_OPERATOR,
CLUSTER_MONITORING_OPERATOR,
);
});

beforeEach(() => {
Expand Down Expand Up @@ -491,8 +482,8 @@ Continue? (y/n/specify)
**Automated checks (AI should verify):**

- [ ] File naming matches `XX.reg_<section-name>.cy.ts`
- [ ] Standard MCP/MP configuration blocks present
- [ ] Uses `cy.beforeBlockCOO(MCP, MP)` in `before()` hook
- [ ] Standard CLUSTER_OBSERVABILITY_OPERATOR/CLUSTER_MONITORING_OPERATOR configuration blocks present
- [ ] Uses `cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR)` in `before()` hook
- [ ] Uses `incidentsPage.goTo()` in `beforeEach()`
- [ ] Uses `cy.mockIncidentFixture()` with valid fixture path
- [ ] No emojis in cy.log() statements
Expand Down Expand Up @@ -540,25 +531,17 @@ Verifies: OU-XXX
*/

import { incidentsPage } from "../../../views/incidents-page";

const MCP = {
namespace: "openshift-cluster-observability-operator",
packageName: "cluster-observability-operator",
operatorName: "Cluster Observability Operator",
config: {
kind: "UIPlugin",
name: "monitoring",
},
};

const MP = {
namespace: "openshift-monitoring",
operatorName: "Cluster Monitoring Operator",
};
import {
CLUSTER_MONITORING_OPERATOR,
CLUSTER_OBSERVABILITY_OPERATOR,
} from "../../../support/operators";

describe("Regression: Tooltip Positioning", () => {
before(() => {
cy.beforeBlockCOO(MCP, MP);
cy.beforeBlockCOO(
CLUSTER_OBSERVABILITY_OPERATOR,
CLUSTER_MONITORING_OPERATOR,
);
});

beforeEach(() => {
Expand Down
22 changes: 4 additions & 18 deletions .cursor/rules/incidents-testing-guidelines.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,11 @@ Verifies: OU-XXX
*/

import { incidentsPage } from '../../../views/incidents-page';

const MCP = {
namespace: 'openshift-cluster-observability-operator',
packageName: 'cluster-observability-operator',
operatorName: 'Cluster Observability Operator',
config: {
kind: 'UIPlugin',
name: 'monitoring',
},
};

const MP = {
namespace: 'openshift-monitoring',
operatorName: 'Cluster Monitoring Operator',
};
import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR } from "../../../support/operators";

describe('Regression: <Section Name>', () => {
before(() => {
cy.beforeBlockCOO(MCP, MP);
cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR);
});

beforeEach(() => {
Expand All @@ -140,8 +126,8 @@ describe('Regression: <Section Name>', () => {
### Required Elements
- File header comment with purpose and issue reference (e.g., "Verifies: OU-XXX")
- Import `incidentsPage` from relative path
- Standard MCP/MP configuration blocks
- Use `cy.beforeBlockCOO(MCP, MP)` in `before()` hook
- Standard CLUSTER_OBSERVABILITY_OPERATOR/CLUSTER_MONITORING_OPERATOR configuration blocks
- Use `cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR)` in `before()` hook
- Use `incidentsPage.goTo()` in `beforeEach()`
- Use `cy.mockIncidentFixture()` for test data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,10 @@ Shelved due to Cypress DOM snapshot accumulation causing ~10x degradation over 1

```typescript
import { incidentsPage } from "../../../views/incidents-page";

const MCP = {
namespace: Cypress.env("COO_NAMESPACE"),
packageName: "cluster-observability-operator",
operatorName: "Cluster Observability Operator",
config: {
kind: "UIPlugin",
name: "monitoring",
},
};

const MP = {
namespace: "openshift-monitoring",
operatorName: "Cluster Monitoring Operator",
};
import {
CLUSTER_MONITORING_OPERATOR,
CLUSTER_OBSERVABILITY_OPERATOR,
} from "../../../support/operators";

const INCIDENT_COUNT = 20;
const CYCLES_PER_INCIDENT = 5;
Expand All @@ -40,10 +29,14 @@ describe(
{ tags: ["@cluster-health-analyzer"] },
() => {
before(() => {
cy.beforeBlockCOO(MCP, MP, {
dashboards: false,
troubleshootingPanel: false,
});
cy.beforeBlockCOO(
CLUSTER_OBSERVABILITY_OPERATOR,
CLUSTER_MONITORING_OPERATOR,
{
dashboards: false,
troubleshootingPanel: false,
},
);
});

it("8.1 Endurance: Incident select/deselect cycling across 20 incidents", () => {
Expand Down
4 changes: 2 additions & 2 deletions web/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as path from 'path';
import registerCypressGrep from '@cypress/grep/src/plugin';
import { DefinePlugin, NormalModuleReplacementPlugin } from 'webpack';
import {
writeBenchmarkReport,
injectBenchmarksIntoMochawesome,
writeBenchmarkReport,
} from './cypress/plugins/benchmark-reporter';

const getLoginCredentials = (index: number): { username: string; password: string } => {
Expand Down Expand Up @@ -55,7 +55,7 @@ export default defineConfig({
LOGIN_PASSWORD6: getLoginCredentials(6).password,
TIMEZONE: process.env.CYPRESS_TIMEZONE || 'UTC',
MOCK_NEW_METRICS: process.env.CYPRESS_MOCK_NEW_METRICS || 'false',
COO_NAMESPACE: process.env.CYPRESS_COO_NAMESPACE || 'openshift-cluster-observability-operator',
COO_NAMESPACE: 'openshift-cluster-observability-operator',
typeDelay: 200,
},
fixturesFolder: 'cypress/fixtures',
Expand Down
22 changes: 11 additions & 11 deletions web/cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ All scenarios require the [standard variables](#required-variables) (`CYPRESS_BA
| ---------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **Released Version** | `CYPRESS_COO_UI_INSTALL=true` | Install operators from redhat-operators catalog. Production-like testing. |
| **Pre-provisioned COO** | `CYPRESS_SKIP_COO_INSTALL=true`, optionally `CYPRESS_COO_NAMESPACE=<ns>` | COO already installed. Tests still enable the monitoring plugin. Specify namespace if non-default. |
| **Pre-provisioned Virtualization** | `CYPRESS_SKIP_KBV_INSTALL=true` | OpenShift Virtualization already installed. |
| **Pre-provisioned Virtualization** | `CYPRESS_SKIP_CNV_INSTALL=true` | OpenShift Virtualization already installed. |
| **Local Dev / PR Testing** | `CYPRESS_SKIP_ALL_INSTALL=true` | Run UI locally via `make start-feature-frontend` ([details](../../README.md#development)). Skips all setup. |
| **Custom Images** | `CYPRESS_MP_IMAGE`, `CYPRESS_MCP_CONSOLE_IMAGE`, `CYPRESS_CHA_IMAGE`, `CYPRESS_CUSTOM_COO_BUNDLE_IMAGE` | Patch component images in the CSV, or replace the operator bundle. Combine with an installation method above. |
| **FBC Image** | `CYPRESS_FBC_STAGE_COO_IMAGE` | Install COO from File-Based Catalog image. For release validation. |
Expand Down Expand Up @@ -105,37 +105,37 @@ All scenarios require the [standard variables](#required-variables) (`CYPRESS_BA

### Plugin Image Configuration

| Variable | Description | Use Case |
| --------------------------- | -------------------------------------- | ------------------------- |
| `CYPRESS_MP_IMAGE` | Custom Monitoring Plugin image | Testing custom MP builds |
| `CYPRESS_MCP_CONSOLE_IMAGE` | Custom Monitoring Console Plugin image | Testing custom MCP builds |
| `CYPRESS_CHA_IMAGE` | Custom cluster-health-analyzer image | Testing custom CHA builds |
| Variable | Description | Use Case |
| --------------------------- | -------------------------------------- | ---------------------------------------------------- |
| `CYPRESS_MP_IMAGE` | Custom Monitoring Plugin image | Testing custom CLUSTER_MONITORING_OPERATOR builds |
| `CYPRESS_MCP_CONSOLE_IMAGE` | Custom Monitoring Console Plugin image | Testing custom CLUSTER_OBSERVABILITY_OPERATOR builds |
| `CYPRESS_CHA_IMAGE` | Custom cluster-health-analyzer image | Testing custom CHA builds |

### Operator Installation Control

| Variable | Default | Description |
| -------------------------- | ------- | -------------------------------------------------------------- |
| `CYPRESS_SKIP_COO_INSTALL` | `false` | Skip Cluster Observability Operator installation |
| `CYPRESS_SKIP_KBV_INSTALL` | `false` | Skip OpenShift Virtualization installation |
| `CYPRESS_SKIP_CNV_INSTALL` | `false` | Skip OpenShift Virtualization installation |
| `CYPRESS_SKIP_ALL_INSTALL` | `false` | Skip all operator installations (for pre-provisioned clusters) |
| `CYPRESS_COO_UI_INSTALL` | `false` | Install COO from redhat-operators catalog |
| `CYPRESS_KBV_UI_INSTALL` | `false` | Install Virtualization from redhat-operators catalog |
| `CYPRESS_CNV_UI_INSTALL` | `false` | Install Virtualization from redhat-operators catalog |

### Bundle Images

| Variable | Description |
| ---------------------------------- | ---------------------------------------- |
| `CYPRESS_KONFLUX_COO_BUNDLE_IMAGE` | COO bundle image from Konflux |
| `CYPRESS_CUSTOM_COO_BUNDLE_IMAGE` | Custom COO bundle image |
| `CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE` | Virtualization bundle image from Konflux |
| `CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE` | Custom Virtualization bundle image |
| `CYPRESS_KONFLUX_CNV_BUNDLE_IMAGE` | Virtualization bundle image from Konflux |
| `CYPRESS_CUSTOM_CNV_BUNDLE_IMAGE` | Custom Virtualization bundle image |

### FBC images

| Variable | Description |
| ----------------------------- | ---------------------------------------- |
| `CYPRESS_FBC_STAGE_COO_IMAGE` | Cluster Observability Operator FBC image |
| `CYPRESS_FBC_STAGE_KBV_IMAGE` | Virtualization FBC image |
| `CYPRESS_FBC_STAGE_CNV_IMAGE` | Virtualization FBC image |

### Testing Configuration

Expand Down
Loading