Skip to content

Commit

Permalink
Merge pull request #2276 from gouyang/check_more_pages
Browse files Browse the repository at this point in the history
Verify various tabs and examples under Virtualiztion
  • Loading branch information
openshift-merge-bot[bot] authored Dec 3, 2024
2 parents 4a9b25f + 1ead897 commit c0b910f
Show file tree
Hide file tree
Showing 16 changed files with 406 additions and 256 deletions.
4 changes: 3 additions & 1 deletion cypress/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"rules": {
"chai-friendly/no-unused-expressions": "off",
"cypress/assertion-before-screenshot": "error",
"cypress/no-force": "error"
"cypress/no-force": "error",
"cypress/no-unnecessary-waiting": "off",
"cypress/unsafe-to-chain-command": "off"
}
}
4 changes: 2 additions & 2 deletions cypress/cypress.config.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const { defineConfig } = require('cypress');

module.exports = defineConfig({
defaultCommandTimeout: 15000,
defaultCommandTimeout: 30000,
e2e: {
// We've imported your old cypress plugins here.
baseUrl: process.env.BRIDGE_BASE_ADDRESS,
Expand All @@ -24,7 +24,7 @@ module.exports = defineConfig({
},
retries: {
openMode: 0,
runMode: 0,
runMode: 3,
},
screenshotOnRunFailure: true,
screenshotsFolder: './gui-test-screenshots/screenshots/',
Expand Down
9 changes: 9 additions & 0 deletions cypress/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ Cypress.on('uncaught:exception', () => {
});

Cypress.Cookies.debug(true);

// ignore fetch in command log
const origLog = Cypress.log;
Cypress.log = function (opts, ...other) {
if (opts.displayName === 'fetch') {
return;
}
return origLog(opts, ...other);
};
1 change: 1 addition & 0 deletions cypress/support/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Cypress.Commands.add('login', (provider: string, username: string, password: str
// Make sure we clear the cookie in case a previous test failed to logout.
cy.clearCookie('openshift-session-token');

cy.get('[data-test-id=login]', { timeout: 30000 }).should('be.visible');
const idp = provider || KUBEADMIN_IDP;
cy.task('log', ` Logging in as ${username || KUBEADMIN_USERNAME}`);
cy.byLegacyTestID('login').should('be.visible');
Expand Down
54 changes: 38 additions & 16 deletions cypress/support/nav.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,65 @@
import './selectors';

import { catalogNav, overviewNav, resourceTitle, templateNav, vmNav } from '../views/selector';
import * as nav from '../views/selector';

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface Chainable {
visitCatalog(): void;
visitCheckups(): void;
visitITs(): void;
visitMPs(): void;
visitOverview(): void;
visitPreferences(): void;
visitTemplates(): void;
visitVMs(): void;
visitVolumes(): void;
}
}
}

Cypress.Commands.add('visitOverview', () => {
cy.clickVirtLink(overviewNav);
cy.contains(resourceTitle, 'Virtualization').should('be.visible');
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000);
cy.clickVirtLink(nav.overviewNav);
cy.contains(nav.resourceTitle, 'Virtualization').should('be.visible');
});

Cypress.Commands.add('visitCatalog', () => {
cy.clickVirtLink(catalogNav);
cy.clickVirtLink(nav.catalogNav);
cy.contains('Create new VirtualMachine').should('be.visible');
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000);
});

Cypress.Commands.add('visitVMs', () => {
cy.clickVirtLink(vmNav);
cy.contains(resourceTitle, 'VirtualMachines').should('be.visible');
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000);
cy.clickVirtLink(nav.vmNav);
cy.contains(nav.resourceTitle, 'VirtualMachines').should('be.visible');
});

Cypress.Commands.add('visitTemplates', () => {
cy.clickVirtLink(templateNav);
cy.contains(resourceTitle, 'VirtualMachine Templates').should('be.visible');
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000);
cy.clickVirtLink(nav.templateNav);
cy.contains(nav.resourceTitle, 'VirtualMachine Templates').should('be.visible');
});

Cypress.Commands.add('visitITs', () => {
cy.clickVirtLink(nav.itNav);
cy.byLegacyTestID('cx1.2xlarge').should('exist');
});

Cypress.Commands.add('visitPreferences', () => {
cy.clickVirtLink(nav.preferenceNav);
cy.byLegacyTestID('fedora').should('exist');
});

Cypress.Commands.add('visitVolumes', () => {
cy.clickVirtLink(nav.volumeNav);
cy.contains(nav.resourceTitle, 'Bootable volumes').should('be.visible');
});

Cypress.Commands.add('visitMPs', () => {
cy.clickVirtLink(nav.mpNav);
cy.contains(nav.resourceTitle, 'MigrationPolicies').should('be.visible');
});

Cypress.Commands.add('visitCheckups', () => {
cy.clickVirtLink(nav.checkupNav);
cy.contains(nav.resourceTitle, 'Checkups').should('be.visible');
});
2 changes: 2 additions & 0 deletions cypress/tests/all.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import './e2e/login.cy.ts';
import './e2e/check-tab-yaml.cy.ts';
23 changes: 0 additions & 23 deletions cypress/tests/catalog/create-vm-from-catalog.cy.ts

This file was deleted.

62 changes: 0 additions & 62 deletions cypress/tests/catalog/filter.cy.ts

This file was deleted.

100 changes: 0 additions & 100 deletions cypress/tests/check-tabs.cy.ts

This file was deleted.

Loading

0 comments on commit c0b910f

Please sign in to comment.