From 9d7bee7ceda842d256feffeb6269e357e86b1c84 Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Wed, 8 Jul 2020 20:43:46 -0500 Subject: [PATCH 1/2] [cypress/commands.js] Add "wait" for menuItems By using a `cy.get` with this command, it forces a `wait` for the DOM to load with the menu. Using `cy.window` doesn't (seem to) do that. This probably could be smaller, but this is a workaround to fix the currently breaking tests using this method (currently only `menu.spec.js`). --- cypress/support/commands.js | 1 + 1 file changed, 1 insertion(+) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index e5f6a7e1a9e..f2f15b9fd86 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -70,6 +70,7 @@ Cypress.Commands.add("menu", (...items) => { // cy.menuItems() - returns an array of top level menu items with {title, href, items (array of children)} Cypress.Commands.add("menuItems", () => { + cy.get('#main-menu nav.primary'); // Wait for menu to appear return cy.window().then((window) => window.ManageIQ.menu); }); From 95de4e6dbbdf4c7bcd14923cdc59961b64a3ff57 Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Thu, 9 Jul 2020 20:33:55 -0500 Subject: [PATCH 2/2] [menu.spec.js] Fix bad menu navigations Clicking top level menu items is no longer supported with the Carbon styles, so fixing the specs to better reflect the current functionality, or commenting out places where it isn't valid. Most likely broken because of these changes: https://github.com/ManageIQ/manageiq-ui-classic/pull/6963 --- cypress/integration/ui/menu.spec.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/cypress/integration/ui/menu.spec.js b/cypress/integration/ui/menu.spec.js index 7b7d534837f..0f6a064d32c 100644 --- a/cypress/integration/ui/menu.spec.js +++ b/cypress/integration/ui/menu.spec.js @@ -14,24 +14,20 @@ describe('Menu', () => { expect(menu[2].items[1].items[3].title).to.equal('Virtual Machines'); }); - cy.menu('Overview') + cy.menu('Overview', 'Dashboard') .get('widget-wrapper'); - cy.menu('Services') + cy.menu('Overview', 'Reports') + .expect_explorer_title('All Saved Reports'); + + cy.menu('Services', 'My Services') .expect_explorer_title('Active Services'); - cy.menu('Compute') + cy.menu('Compute', 'Clouds', 'Providers') .expect_show_list_title('Cloud Providers'); - cy.menu('Overview', 'Reports') - .expect_explorer_title('All Saved Reports'); - cy.menu('Compute', 'Infrastructure', 'Virtual Machines') .expect_explorer_title('All VMs & Templates'); - - // test it remembers the last Overview > * screen used - cy.menu('Overview') - .expect_explorer_title('All Saved Reports'); }); it.skip("all menu items lead to non-error screens", () => {