Skip to content

Commit

Permalink
Merge pull request #663 from KittyGiraudel/fix/cypress-13.7.1
Browse files Browse the repository at this point in the history
 Fix some Shadow DOM tests failing following a Cypress patch
  • Loading branch information
KittyGiraudel committed Apr 28, 2024
2 parents 50ba4b4 + b3e2464 commit 53094eb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
21 changes: 15 additions & 6 deletions cypress/e2e/focus.cy.js
Expand Up @@ -40,18 +40,27 @@ describe('Focus', { testIsolation: false }, () => {
cy.get('[data-a11y-dialog-show="shadow-dialog"]').click()

// Move focus into the dialog and ensure that the first focused element is a
// `<fancy-button>` element.
// the `<button>` element within the `<fancy-button>` element. Note: as of
// Cypress 13.7.1, the `.focused()` command properly return the active
// element of the shadow root for Shadow DOM.
// See: https://github.com/cypress-io/cypress/pull/29125/files
cy.realPress('Tab')
.focused()
.should('have.prop', 'tagName')
.should('eq', 'FANCY-BUTTON')
cy.get('[data-a11y-dialog="shadow-dialog"]')
.find('fancy-button')
.shadow()
.find('button')
.should('have.focus')

// Verify that focus goes backward into the `<fancy-card>` element. Within
// that, verify that the `<fancy-button>` element is focused.
// that, verify that the `<button>` element within the `<fancy-button>`
// element is focused.
cy.realPress(['Shift', 'Tab'])
.focused()
cy.get('[data-a11y-dialog="shadow-dialog"]')
.find('fancy-card')
.shadow()
.find('fancy-button')
.shadow()
.find('button')
.should('have.focus')

// Close the open dialog
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -40,7 +40,7 @@
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.4.0",
"@rollup/plugin-typescript": "^11.0.0",
"cypress": "^13.1.0",
"cypress": "^13.7.1",
"cypress-real-events": "^1.7.6",
"husky": "^9.0.11",
"lint-staged": "^15.0.1",
Expand Down

0 comments on commit 53094eb

Please sign in to comment.