Skip to content

Commit 5008352

Browse files
authored
Merge pull request #9618 from asirvadAbrahamVarghese/enhance-toolbar-command
Updated to throw an error when the specified toolbar option is disabled
2 parents 2447372 + 9c32596 commit 5008352

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cypress/support/commands/toolbar.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ Cypress.Commands.add('toolbar', (toolbarButton, toolbarOption = '') => {
2121
// then look for the given toolbar option
2222
if (toolbarOption) {
2323
return clickToolbarButton.then(() => {
24-
return cy.get('.bx--overflow-menu-options li').then((toolbarOptions) => {
24+
return cy.get('.bx--overflow-menu-options li button').then((toolbarOptions) => {
2525
const targetToolbarOption = [...toolbarOptions].find(
2626
(option) => option.innerText.trim() === toolbarOption
2727
);
2828

2929
if (!targetToolbarOption) {
30-
cy.logAndThrowError(`"${toolbarOption}" option was not found in the "${toolbarButton}" toolbar`);
30+
cy.logAndThrowError(
31+
`"${toolbarOption}" option was not found in the "${toolbarButton}" toolbar`
32+
);
3133
}
3234
// returning the cypress chainable to the top of the command scope
3335
return cy.wrap(targetToolbarOption).click();

0 commit comments

Comments
 (0)