Closed hoaiduc87 closed 3 months ago
This issue is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.
It’s waiting for someone to take a look
Hey @hoaiduc87, From the build logs that you have attached I see the snapshot is javascript enabled. When you have javascript enabled snapshots, percy would run javascript in percy's browser - which means java script [ especially what you have added in domContentLoaded event would rerun and reconstuct the DOM - and this reconstruction would put dom in default state where button is not pressed.
You can use with javascript disabled and it would work fine. [ but in my testing backdrop and the location of popup does not seem correct ]
Another note being percy currently does not support CustomElements specifically in js disabled case - so any kind of css that relies on defined?
will not work. and the custom elements would be treated as divs [ as browser does when element is not defined ]
Thanks for the explaination @ninadbstack I’m not sure why, but the last time I tried with JavaScript disabled, it was unable to capture the dialog element. I tried again today, and it seems to work, except for the backdrop and position. It might be sufficient for verifying the dialog content. Is it impossible to get the screenshot as the browser does when javascript is disabled 🥲
@hoaiduc87 no, currently percy by default works in Snapshot mode where we capture and replicate DOM across multiple browsers. If you want to take screenshot of your test browser - its currently only supported when you are using percy with Browserstack Automate [ it comes with some other restrictions ]
The problem
We are using a micro-frontend architecture, where each sub-project is mounted inside a Shadow DOM. Our UI library is built with web components, with each component also attached inside its own Shadow DOM. We are using Cypress for functional testing and integrating with Percy for visual testing.
In this example, I have a button and a dialog, both built as web components and attached inside their respective Shadow DOMs. I want to render this dialog in my sub-project, which is itself attached inside a parent Shadow DOM. When I click the button, the dialog should open.
However, the problem is that the dialog does not appear in the snapshot captured by Percy, although the button remains visible. I have found that the dialog appears correctly when it is wrapped by only one Shadow DOM. I also perform some assertions with Cypress to ensure the elements are visible. It seems like Cypress handles nested Shadow DOMs properly, except for Percy.
Could you help me determine the reason for this issue and suggest how to fix it? Does it require any additional configuration?
Environment
@percy/cli
version: 1.29.0 (latest)@percy/cypress
version: 3.1.2cypress
version: 13.13.1 (latest)Debug logs
35431593_build_35431593_cli_f357c65217906f7679bd4ebbf77e9a2818531084
Code to reproduce issue