diff --git a/cypress/e2e/nestedDialogs.cy.js b/cypress/e2e/nestedDialogs.cy.js index 23c5e521..2ff44c07 100644 --- a/cypress/e2e/nestedDialogs.cy.js +++ b/cypress/e2e/nestedDialogs.cy.js @@ -13,15 +13,15 @@ describe('Nested dialogs', () => { }) it('should close only the top most dialog when pressing ESC', () => { - cy.get('body').trigger('keydown', { key: 'Escape', keyCode: 27, which: 27 }) + cy.realPress('Escape') cy.get('[data-a11y-dialog="dialog-2"]').then(shouldBeVisible) cy.get('[data-a11y-dialog="dialog-3"]').then(shouldBeHidden) }) it('should close only the top most dialog when clicking the backdrop', () => { - cy.get('body').trigger('keydown', { key: 'Escape', keyCode: 27, which: 27 }) cy.get('[data-a11y-dialog="dialog-2"]') .find('.dialog-overlay') + .first() .click({ force: true }) cy.get('[data-a11y-dialog="dialog-1"]').then(shouldBeVisible) cy.get('[data-a11y-dialog="dialog-2"]').then(shouldBeHidden) diff --git a/cypress/fixtures/nested-dialogs.html b/cypress/fixtures/nested-dialogs.html index 3400d871..964b58b4 100644 --- a/cypress/fixtures/nested-dialogs.html +++ b/cypress/fixtures/nested-dialogs.html @@ -21,28 +21,27 @@

Tests — Nested dialogs

Dialog 1

- -