-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support shadow DOM recursive selectors inside cypress snapshots sent to protocol #28823
Conversation
I also looked into possibly supporting the shadow DOM for snapshots in open mode in a68faa5, which could be used to address #8843. The trick is we need to hydrate the shadow DOM state after a given snapshot from the actual body reference, which means iterating through and cloning the shadow DOM elements. In addition, this has basic support for adoptedStyleSheets. Since we cant created shadow dom snapshots not workingshadow dom snapshots working |
1 failed and 8 flaky tests on run #54477 ↗︎
Details:
cypress/e2e/create-react-app.cy.ts • 1 failed test • webpack-dev-server
specs_list_latest_runs.cy.ts • 1 flaky test • app-e2e
project-setup.cy.ts • 1 flaky test • launchpad-e2e
commands/waiting.cy.js • 1 flaky test • 5x-driver-chrome
e2e/origin/commands/waiting.cy.ts • 1 flaky test • 5x-driver-chrome
e2e/origin/basic_login.cy.ts • 1 flaky test • 5x-driver-firefox
|
f297e42
to
1f580df
Compare
191e8a3
to
2bddb6d
Compare
…lement scroll containers
…tyleSheet to help create scrollbox throws illegal constructor
…om traversal similar to axe-core [run ci]
5f31493
to
e0a6e9d
Compare
…rder to capture nested shadow DOM inputs
e0a6e9d
to
1dc0e9b
Compare
|
||
it('does not have cypress errors when visiting closed shadow roots', () => { | ||
cy.visit('cypress/fixtures/shadow-dom-closed.html') | ||
cy.get('#in-shadow', { includeShadowDom: true }).should('not.exist') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test is likely a good add to make sure we don't introduce something that could cause the app to implode if a closed shadow root is inside the AUT
system-tests/projects/protocol/cypress/fixtures/shadow-dom-closed.html
Outdated
Show resolved
Hide resolved
@ryanthemanuel @mschile not sure if we want to make this a |
I'd make it a feature. We've called out Test Replay functionality changes before in that regard. |
…tocol_shadow_dom_support
…tocol_shadow_dom_support
…-io/cypress into feat/protocol_shadow_dom_support
…tocol_shadow_dom_support
…tocol_shadow_dom_support
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Additional details
This PR changes the expected structure of
elementsToHighlight
in the snapshot code to support shadowDom.Instead of just returning a
selector
key with aframeId
, the JSON structure now follows an array structure of selectors, starting with the first index being the node element that lives inside the root document, while the last element is the node contained inside the shadow DOM. Any element in between is a shadow DOM host element where the document/ shadow DOM ends and the next shadowDOM begins. This is in order to support N layers deep of shadow DOM.That structure would look something like this:
In the event an element is not within the shadow DOM (i.e. what is supported today), the structure might look something like this:
Steps to test
E2E tests inside the driver have been added to verify the new snapshot structure, as well as a system test in the
protocol
code to make sure the correct structure is generated.For the scroll behavior, only an E2E test was added to verify the happy path.
How has the user experience changed?
PR Tasks
cypress-documentation
? N/Atype definitions
? N/A