Skip to content

Commit

Permalink
[REMOVEME][cypress/commands.js] Add "wait" for menuItems
Browse files Browse the repository at this point in the history
NOTE:  Pulling this in from another branch, but is already part of a
separate PR.  Just doing to help make CI "less red"

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`).
  • Loading branch information
NickLaMuro committed Jul 15, 2020
1 parent 45c3914 commit 87112fa
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down

0 comments on commit 87112fa

Please sign in to comment.