Skip to content

Commit bbef11f

Browse files
committed
lint enabled for cypress files
1 parent ca5f2eb commit bbef11f

123 files changed

Lines changed: 9981 additions & 6295 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

web/cypress/dummy.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@ export {
1414
YellowExclamationTriangleIcon,
1515
} from '@openshift-console/dynamic-plugin-sdk';
1616

17-
export const consoleFetchJSON = (url) => fetch(url)
18-
.then(response => response.json());
19-
consoleFetchJSON.delete = (url) => fetch(url, { method: 'DELETE' })
20-
.then(response => response.json());
21-
consoleFetchJSON.post = (url, json) => fetch(url, { body: JSON.stringify(json), method: 'POST'})
22-
.then(response => response.json());
17+
export const consoleFetchJSON = (url) => fetch(url).then((response) => response.json());
18+
consoleFetchJSON.delete = (url) =>
19+
fetch(url, { method: 'DELETE' }).then((response) => response.json());
20+
consoleFetchJSON.post = (url, json) =>
21+
fetch(url, { body: JSON.stringify(json), method: 'POST' }).then((response) => response.json());
2322

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

2625
export const VirtualizedTable = ({ data, Row }) => (
2726
<table>
2827
<tbody>
2928
<tr data-test-rows="resource-row">
30-
{data.map((obj, i) => <Row key={i} obj={obj} />)}
29+
{data.map((obj, i) => (
30+
<Row key={i} obj={obj} />
31+
))}
3132
</tr>
3233
</tbody>
3334
</table>
@@ -36,4 +37,5 @@ export const VirtualizedTable = ({ data, Row }) => (
3637
export const Timestamp = () => <div>Mock_Timestamp</div>;
3738

3839
export const useActivePerspective = () => ['admin'];
39-
export const useListPageFilter = (data, rowFilters) => [data, data, () => {}];
40+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
41+
export const useListPageFilter = (data, _rowFilters) => [data, data, () => {}];

web/cypress/e2e/coo/01.coo_bvt.cy.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { commonPages } from '../../views/common';
22
import { nav } from '../../views/nav';
33
import { troubleshootingPanelPage } from '../../views/troubleshooting-panel';
44

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

2221
describe('BVT: COO', { tags: ['@smoke', '@coo'] }, () => {
23-
2422
before(() => {
2523
cy.beforeBlockCOO(MCP, MP);
26-
2724
});
2825

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

4642
/**
4743
* TODO: To be replaced by COO validation such as Dashboards (Perses) scenarios
4844
*/
49-
5045
});

web/cypress/e2e/coo/01.coo_ivt.cy.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ const KBV = {
1313
crd: {
1414
kubevirt: 'kubevirts.kubevirt.io',
1515
hyperconverged: 'hyperconvergeds.hco.kubevirt.io',
16-
}
16+
},
1717
};
1818

1919
describe('IVT: Monitoring UIPlugin + Virtualization', { tags: ['@smoke', '@coo'] }, () => {
20-
2120
before(() => {
2221
cy.beforeBlockVirtualization(KBV);
2322
});
@@ -28,11 +27,9 @@ describe('IVT: Monitoring UIPlugin + Virtualization', { tags: ['@smoke', '@coo']
2827
guidedTour.closeKubevirtTour();
2928
troubleshootingPanelPage.signalCorrelationShouldNotBeVisible();
3029
cy.switchPerspective('Core platform', 'Administrator');
31-
3230
});
3331

3432
/**
3533
* TODO: To be replaced by COO validation such as Dashboards (Perses) scenarios
3634
*/
37-
3835
});

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('ACM Alerting UI', { tags: ['@coo', '@alerts'] }, () => {
2828
it('Navigate to Fleet Management > local-cluster > Observe > Alerting', () => {
2929
// check monitoring-plugin UI is not been affected
3030
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
31-
commonPages.titleShouldHaveText('Alerting')
31+
commonPages.titleShouldHaveText('Alerting');
3232
nav.sidenav.clickNavLink(['Observe', 'Metrics']);
3333
commonPages.titleShouldHaveText('Metrics');
3434
// switch to Fleet Management page
@@ -49,8 +49,9 @@ describe('ACM Alerting UI', { tags: ['@coo', '@alerts'] }, () => {
4949
acmAlertingPage.shouldBeLoaded();
5050
// check test alerts exist
5151
expectedAlerts.forEach((alert) => {
52-
cy.contains('a[data-test-id="alert-resource-link"]', alert, { timeout: 120000 })
53-
.should('be.visible');
52+
cy.contains('a[data-test-id="alert-resource-link"]', alert, { timeout: 120000 }).should(
53+
'be.visible',
54+
);
5455
});
5556
cy.log('Verified all expected alerts are visible on the Alerting page');
5657
cy.log('ACM Alerting UI test completed successfully');

web/cypress/e2e/incidents/00.coo_incidents_e2e.cy.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
The test verifies the whole lifecycle of the Incident feature, without any external dependencies.
33
The run time can be 15 - 20 minutes. (Waiting untill the incident detection captures the new alert)
44
*/
5-
import { commonPages } from '../../views/common';
65
import { incidentsPage } from '../../views/incidents-page';
76

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

2726
before(() => {
2827
cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false });
29-
30-
cy.cleanupIncidentPrometheusRules();
28+
29+
cy.cleanupIncidentPrometheusRules();
3130

3231
// Create the alert and capture the random name
3332
cy.createKubePodCrashLoopingAlert().then((alertName) => {
@@ -41,24 +40,17 @@ describe('BVT: Incidents - e2e', { tags: ['@smoke', '@slow', '@incidents', '@e2e
4140
cy.log('1.1 Navigate to Incidents page and clear filters');
4241
incidentsPage.goTo();
4342
incidentsPage.clearAllFilters();
44-
43+
4544
const intervalMs = 60_000;
46-
const maxMinutes = 30;
45+
const maxMinutes = 30;
4746

4847
cy.log('1.2 Wait for incident with custom alert to appear');
49-
cy.waitUntil(
50-
() => incidentsPage.findIncidentWithAlert(currentAlertName),
51-
{
52-
interval: intervalMs,
53-
timeout: maxMinutes * intervalMs,
54-
}
55-
);
48+
cy.waitUntil(() => incidentsPage.findIncidentWithAlert(currentAlertName), {
49+
interval: intervalMs,
50+
timeout: maxMinutes * intervalMs,
51+
});
5652

5753
cy.log('1.3 Verify custom alert appears in alerts table');
58-
incidentsPage
59-
.elements
60-
.incidentsTable()
61-
.contains(currentAlertName)
62-
.should('exist');
54+
incidentsPage.elements.incidentsTable().contains(currentAlertName).should('exist');
6355
});
64-
});
56+
});

web/cypress/e2e/incidents/01.incidents.cy.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Natural creation of the alert is done in the 00.coo_incidents_e2e.cy.ts test,
88
but takes significant time.
99
*/
1010

11-
import { commonPages } from '../../views/common';
1211
import { incidentsPage } from '../../views/incidents-page';
1312

1413
const MCP = {
@@ -26,17 +25,11 @@ const MP = {
2625
operatorName: 'Cluster Monitoring Operator',
2726
};
2827

29-
const ALERTNAME = 'Watchdog';
30-
const NAMESPACE = 'openshift-monitoring';
31-
const SEVERITY = 'Critical';
32-
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.'
33-
const ALERT_SUMMARY = 'An alert that should always be firing to certify that Alertmanager is working properly.'
3428
describe('BVT: Incidents - UI', { tags: ['@smoke', '@incidents'] }, () => {
3529
before(() => {
3630
cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false });
3731
});
3832

39-
4033
beforeEach(() => {
4134
cy.log('Navigate to Observe → Incidents');
4235
incidentsPage.goTo();
@@ -49,7 +42,7 @@ describe('BVT: Incidents - UI', { tags: ['@smoke', '@incidents'] }, () => {
4942
incidentsPage.elements.toolbar().should('be.visible');
5043
incidentsPage.elements.toggleChartsButton().should('be.visible');
5144
incidentsPage.elements.toggleChartsButton().click();
52-
45+
5346
cy.log('1.2 Verify charts are hidden after toggle');
5447
incidentsPage.elements.incidentsChartTitle().should('not.exist');
5548
incidentsPage.elements.alertsChartTitle().should('not.exist');
@@ -59,7 +52,7 @@ describe('BVT: Incidents - UI', { tags: ['@smoke', '@incidents'] }, () => {
5952
it('2. Admin perspective - Incidents page - Days filter functionality', () => {
6053
cy.log('2.1 Set days filter to 3 days');
6154
incidentsPage.setDays('3 days');
62-
55+
6356
cy.log('2.2 Verify filter selection is updated');
6457
incidentsPage.elements.daysSelectToggle().should('contain.text', '3 days');
6558
});
@@ -68,19 +61,19 @@ describe('BVT: Incidents - UI', { tags: ['@smoke', '@incidents'] }, () => {
6861
cy.log('3.1 Clear filters and toggle Critical filter');
6962
incidentsPage.clearAllFilters();
7063
incidentsPage.toggleFilter('Critical');
71-
// Visibility verification of the filter chip is too complex. The functionality will be
64+
// Visibility verification of the filter chip is too complex. The functionality will be
7265
// better verified in the filtering specific test.
7366
cy.log('3.2 Verify filter can be removed');
7467
incidentsPage.removeFilter('Severity', 'Critical');
7568
});
7669

7770
it('4. Admin perspective - Incidents page - Charts and alerts empty state', () => {
7871
cy.mockIncidents([]);
79-
72+
8073
cy.log('4.1 Verify chart titles are visible');
8174
incidentsPage.elements.incidentsChartTitle().should('be.visible');
8275
incidentsPage.elements.alertsChartTitle().should('be.visible');
83-
76+
8477
cy.log('4.2 Verify alerts chart shows empty state');
8578
incidentsPage.elements.alertsChartEmptyState().should('exist');
8679
});
@@ -92,12 +85,14 @@ describe('BVT: Incidents - UI', { tags: ['@smoke', '@incidents'] }, () => {
9285
incidentsPage.findIncidentWithAlert('TargetAlert').should('be.false');
9386

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

98-
incidentsPage.clearAllFilters
93+
incidentsPage.clearAllFilters();
9994
cy.log('5.3 Verify traversing incident table works when the alert is present');
10095
cy.mockIncidentFixture('incident-scenarios/6-multi-incident-target-alert-scenario.yaml');
101-
incidentsPage.findIncidentWithAlert('TargetAlert').should('be.true');
96+
incidentsPage.findIncidentWithAlert('TargetAlert').should('be.true');
10297
});
103-
});
98+
});

web/cypress/e2e/incidents/02.incidents-mocking-example.cy.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ This test showcases different mocking approaches:
77
3. Demonstrating empty state handling
88
*/
99

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

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

2927
describe('Incidents - Mocking Examples', { tags: ['@demo', '@incidents'] }, () => {
30-
3128
before(() => {
3229
cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false });
3330
});
@@ -40,37 +37,43 @@ describe('Incidents - Mocking Examples', { tags: ['@demo', '@incidents'] }, () =
4037
it('1. Mock silenced and firing incidents with mixed severity', () => {
4138
cy.log('Setting up silenced critical and firing warning incidents');
4239
cy.mockIncidentFixture('incident-scenarios/silenced-and-firing-mixed-severity.yaml');
43-
44-
cy.log('One silenced critical incident (resolved) and one firing warning incident should be visible');
40+
41+
cy.log(
42+
'One silenced critical incident (resolved) and one firing warning incident should be visible',
43+
);
4544
cy.pause();
4645
});
4746

4847
it('2. Mock healthy cluster from fixture', () => {
4948
cy.log('Setting up healthy cluster scenario from fixture');
5049
cy.mockIncidentFixture('incident-scenarios/0-healthy-cluster.yaml');
51-
50+
5251
cy.pause();
5352
});
5453

5554
it('3. Mock single incident with critical and warning alerts', () => {
5655
cy.log('Setting up single incident with critical and warning alerts from fixture');
57-
cy.mockIncidentFixture('incident-scenarios/1-single-incident-firing-critical-and-warning-alerts.yaml');
56+
cy.mockIncidentFixture(
57+
'incident-scenarios/1-single-incident-firing-critical-and-warning-alerts.yaml',
58+
);
5859
cy.log('Single incident with mixed severity alerts should be visible');
5960
cy.pause();
6061
});
6162

6263
it('4. Mock multi-incidents with resolved and firing alerts', () => {
6364
cy.log('Setting up multi-incidents with resolved and firing alerts from fixture');
64-
cy.mockIncidentFixture('incident-scenarios/2-multi-incidents-multi-alerts-resolved-and-firing.yaml');
65-
65+
cy.mockIncidentFixture(
66+
'incident-scenarios/2-multi-incidents-multi-alerts-resolved-and-firing.yaml',
67+
);
68+
6669
cy.log('Multiple incidents with mixed alert states should be visible');
6770
cy.pause();
6871
});
6972

7073
it('5. Mock multi-severity overlapping incidents', () => {
7174
cy.log('Setting up multi-severity overlapping incidents from fixture');
7275
cy.mockIncidentFixture('incident-scenarios/3-multi-severity-overlapping-incidents.yaml');
73-
76+
7477
cy.log('Overlapping incidents with different severity distributions should be visible');
7578
cy.pause();
7679
});
@@ -81,15 +84,13 @@ describe('Incidents - Mocking Examples', { tags: ['@demo', '@incidents'] }, () =
8184

8285
cy.log('Single incident with escalating severity alerts should be visible');
8386
cy.pause();
84-
8587
});
8688

8789
it('7. Mock empty incident state', () => {
8890
cy.log('Setting up empty incident state');
8991
cy.mockIncidents([]);
90-
92+
9193
cy.log('No incidents should be visible - empty state');
9294
cy.pause();
9395
});
94-
95-
});
96+
});

0 commit comments

Comments
 (0)