Skip to content

Commit

Permalink
mgr/dashboard: upgrade to cypress 12
Browse files Browse the repository at this point in the history
Looks like chrome 117 will need cypress >=12.15.0
cypress-io/cypress-documentation#5479

Signed-off-by: Nizamudeen A <nia@redhat.com>
  • Loading branch information
nizamial09 committed Sep 26, 2023
1 parent e2626fb commit 630ba3a
Show file tree
Hide file tree
Showing 6 changed files with 13,721 additions and 15,657 deletions.
27 changes: 20 additions & 7 deletions src/pybind/mgr/dashboard/frontend/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'cypress'
import { defineConfig } from 'cypress';

export default defineConfig({
video: true,
Expand All @@ -9,34 +9,47 @@ export default defineConfig({
viewportWidth: 1920,
projectId: 'k7ab29',
reporter: 'cypress-multi-reporters',

reporterOptions: {
reporterEnabled: 'spec, mocha-junit-reporter',
mochaJunitReporterReporterOptions: {
mochaFile: 'cypress/reports/results-[hash].xml',
},
mochaFile: 'cypress/reports/results-[hash].xml'
}
},

retries: 1,

env: {
LOGIN_USER: 'admin',
LOGIN_PWD: 'admin',
CEPH2_URL: 'https://localhost:4202/',
CEPH2_URL: 'https://localhost:4202/'
},

chromeWebSecurity: false,
eyesIsDisabled: false,
eyesFailCypressOnDiff: true,
eyesDisableBrowserFetching: false,
eyesLegacyHooks: true,
eyesTestConcurrency: 5,
eyesPort: 35321,

e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
return require('./cypress/plugins/index.js')(on, config);
},
baseUrl: 'https://localhost:4200/',
excludeSpecPattern: ['*.po.ts', '**/orchestrator/**'],
experimentalSessionAndOrigin: true,
specPattern: 'cypress/e2e/**/*-spec.{js,jsx,ts,tsx,feature}',
specPattern: 'cypress/e2e/**/*-spec.{js,jsx,ts,tsx,feature}'
},
})

component: {
devServer: {
framework: 'angular',
bundler: 'webpack'
},
specPattern: '**/*.cy.ts'
}
});
49 changes: 28 additions & 21 deletions src/pybind/mgr/dashboard/frontend/cypress/e2e/cluster/logs.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@ export class LogsPageHelper extends PageHelper {
cy.contains('.nav-link', 'Audit Logs').click();

// Enter an earliest time so that no old messages with the same pool name show up
cy.get('.ngb-tp-input').its(0).clear();
cy.get('.ngb-tp-input')
.its(0)
.then((input) => {
cy.wrap(input).clear();

if (hour < 10) {
cy.get('.ngb-tp-input').its(0).type('0');
}
cy.get('.ngb-tp-input').its(0).type(`${hour}`);
if (hour < 10) cy.wrap(input).type(`${hour}`);
});

cy.get('.ngb-tp-input').its(1).clear();
if (minute < 10) {
cy.get('.ngb-tp-input').its(1).type('0');
}
cy.get('.ngb-tp-input').its(1).type(`${minute}`);
cy.get('.ngb-tp-input')
.its(1)
.then((input) => {
cy.wrap(input).clear();

if (minute < 10) cy.wrap(input).type(`${minute}`);
});

// Enter the pool name into the filter box
cy.get('input.form-control.ng-valid').first().clear().type(poolname);
Expand All @@ -46,17 +49,21 @@ export class LogsPageHelper extends PageHelper {
cy.contains('.nav-link', 'Audit Logs').click();

// Enter an earliest time so that no old messages with the same config name show up
cy.get('.ngb-tp-input').its(0).clear();
if (hour < 10) {
cy.get('.ngb-tp-input').its(0).type('0');
}
cy.get('.ngb-tp-input').its(0).type(`${hour}`);

cy.get('.ngb-tp-input').its(1).clear();
if (minute < 10) {
cy.get('.ngb-tp-input').its(1).type('0');
}
cy.get('.ngb-tp-input').its(1).type(`${minute}`);
cy.get('.ngb-tp-input')
.its(0)
.then((input) => {
cy.wrap(input).clear();

if (hour < 10) cy.wrap(input).type(`${hour}`);
});

cy.get('.ngb-tp-input')
.its(1)
.then((input) => {
cy.wrap(input).clear();

if (minute < 10) cy.wrap(input).type(`${minute}`);
});

// Enter the config name into the filter box
cy.get('input.form-control.ng-valid').first().clear().type(configname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Notification page', () => {
notification.getTasks().contains(poolName).should('exist');

// Delete pool after task is complete (otherwise we get an error).
notification.getTasks().contains(poolName, { timeout: 300000 }).should('not.exist');
notification.getTasks().should('not.exist');
});

it('should have notifications', () => {
Expand Down
10 changes: 8 additions & 2 deletions src/pybind/mgr/dashboard/frontend/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,14 @@ function requestAuth(username: string, password: string, url = '') {
}

// @ts-ignore
Cypress.Commands.add('text', { prevSubject: true }, (subject: any) => {
return subject.text();
Cypress.Commands.add('text', { prevSubject: true }, ($element: JQuery<HTMLElement>) => {
cy.wrap($element).scrollIntoView();
return cy
.wrap($element)
.invoke('text')
.then((text: string) => {
return text.toString();
});
});

Cypress.Commands.add('logToConsole', (message: string, optional?: any) => {
Expand Down
Loading

0 comments on commit 630ba3a

Please sign in to comment.