Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Actual tests can be found in `cypress/integration/ui/`.

ManageIQ implements the following cypress extensions:

##### explorer

* `cy.accordion(title)` - open an accordion panel. title: String for the accordion title for the accordion panel to open.
* `cy.accordionItem(name)` - click on a record in the accordion panel. name: String for the record to click in the accordion panel.

##### login

`cy.login()` - logs in as admin
Expand Down
16 changes: 11 additions & 5 deletions cypress/support/commands/explorer.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
/* eslint-disable no-undef */
// cy.accordion('Catalog Items') - click accordion, unless already expanded
// title: String of the accordion title for the accordian panel to open.
Cypress.Commands.add('accordion', (text) => {
cy.get('#main-content'); // ensure screen loads first

cy.get('#main-content'); // ensure screen loads first
let ret = cy.get('#accordion')
.find('.panel-title a')
.contains(new RegExp(`^${text}$`));

ret.then((el) => {
// do not collapse if expanded
// Do not collapse if already expanded
if (el.is('.collapsed')) {
el.click();
el.trigger('click');
}
return el;
});

return ret.parents('.panel');
});

// name: String of the record in the accordion panel to click
Cypress.Commands.add('accordionItem', (name) => {
cy.get('#main-content'); // ensure screen loads first

cy.get('.list-group-item').contains(name).click();
});
1 change: 1 addition & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
// ***********************************************************

// Commands
import './commands/explorer.js'
import './commands/gtl.js'
import './commands/login.js'
import './commands/menu.js'
Expand Down