From 23ce885022ad193710fef7234426225e5714a123 Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Wed, 8 Jul 2020 20:43:46 -0500 Subject: [PATCH] [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 e5f6a7e1a9ed..f2f15b9fd86d 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); });