UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit 36102f48 authored by Jimmy Bourque's avatar Jimmy Bourque
Browse files

Initial commit after updating cypress and gluon

parent 3aad8800
No related branches found
No related tags found
1 merge request!52Cypress updates
No preview for this file type
module.exports = {
defaultCommandTimeout: 12000,
screenshot: true,
screenshotOnRunFailure: true,
video: true,
videoCompression: 35,
e2e: {
supportFile: false,
testIsolation: false,
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
};
\ No newline at end of file
// Loads a dashboard and validates title
Cypress.Commands.add('loaddashboard', (name) => {
cy.intercept('POST', '**/query*').as('apiQuery')
cy.get('input[placeholder="Search for dashboards and folders"]').type(name)
cy.get('a[title="' + name + '"]').click()
cy.wait('@apiQuery', {timeout: 30000}).then((interception) => {
expect(interception.response.statusCode).to.equal(200);
})
console.log('Loaded Dashboard for ' + name)
cy.get('title').contains(name)
})
// Validates panel data should not be zero
Cypress.Commands.add('panelnotzero', (name) => {
cy.get('[data-testid="data-testid Panel header ' + name + '"]')
......@@ -19,12 +7,7 @@ Cypress.Commands.add('panelnotzero', (name) => {
// Log in
before (function() {
cy.visit(Cypress.env('grafana_url'))
cy.get('input[name="user"]')
.type('admin')
cy.get('input[name="password"]')
.type('prom-operator')
cy.contains("Log in").click()
cy.get('.page-dashboard').contains('Welcome', {timeout: 30000})
cy.performGrafanaLogin(Cypress.env('grafana_user'), Cypress.env('grafana_pass'))
})
// Save cookies so we don't have to log in again
......@@ -39,24 +22,23 @@ describe('Validate Grafana Dashboards', {
}, () => {
if (Cypress.env("check_datasource")) {
it('Validate Cluster Policy Report Details Dashboard', () => {
cy.loaddashboard('ClusterPolicyReport Details')
cy.loadGrafanaDashboard("ClusterPolicyReport Details")
cy.panelnotzero('Policy Pass Status')
cy.panelnotzero('Policy Fail Status')
})
it('Validate Policy Report Details Dashboard', () => {
cy.loaddashboard('PolicyReport Details')
cy.loadGrafanaDashboard("PolicyReport Details")
cy.panelnotzero('Policy Pass Status')
cy.panelnotzero('Policy Fail Status')
})
it('Validate Policy Reports Dashboard', () => {
cy.loaddashboard('PolicyReports')
cy.loadGrafanaDashboard("PolicyReports")
cy.panelnotzero('Failing ClusterPolicies')
})
}
})
// Clear cookies to force login again
after(() => {
Cypress.session.clearCurrentSessionData
cy.clearAllUserData()
})
\ No newline at end of file
......@@ -770,5 +770,7 @@ bbtests:
envs:
cypress_grafana_url: http://grafana.monitoring.svc.cluster.local
cypress_prometheus_url: http://monitoring-kube-prometheus-prometheus.monitoring.svc.cluster.local:9090
cypress_grafana_user: "admin"
cypress_grafana_pass: "prom-operator"
cypress_reporter_ns: kyverno-reporter
volumes: []
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment