Skip to content

Commit 55151db

Browse files
author
jm
committed
Disable SSR overlay when Cypress is driving
The overlay holds the SSR-rendered children alongside <ds-app>'s CSR-rendered children during the masking window. Cypress's cy.get(selector) sees both copies, so unique-id selectors return 2 elements and cy.click() fails. The overlay is purely a UX smoothing layer (no behaviour to E2E-validate), so short-circuit when window.Cypress is present. Browser users are unaffected.
1 parent b51bedc commit 55151db

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@
4747
*/
4848
(function () {
4949
if (typeof window === 'undefined' || typeof document === 'undefined') return;
50+
// Skip when Cypress is driving the page. The overlay duplicates SSR DOM (moved into the
51+
// overlay) alongside the CSR DOM (rendered into <ds-app>) during the masking window — so
52+
// any cy.get('#some-id').click() picks up two elements and fails. The overlay is a pure
53+
// UX nicety, and Cypress E2E doesn't measure visual smoothness anyway; bail early.
54+
if (typeof window.Cypress !== 'undefined') return;
5055
try {
5156
var app = document.querySelector('ds-app');
5257
// If SSR was skipped for this route (excludePathPatterns), there are no children; nothing to mask.

0 commit comments

Comments
 (0)