Skip to content
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

Cypress doesn't see shadow-root (user-agent) with pseudo elements #26383

Closed
przedab opened this issue Mar 31, 2023 · 17 comments
Closed

Cypress doesn't see shadow-root (user-agent) with pseudo elements #26383

przedab opened this issue Mar 31, 2023 · 17 comments
Labels
E2E Issue related to end-to-end testing Reproducible Can be reproduced stale no activity on this issue for a long period topic: shadow dom Issues when testing shadow dom type: bug

Comments

@przedab
Copy link

przedab commented Mar 31, 2023

Current behavior

Cypress doesn't see a shadow-root (user-agent) and I can't get access to pseudo elements inside a root.

AssertionError: Timed out retrying after 4000ms: Expected the subject to host a shadow root, but never found it.

Cypress:
image

Manually:
image

Desired behavior

Make access to pseudo-elements inside the shadow-root (user agent).

Test code to reproduce

describe("shadow_root_user_agent", () => {
  it("access_to_pseudo_elements", () => {
    // visit google player site
    cy.visit("https://googleads.github.io/googleads-ima-html5/vsi/");
    // get a pseudo element inside a shadow-root (user-agent)
    cy.get("#h5-player")
      .shadow()
      .find('div[pseudo="-webkit-media-controls"]')
      .should("exist");
  });
});

Repository with simple test

Cypress Version

12.9.0

Node version

18.6.0

Operating System

Win 10

Debug Logs

No response

Other

No response

@astone123 astone123 added topic: shadow dom Issues when testing shadow dom routed-to-e2e labels Apr 5, 2023
@astone123
Copy link
Contributor

@przedab thanks for the reproduction. I'm not sure why this is happening. Routing to our e2e team

@astone123 astone123 removed their assignment Apr 5, 2023
@nagash77 nagash77 added E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. and removed routed-to-e2e labels Apr 19, 2023
@ajdinmust
Copy link

ajdinmust commented Apr 20, 2023

I have the same issue

image

@ozee
Copy link

ozee commented Apr 24, 2023

I am also hitting the same issue with lit and component testing.

@Knack-Mehul
Copy link

Any updates on this error, I am also facing the same issue.

@jcdvera
Copy link

jcdvera commented Jun 22, 2023

I am facing the same error, is there any update on this issue, or a workaround?

@przedab
Copy link
Author

przedab commented Aug 7, 2023

Any update ?

@tymsam
Copy link

tymsam commented Sep 7, 2023

The issue still occurs! Please look into that :)

@Jaq112
Copy link

Jaq112 commented Sep 15, 2023

Any updates on this?

@hansyohan
Copy link

Any update on this one?

@hansyohan
Copy link

Any update on this one?

This somehow "solved" it when headed.
https://www.youtube.com/watch?v=Si7PBh7cBZI

I'm not sure how it will go when headless...

@JulienMalcouronne
Copy link

Hello is there any update on this issue ?

@zagnut007
Copy link

So I've personally solved this issue that was happening for myself. I have some guesses as to what was happening.

I was seeing this issue in CircleCI with the latest version of Stencil and Cypress 12.16.x

First thing to note: the issue would go away when running Cypress 13.6, but then the StencilJS hydrate command wouldn't generate a functioning /hydrate/index.js. My best guess here is one of the dependancies of Cypress 13.6 conflicts with a version of the same dependency used by StencilJS. So I couldn't push Cypress higher than 12.16.x to get the hydrate to work correctly.

What I found is when I used the Date API from inside of a Stencil component utilizing the FunctionalComponent style, it would "break" the bundle and cause the timeout error on a completely unrelated Cypress test.

The fix was the move my Date API calls to the class-style component and only pass the formatted date as a string to the functional-style component and now everything is passing Cypress correctly.

My guess here is something in the bundling of functional-style components during the StencilJS build doesn't jive with what Cypress is expecting in the JS distribution and it ends up waiting for a browser API call that will never complete.

@cecchettisilva
Copy link

cecchettisilva commented Dec 20, 2023

Hello 4all!

I solve the problem, using this article: https://dzone.com/articles/exploring-shadow-dom-with-examples-using-cypress

I use the: Approach 2: Using the includeShadowDom Flag in Config

Version Cypress: v12.14.0

@jennifer-shehane jennifer-shehane added Reproducible Can be reproduced type: bug and removed Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. labels Jan 2, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Jul 1, 2024
@fterradev
Copy link

Same issue here.

@cypress-app-bot cypress-app-bot removed the stale no activity on this issue for a long period label Jul 5, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Jan 1, 2025
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing Reproducible Can be reproduced stale no activity on this issue for a long period topic: shadow dom Issues when testing shadow dom type: bug
Projects
None yet
Development

No branches or pull requests