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
1 change: 1 addition & 0 deletions web/cypress/e2e/monitoring/00.bvt_admin.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe('BVT: Monitoring', { tags: ['@smoke', '@monitoring'] }, () => {
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
commonPages.titleShouldHaveText('Dashboards');
nav.sidenav.clickNavLink(['Observe', 'Targets']);
nav.sidenav.clickNavLink(['Observe', 'Targets']);
commonPages.titleShouldHaveText('Metrics targets');


Expand Down
2 changes: 1 addition & 1 deletion web/cypress/fixtures/perses/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ export enum persesDashboardsAcceleratorsCommonMetricsPanels {
TEMPERATURE_CELCIUS = 'Temperature (Celsius)',
SM_CLOCK_HERTZ = 'SM Clock (Hertz)',
MEMORY_CLOCK_HERTZ = 'Memory Clock (Hertz)',
}
}
140 changes: 91 additions & 49 deletions web/cypress/support/commands/utility-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ declare global {
changeNamespace(namespace: string): Chainable<Element>;
aboutModal(): Chainable<Element>;
podImage(pod: string, namespace: string): Chainable<Element>;
assertNamespace(namespace: string, exists: boolean): Chainable<Element>;
}
}
}
Expand Down Expand Up @@ -60,29 +61,51 @@ Cypress.Commands.add('waitUntilWithCustomTimeout', (
cy.log('Changing Namespace to: ' + namespace);
cy.wait(2000);
cy.get('body').then(($body) => {
const hasNamespaceBarDropdown = $body.find('[data-test-id="'+LegacyTestIDs.NamespaceBarDropdown+'"]').length > 0;
const hasNamespaceBarDropdown =
$body.find('[data-test-id="' + LegacyTestIDs.NamespaceBarDropdown + '"]').length > 0;
if (hasNamespaceBarDropdown) {
cy.byLegacyTestID(LegacyTestIDs.NamespaceBarDropdown).find('button').scrollIntoView().should('be.visible');
cy.byLegacyTestID(LegacyTestIDs.NamespaceBarDropdown).find('button').scrollIntoView().should('be.visible').click({force: true});
cy.byLegacyTestID(LegacyTestIDs.NamespaceBarDropdown)
.find('button')
.scrollIntoView()
.should('be.visible');
cy.byLegacyTestID(LegacyTestIDs.NamespaceBarDropdown)
.find('button')
.scrollIntoView()
.should('be.visible')
.click({ force: true });
} else {
cy.get(Classes.NamespaceDropdown).scrollIntoView().should('be.visible');
cy.get(Classes.NamespaceDropdown).scrollIntoView().should('be.visible').click({force: true});
cy.get(Classes.NamespaceDropdown)
.scrollIntoView()
.should('be.visible')
.click({ force: true });
}
});
cy.get('body').then(($body) => {
const hasShowSystemSwitch = $body.find('[data-test="'+DataTestIDs.NamespaceDropdownShowSwitch+'"]').length > 0;
const hasShowSystemSwitch =
$body.find('[data-test="' + DataTestIDs.NamespaceDropdownShowSwitch + '"]').length > 0;
if (hasShowSystemSwitch) {
cy.get('[data-test="'+DataTestIDs.NamespaceDropdownShowSwitch+'"]').then(($element)=> {
cy.get('[data-test="' + DataTestIDs.NamespaceDropdownShowSwitch + '"]').then(($element) => {
if ($element.attr('data-checked-state') !== 'true') {
cy.byTestID(DataTestIDs.NamespaceDropdownShowSwitch).siblings('span').eq(0).should('be.visible');
cy.byTestID(DataTestIDs.NamespaceDropdownShowSwitch).siblings('span').eq(0).should('be.visible').click({force: true});
cy.byTestID(DataTestIDs.NamespaceDropdownShowSwitch)
.siblings('span')
.eq(0)
.should('be.visible');
cy.byTestID(DataTestIDs.NamespaceDropdownShowSwitch)
.siblings('span')
.eq(0)
.should('be.visible')
.click({ force: true });
}
});
}
});
cy.byTestID(DataTestIDs.NamespaceDropdownTextFilter).type(namespace, {delay: 100});
cy.byTestID(DataTestIDs.NamespaceDropdownTextFilter).type(namespace, { delay: 100 });
cy.byTestID(DataTestIDs.NamespaceDropdownMenuLink).contains(namespace).should('be.visible');
cy.byTestID(DataTestIDs.NamespaceDropdownMenuLink).contains(namespace).should('be.visible').click({force: true});
cy.byTestID(DataTestIDs.NamespaceDropdownMenuLink)
.contains(namespace)
.should('be.visible')
.click({ force: true });
cy.log('Namespace changed to: ' + namespace);
});

Expand All @@ -95,50 +118,69 @@ Cypress.Commands.add('waitUntilWithCustomTimeout', (
cy.byAriaLabel('About modal').find('div[class*="co-select-to-copy"]').eq(0).should('be.visible').then(($ocpversion) => {
cy.log('OCP version: ' + $ocpversion.text());
});
cy.byAriaLabel('Close Dialog').should('be.visible').click();
}
cy.byAriaLabel('Close Dialog').should('be.visible').click();
}
});

});
Cypress.Commands.overwrite('log', (log, ...args) => {
if (Cypress.browser.isHeadless && Cypress.env('DEBUG')) {
// Log to the terminal using the custom task
return cy.task('log', args, { log: false }).then(() => {
// The original cy.log is still executed but its output is hidden from the
// command log in headless mode
return log(...args);
});
} else {
// In headed mode, use the original cy.log behavior
return log(...args);
}
});

