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
18 changes: 10 additions & 8 deletions web/cypress/dummy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,21 @@ export {
YellowExclamationTriangleIcon,
} from '@openshift-console/dynamic-plugin-sdk';

export const consoleFetchJSON = (url) => fetch(url)
.then(response => response.json());
consoleFetchJSON.delete = (url) => fetch(url, { method: 'DELETE' })
.then(response => response.json());
consoleFetchJSON.post = (url, json) => fetch(url, { body: JSON.stringify(json), method: 'POST'})
.then(response => response.json());
export const consoleFetchJSON = (url) => fetch(url).then((response) => response.json());
consoleFetchJSON.delete = (url) =>
fetch(url, { method: 'DELETE' }).then((response) => response.json());
consoleFetchJSON.post = (url, json) =>
fetch(url, { body: JSON.stringify(json), method: 'POST' }).then((response) => response.json());

export const ListPageFilter = () => <input data-test="name-filter-input"></input>;

export const VirtualizedTable = ({ data, Row }) => (
<table>
<tbody>
<tr data-test-rows="resource-row">
{data.map((obj, i) => <Row key={i} obj={obj} />)}
{data.map((obj, i) => (
<Row key={i} obj={obj} />
))}
</tr>
</tbody>
</table>
Expand All @@ -36,4 +37,5 @@ export const VirtualizedTable = ({ data, Row }) => (
export const Timestamp = () => <div>Mock_Timestamp</div>;

export const useActivePerspective = () => ['admin'];
export const useListPageFilter = (data, rowFilters) => [data, data, () => {}];
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const useListPageFilter = (data, _rowFilters) => [data, data, () => {}];
5 changes: 0 additions & 5 deletions web/cypress/e2e/coo/01.coo_bvt.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { commonPages } from '../../views/common';
import { nav } from '../../views/nav';
import { troubleshootingPanelPage } from '../../views/troubleshooting-panel';


// Set constants for the operators that need to be installed for tests.
const MCP = {
namespace: Cypress.env('COO_NAMESPACE'),
Expand All @@ -20,10 +19,8 @@ const MP = {
};

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

before(() => {
cy.beforeBlockCOO(MCP, MP);

});

it('1. Admin perspective - Observe Menu', () => {
Expand All @@ -40,11 +37,9 @@ describe('BVT: COO', { tags: ['@smoke', '@coo'] }, () => {
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
troubleshootingPanelPage.openSignalCorrelation();
troubleshootingPanelPage.troubleshootingPanelPageShouldBeLoadedEnabled();

});

/**
* TODO: To be replaced by COO validation such as Dashboards (Perses) scenarios
*/

});
5 changes: 1 addition & 4 deletions web/cypress/e2e/coo/01.coo_ivt.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ const KBV = {
crd: {
kubevirt: 'kubevirts.kubevirt.io',
hyperconverged: 'hyperconvergeds.hco.kubevirt.io',
}
},
};

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

before(() => {
cy.beforeBlockVirtualization(KBV);
});
Expand All @@ -28,11 +27,9 @@ describe('IVT: Monitoring UIPlugin + Virtualization', { tags: ['@smoke', '@coo']
guidedTour.closeKubevirtTour();
troubleshootingPanelPage.signalCorrelationShouldNotBeVisible();
cy.switchPerspective('Core platform', 'Administrator');

});

/**
* TODO: To be replaced by COO validation such as Dashboards (Perses) scenarios
*/

});
7 changes: 4 additions & 3 deletions web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('ACM Alerting UI', { tags: ['@coo', '@alerts'] }, () => {
// check monitoring-plugin UI is not been affected
cy.switchPerspective('Core platform');
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
commonPages.titleShouldHaveText('Alerting')
commonPages.titleShouldHaveText('Alerting');
nav.sidenav.clickNavLink(['Observe', 'Metrics']);
commonPages.titleShouldHaveText('Metrics');
// switch to Fleet Management page
Expand All @@ -50,8 +50,9 @@ describe('ACM Alerting UI', { tags: ['@coo', '@alerts'] }, () => {
acmAlertingPage.shouldBeLoaded();
// check test alerts exist
expectedAlerts.forEach((alert) => {
cy.contains('a[data-test-id="alert-resource-link"]', alert, { timeout: 120000 })
.should('be.visible');
cy.contains('a[data-test-id="alert-resource-link"]', alert, { timeout: 120000 }).should(
'be.visible',
);
});
cy.log('Verified all expected alerts are visible on the Alerting page');
cy.log('ACM Alerting UI test completed successfully');
Expand Down
28 changes: 10 additions & 18 deletions web/cypress/e2e/incidents/00.coo_incidents_e2e.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
The test verifies the whole lifecycle of the Incident feature, without any external dependencies.
The run time can be 15 - 20 minutes. (Waiting untill the incident detection captures the new alert)
*/
import { commonPages } from '../../views/common';
import { incidentsPage } from '../../views/incidents-page';

// Set constants for the operators that need to be installed for tests.
Expand All @@ -26,8 +25,8 @@ describe('BVT: Incidents - e2e', { tags: ['@smoke', '@slow', '@incidents', '@e2e

before(() => {
cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false });
cy.cleanupIncidentPrometheusRules();

cy.cleanupIncidentPrometheusRules();

// Create the alert and capture the random name
cy.createKubePodCrashLoopingAlert().then((alertName) => {
Expand All @@ -41,24 +40,17 @@ describe('BVT: Incidents - e2e', { tags: ['@smoke', '@slow', '@incidents', '@e2e
cy.log('1.1 Navigate to Incidents page and clear filters');
incidentsPage.goTo();
incidentsPage.clearAllFilters();

const intervalMs = 60_000;
const maxMinutes = 30;
const maxMinutes = 30;

cy.log('1.2 Wait for incident with custom alert to appear');
cy.waitUntil(
() => incidentsPage.findIncidentWithAlert(currentAlertName),
{
interval: intervalMs,
timeout: maxMinutes * intervalMs,
}
);
cy.waitUntil(() => incidentsPage.findIncidentWithAlert(currentAlertName), {
interval: intervalMs,
timeout: maxMinutes * intervalMs,
});

cy.log('1.3 Verify custom alert appears in alerts table');
incidentsPage
.elements
.incidentsTable()
.contains(currentAlertName)
.should('exist');
incidentsPage.elements.incidentsTable().contains(currentAlertName).should('exist');
});
});
});
20 changes: 12 additions & 8 deletions web/cypress/e2e/incidents/01.incidents.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ const MP = {
describe('BVT: Incidents - UI', { tags: ['@smoke', '@incidents'] }, () => {
before(() => {
cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false });
cy.mockIncidentFixture('incident-scenarios/1-single-incident-firing-critical-and-warning-alerts.yaml');
cy.mockIncidentFixture(
'incident-scenarios/1-single-incident-firing-critical-and-warning-alerts.yaml',
);
});


it('1. Admin perspective - Incidents page - Toolbar and charts toggle functionality', () => {
cy.log('1.1 Verify toolbar and toggle charts button');
incidentsPage.elements.toolbar().should('be.visible');
incidentsPage.elements.toggleChartsButton().should('be.visible');
incidentsPage.elements.toggleChartsButton().click();

cy.log('1.2 Verify charts are hidden after toggle');
incidentsPage.elements.incidentsChartTitle().should('not.exist');
incidentsPage.elements.alertsChartTitle().should('not.exist');
Expand All @@ -46,7 +47,7 @@ describe('BVT: Incidents - UI', { tags: ['@smoke', '@incidents'] }, () => {
it('2. Admin perspective - Incidents page - Days filter functionality', () => {
cy.log('2.1 Set days filter to 3 days');
incidentsPage.setDays('3 days');

cy.log('2.2 Verify filter selection is updated');
incidentsPage.elements.daysSelectToggle().should('contain.text', '3 days');
});
Expand All @@ -55,18 +56,19 @@ describe('BVT: Incidents - UI', { tags: ['@smoke', '@incidents'] }, () => {
cy.log('3.1 Clear filters and toggle Critical filter');
incidentsPage.clearAllFilters();
incidentsPage.toggleFilter('Critical');
// Visibility verification of the filter chip is too complex. The functionality will be
// Visibility verification of the filter chip is too complex. The functionality will be
// better verified in the filtering specific test.
cy.log('3.2 Verify filter can be removed');
incidentsPage.removeFilter('Severity', 'Critical');
});

it('4. Admin perspective - Incidents page - Charts and alerts empty state', () => {
cy.mockIncidents([]);

cy.log('4.1 Verify chart titles are visible');
incidentsPage.elements.incidentsChartTitle().should('be.visible');
incidentsPage.elements.alertsChartTitle().should('be.visible');

cy.log('4.2 Verify alerts chart shows empty state');
incidentsPage.elements.alertsChartEmptyState().should('exist');
});
Expand All @@ -79,11 +81,13 @@ describe('BVT: Incidents - UI', { tags: ['@smoke', '@incidents'] }, () => {
incidentsPage.findIncidentWithAlert('TargetAlert').should('be.false');

cy.log('5.2 Verify traversing incident table works when the alert is not present');
cy.mockIncidentFixture('incident-scenarios/1-single-incident-firing-critical-and-warning-alerts.yaml');
cy.mockIncidentFixture(
'incident-scenarios/1-single-incident-firing-critical-and-warning-alerts.yaml',
);
incidentsPage.findIncidentWithAlert('TargetAlert').should('be.false');

cy.log('5.3 Verify traversing incident table works when the alert is present');
cy.mockIncidentFixture('incident-scenarios/6-multi-incident-target-alert-scenario.yaml');
incidentsPage.findIncidentWithAlert('TargetAlert').should('be.true');
});
});
});
29 changes: 15 additions & 14 deletions web/cypress/e2e/incidents/02.incidents-mocking-example.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ This test showcases different mocking approaches:
3. Demonstrating empty state handling
*/

import { commonPages } from '../../views/common';
import { incidentsPage } from '../../views/incidents-page';
import { IncidentDefinition } from '../../support/incidents_prometheus_query_mocks';

const MCP = {
namespace: Cypress.env('COO_NAMESPACE'),
Expand All @@ -27,7 +25,6 @@ const MP = {
};

describe('Incidents - Mocking Examples', { tags: ['@demo', '@incidents'] }, () => {

before(() => {
cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false });
});
Expand All @@ -40,37 +37,43 @@ describe('Incidents - Mocking Examples', { tags: ['@demo', '@incidents'] }, () =
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.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('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.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('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.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('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();
});
Expand All @@ -81,15 +84,13 @@ describe('Incidents - Mocking Examples', { tags: ['@demo', '@incidents'] }, () =

cy.log('Single incident with escalating severity alerts should be visible');
cy.pause();

});

it('7. Mock empty incident state', () => {
cy.log('Setting up empty incident state');
cy.mockIncidents([]);

cy.log('No incidents should be visible - empty state');
cy.pause();
});

});
});
Loading