Skip to content

Commit e70aeed

Browse files
authored
Merge pull request #9538 from asirvadAbrahamVarghese/update-readme-expect_alerts
Updated README and method-level docs for expect_alert commands
2 parents b39c4f0 + 16ec673 commit e70aeed

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

cypress/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,5 @@ ManageIQ implements the following cypress extensions:
6969
* `cy.expect_show_list_title(title)` - check the title on a show\_list screen matches the provided title. `title`: String for the title.
7070
* `cy.expect_search_box()` - check if searchbox is present on the screen.
7171
* `cy.expect_text(element, text)` - check if the text in the element found by doing cy.get on the element String matches the provided text. `element`: String for the Cypress selector to get a specific element on the screen. `text`: String for the text that should be found within the selected element.
72+
* `cy.expect_flash(flashType, containsText)` - command to validate flash messages. `flashType` is the type of flash (success, warning, error, info). `containsText` is the optional text that the flash-message should contain. e.g. `expect_flash('warning', 'cancelled');`
73+
* `cy.expect_browser_confirm_with_text({ confirmTriggerFn, containsText, proceed })` - command to validate browser confirm alerts. `confirmTriggerFn` is the function that triggers the confirm dialog. This function **must return a Cypress.Chainable**, like `cy.get(...).click()` so that Cypress can properly wait and chain .then() afterward. `containsText` is the optional text that the confirm alert should contain. `proceed` is the flag to determine whether to proceed with the confirm (true = OK, false = Cancel). e.g. `cy.expect_browser_confirm_with_text({containsText: 'sure to proceed?', proceed: true, confirmTriggerFn: () => { return cy.get('[data-testid="delete"]').click()}});`, `cy.expect_browser_confirm_with_text({ confirmTriggerFn: () => cy.contains('deleted').click()});`

cypress/support/assertions/expect_alerts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ Cypress.Commands.add(
3939
* This function **must return a Cypress.Chainable**, like `cy.get(...).click()`,
4040
* so that Cypress can properly wait and chain `.then()` afterward.
4141
* @example
42-
* cy.expectBrowserConfirm({
42+
* cy.expect_browser_confirm_with_text({
4343
* containsText: 'sure to proceed?',
4444
* proceed: true,
4545
* confirmTriggerFn: () => {
4646
* return cy.get('[data-testid="delete"]').click()
4747
* }
4848
* });
4949
* @example
50-
* cy.expectBrowserConfirm({
50+
* cy.expect_browser_confirm_with_text({
5151
* confirmTriggerFn: () => cy.contains('deleted').click()
5252
* });
5353
* @param {string} [options.containsText] - Optional text that the confirm alert should contain.

0 commit comments

Comments
 (0)