Cypress.Commands.overwrite('log', (log, ...args) => {
if (Cypress.browser.isHeadless && Cypress.env('DEBUG')) {
// Log to the terminal using the custom task
return cy.task('log', args, { log: false }).then(() => {
// The original cy.log is still executed but its output is hidden from the
// command log in headless mode
return log(...args);
});
Cypress.Commands.add('podImage', (pod: string, namespace: string) => {
cy.log('Get pod image');
cy.switchPerspective('Core platform');
cy.clickNavLink(['Workloads', 'Pods']);
cy.byTestID('page-heading').contains('Pods').should('be.visible');
cy.changeNamespace(namespace);
// Check for DataViewFilters component using Cypress's built-in retry-ability
cy.get('body').then(($body) => {
const hasDataViewFilters = $body.find('[data-ouia-component-id="DataViewFilters"]').length > 0;
if (hasDataViewFilters) {
cy.get('[placeholder="Filter by name"]').scrollIntoView().should('be.visible').type(pod);
} else {
// In headed mode, use the original cy.log behavior
return log(...args);
cy.byTestID('name-filter-input').should('be.visible').type(pod);
}
});

Cypress.Commands.add('podImage', (pod: string, namespace: string) => {
cy.log('Get pod image');
cy.switchPerspective('Core platform');
cy.wait(5000);
cy.clickNavLink(['Workloads', 'Pods']);
cy.changeNamespace(namespace);
cy.byTestID('page-heading').contains('Pods').should('be.visible');
cy.wait(5000);
// Check for DataViewFilters component using Cypress's built-in retry-ability
cy.get('body').then(($body) => {
const hasDataViewFilters = $body.find('[data-ouia-component-id="DataViewFilters"]').length > 0;
if (hasDataViewFilters) {
cy.byOUIAID('DataViewFilters').find('button').contains('Status').scrollIntoView().should('be.visible').click();
cy.byOUIAID('OUIA-Generated-Menu').find('button').contains('Name').scrollIntoView().should('be.visible').click();
cy.get('[placeholder="Filter by name"]').scrollIntoView().should('be.visible').type(pod);
} else {
cy.byTestID('name-filter-input').should('be.visible').type(pod);
}
cy.get(`a[data-test^="${pod}"]`).eq(0).as('podLink').click();
cy.get('@podLink').should('be.visible').click();
cy.byPFRole('rowgroup').find('td').eq(1).scrollIntoView().should('be.visible').then(($td) => {
cy.log('Pod image: ' + $td.text());
});
cy.get(`a[data-test^="${pod}"]`).eq(0).as('podLink').click();
cy.get('@podLink').should('be.visible').click();
cy.byPFRole('rowgroup').find('td').eq(1).scrollIntoView().should('be.visible').then(($td) => {
cy.log('Pod image: ' + $td.text());
});
cy.log('Get pod image completed');
cy.log('Get pod image completed');
});

Cypress.Commands.add('assertNamespace', (namespace: string, exists: boolean) => {
cy.log('Asserting Namespace: ' + namespace + ' exists: ' + exists);
cy.get('body').then(($body) => {
const hasNamespaceBarDropdown =
$body.find('[data-test-id="' + LegacyTestIDs.NamespaceBarDropdown + '"]').length > 0;
if (hasNamespaceBarDropdown) {
cy.byLegacyTestID(LegacyTestIDs.NamespaceBarDropdown)
.find('button')
.scrollIntoView()
.should('be.visible');
cy.byLegacyTestID(LegacyTestIDs.NamespaceBarDropdown)
.find('button')
.scrollIntoView()
.should('be.visible')
.click({ force: true });
} else {
cy.get(Classes.NamespaceDropdown).scrollIntoView().should('be.visible');
cy.get(Classes.NamespaceDropdown)
.scrollIntoView()
.should('be.visible')
.click({ force: true });
}
});
});


118 changes: 61 additions & 57 deletions web/cypress/support/monitoring/00.bvt_monitoring.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,65 +20,68 @@ export function runBVTMonitoringTests(perspective: PerspectiveConfig) {

export function testBVTMonitoring(perspective: PerspectiveConfig) {

it(`${perspective.name} perspective - Alerting > Alerting Details page > Alerting Rule > Metrics`, () => {
cy.log('5.1. use sidebar nav to go to Observe > Alerting');
commonPages.titleShouldHaveText('Alerting');
listPage.tabShouldHaveText('Alerts');
listPage.tabShouldHaveText('Silences');
listPage.tabShouldHaveText('Alerting rules');
commonPages.linkShouldExist('Export as CSV');
commonPages.linkShouldExist('Clear all filters');
listPage.ARRows.shouldBeLoaded();

cy.log('5.2. filter Alerts and click on Alert');
listPage.filter.byName(`${WatchdogAlert.ALERTNAME}`);
listPage.ARRows.countShouldBe(1);
listPage.ARRows.ARShouldBe(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`, 1, 'Firing');
listPage.ARRows.expandRow();
listPage.ARRows.AShouldBe(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`, `${WatchdogAlert.NAMESPACE}`);
listPage.ARRows.clickAlert();

cy.log('5.3. click on Alert Details Page');
commonPages.titleShouldHaveText(`${WatchdogAlert.ALERTNAME}`);
commonPages.detailsPage.common(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`);
commonPages.detailsPage.alert(`${WatchdogAlert.ALERTNAME}`);

const timeIntervalValue = getValFromElement(`[data-ouia-component-id^="OUIA-Generated-TextInputBase"]`);
timeIntervalValue.then((value) => {
expect(value).to.not.be.empty;
it(
`${perspective.name} perspective - ` +
'Alerting > Alerting Details page > Alerting Rule > Metrics',
() => {
cy.log('5.1. use sidebar nav to go to Observe > Alerting');
commonPages.titleShouldHaveText('Alerting');
listPage.tabShouldHaveText('Alerts');
listPage.tabShouldHaveText('Silences');
listPage.tabShouldHaveText('Alerting rules');
commonPages.linkShouldExist('Export as CSV');
commonPages.linkShouldExist('Clear all filters');
listPage.ARRows.shouldBeLoaded();

cy.log('5.2. filter Alerts and click on Alert');
listPage.filter.byName(`${WatchdogAlert.ALERTNAME}`);
listPage.ARRows.countShouldBe(1);
listPage.ARRows.ARShouldBe(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`, 1, 'Firing');
listPage.ARRows.expandRow();
listPage.ARRows.AShouldBe(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`, `${WatchdogAlert.NAMESPACE}`);
listPage.ARRows.clickAlert();

cy.log('5.3. click on Alert Details Page');
commonPages.titleShouldHaveText(`${WatchdogAlert.ALERTNAME}`);
commonPages.detailsPage.common(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`);
commonPages.detailsPage.alert(`${WatchdogAlert.ALERTNAME}`);

const timeIntervalValue = getValFromElement(`[data-ouia-component-id^="OUIA-Generated-TextInputBase"]`);
timeIntervalValue.then((value) => {
expect(value).to.not.be.empty;
});

cy.log('5.4. click on Alert Rule link');
detailsPage.clickAlertRule(`${WatchdogAlert.ALERTNAME}`);
commonPages.titleShouldHaveText(`${WatchdogAlert.ALERTNAME}`);
commonPages.detailsPage.alertRule;
commonPages.detailsPage.common(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`);
cy.get(`[class="pf-v6-c-code-block__content"]`).invoke('text').then((expText) => {
cy.log(`${expText}`);
cy.wrap(expText).as('alertExpression');
});


cy.log('5.5. click on Alert Details Page');
detailsPage.clickAlertDesc(`${WatchdogAlert.ALERT_DESC}`);
commonPages.titleShouldHaveText(`${WatchdogAlert.ALERTNAME}`);
commonPages.detailsPage.common(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`);
commonPages.detailsPage.alert(`${WatchdogAlert.ALERTNAME}`);

cy.log('5.6. click on Inspect on Alert Details Page');
detailsPage.clickInspectAlertPage();

cy.log('5.7. Metrics page is loaded');
commonPages.titleShouldHaveText('Metrics');

cy.log('5.8. Assert Expression');
cy.get('[class="cm-line"]').should('be.visible');
cy.get(`@alertExpression`).then((expText) => {
cy.log(`${expText}`);
cy.get('[class="cm-line"]').invoke('text').should('equal', `${expText}`);
});
});

cy.log('5.4. click on Alert Rule link');
detailsPage.clickAlertRule(`${WatchdogAlert.ALERTNAME}`);
commonPages.titleShouldHaveText(`${WatchdogAlert.ALERTNAME}`);
commonPages.detailsPage.alertRule;
commonPages.detailsPage.common(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`);
cy.get(`[class="pf-v6-c-code-block__content"]`).invoke('text').then((expText) => {
cy.log(`${expText}`);
cy.wrap(expText).as('alertExpression');
});


cy.log('5.5. click on Alert Details Page');
detailsPage.clickAlertDesc(`${WatchdogAlert.ALERT_DESC}`);
commonPages.titleShouldHaveText(`${WatchdogAlert.ALERTNAME}`);
commonPages.detailsPage.common(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`);
commonPages.detailsPage.alert(`${WatchdogAlert.ALERTNAME}`);

cy.log('5.6. click on Inspect on Alert Details Page');
detailsPage.clickInspectAlertPage();

cy.log('5.7. Metrics page is loaded');
commonPages.titleShouldHaveText('Metrics');

cy.log('5.8. Assert Expression');
cy.get('[class="cm-line"]').should('be.visible');
cy.get(`@alertExpression`).then((expText) => {
cy.log(`${expText}`);
cy.get('[class="cm-line"]').invoke('text').should('equal', `${expText}`);
});
});

it(`${perspective.name} perspective - Creates and expires a Silence`, () => {
cy.log('6.1 filter to Watchdog alert');
nav.tabs.switchTab('Alerts');
Expand Down Expand Up @@ -147,6 +150,7 @@ export function testBVTMonitoring(perspective: PerspectiveConfig) {
cy.log('6.8 verify on Alerting Rules list page again');
nav.sidenav.clickNavLink(['Observe', 'Alerting']);
nav.tabs.switchTab('Alerting rules');

listPage.filter.byName(`${WatchdogAlert.ALERTNAME}`);
alertingRuleListPage.ARShouldBe(`${WatchdogAlert.ALERTNAME}`, `${WatchdogAlert.SEVERITY}`, 1, AlertsAlertState.SILENCED);

Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/monitoring/02.reg_metrics_1.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export function testMetricsRegression1(perspective: PerspectiveConfig) {
metricsPage.clickActionsDeleteAllQueries();
metricsPage.clickPredefinedQuery(MetricsPagePredefinedQueries.CPU_USAGE);
metricsPage.graphCardInlineInfoAssertion(true);
metricsPage.clickGraphTimespanDropdown(GraphTimespan.ONE_WEEK);
metricsPage.clickGraphTimespanDropdown(GraphTimespan.TWO_WEEKS);
metricsPage.graphCardInlineInfoAssertion(false);

cy.log('4.6 Reset Zoom Button');
Expand Down
5 changes: 0 additions & 5 deletions web/cypress/support/monitoring/03.reg_legacy_dashboards.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,11 @@ export function testLegacyDashboardsRegression(perspective: PerspectiveConfig) {
listPage.ARRows.clickAlertingRule();
commonPages.titleShouldHaveText(`${WatchdogAlert.ALERTNAME}`);
alertingRuleDetailsPage.clickHideGraphButton();
cy.wait(2000);
cy.byTestID(DataTestIDs.MetricGraph).should('not.exist');
alertingRuleDetailsPage.clickShowGraphButton();
cy.wait(2000);
cy.byTestID(DataTestIDs.MetricGraph).should('be.visible');
cy.wait(2000);
alertingRuleDetailsPage.clickHideGraphButton();
cy.wait(2000);
cy.byTestID(DataTestIDs.MetricGraph).should('not.exist');
cy.wait(2000);

cy.log('4.4 Observe > Alert details - Verify graph is visible');
cy.byTestID(DataTestIDs.AlertResourceLink).first().click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { alertingRuleDetailsPage } from '../../views/alerting-rule-details-page'
import { alerts } from '../../fixtures/monitoring/alert';
import { listPage } from '../../views/list-page';
import { commonPages } from '../../views/common';
import { guidedTour } from '../../views/tour';

export interface PerspectiveConfig {
name: string;
Expand Down Expand Up @@ -61,9 +60,6 @@ export function testLegacyDashboardsRegressionNamespace(perspective: Perspective

it(`${perspective.name} perspective - Dashboards (legacy) - No kebab dropdown`, () => {
cy.log('3.1 Single Stat - No kebab dropdown');
cy.visit('/');
guidedTour.close();
cy.validateLogin();
nav.sidenav.clickNavLink(['Observe', 'Dashboards']);
commonPages.titleShouldHaveText('Dashboards');
cy.changeNamespace('openshift-monitoring');
Expand Down
1 change: 0 additions & 1 deletion web/cypress/views/alerting-rule-list-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const alertingRuleListPage = {
throw error;
}
},

},

clickAlertingRule: (alertRule: string) => {
Expand Down
Loading