Conversation
`hideDevOverlay` in `e2e/visual-regression.spec.ts` writes `display: none` onto every
`nextjs-portal`, and nothing ever puts it back — hence this issue. Hiding the badge
is deliberate; it animates inside a shadow root, so its pixels are not reproducible
and it has to go before a screenshot. Leaving the page in that state afterwards is
not deliberate.
It now injects a rule of its own instead:
<style id="e2e-hide-dev-overlay">nextjs-portal { display: none !important }</style>
Restoring is then deleting a node this suite created, so no per-element style is
destroyed and there is no state to remember. Two things fall out of that. Portals
that mount *after* the call are covered — the dev runtime mounts the badge well
after hydration, and the previous per-element loop only caught whichever portals
existed at that instant. And `!important` holds against the overlay's own inline
styles, which the inline `style.display` assignment could be fighting.
`restoreDevOverlay` is called from a new `test.afterEach`, which Playwright runs even
when the test threw, so a failure before the last screenshot no longer leaves the
overlay hidden. Note that Playwright gives each test a fresh context, so the leak the
issue describes is not something I could reproduce across tests — what is real is
that a failing test left its own page hidden, and that the mutation was one-way.
Both are gone; the fix costs nothing even if the cross-test worry was theoretical.
❌ Deploy Preview for smart-drop failed.
|
✅ Deploy Preview for spiffy-melomakarona-eb1e8a ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Ran it for real. On a branch carrying #492's two fixes plus this change: Test 1 is the one that calls I could not have got here without #492: before it, the dev server served a build-error overlay and every spec timed out. That was the reason this looked unverifiable on |
(cherry picked from commit df3163e)
|
Added one more commit: a lockfile sync that is not about this PR's own subject, but is the reason every Netlify check on this PR was red.
That is why the six checks on this PR ("Header rules", "Pages changed", "Redirect rules" — the two deploy previews each report three) were failing: they report the preview failing to build, and the preview cannot build while the install is refused. It is repo-wide, not specific to this branch. The commit adds The dependency is real, not stale: This commit is also on the other three open PRs from the same base (#490, #491, #493) so their previews can go green independently of this one merging. |
|
Update on the checks, since they now tell a clearer story: #492 is fully green (both deploy previews, header/redirect rules), and this one is still red — but not for the reason it was. This branch carries the lockfile sync, so the install no longer aborts. What is left is the defects that live on I am deliberately not copying those fixes here: they would duplicate #492, and when it merges this branch picks them up on rebase. If you would rather each PR stand alone and be green today, say so and I will cherry-pick them in. |
Closes #477
The problem, restated
hideDevOverlaywritesdisplay: noneonto everynextjs-portaland nothing puts it back. Hiding the badge is deliberate — it animates inside a shadow root, so its pixels are not reproducible and it has to go before a screenshot (the comment above the helper explains the original investigation). Leaving the page in that state afterwards is not deliberate.What changed
The overlay is now hidden by a rule the suite owns:
so restoring is deleting a node this suite created. No per-element style is destroyed and there is no previous value to remember — which is what made the old version one-way.
Two things fall out of the change beyond reversibility:
nextjs-portalelements existed at that instant; the dev runtime mounts the badge well after hydration. A stylesheet keeps applying to elements added later.!importantholds against the overlay's own inline styles, which a plainstyle.display = "none"can be fighting depending on order.restoreDevOverlayis called from a newtest.afterEach, which Playwright runs even when the test threw — so a failure before the final screenshot no longer leaves the page hidden.One correction to the issue
Playwright gives each test its own browser context, so I could not reproduce the overlay actually leaking into a subsequent test's baseline. What is real is that a failing test left its own page with the overlay hidden for anything that ran later in it, and that the mutation was irreversible. Both are fixed; the change is cheap enough that it is worth having even if the cross-test worry was theoretical.
Verification
I could not run the spec itself to completion on
main, and that is not this issue's doing: the dev server serves a build-error overlay because of two unrelated breakages on the tip ofmain(useEffectnot imported inNavbar.tsx, and a duplicatestepRefinuseLockFlow.ts), which makes every spec time out before rendering. Both are fixed in #492; once that is in (andsrc/app/loading.tsx:42'sSkeletonBartype error, also pre-existing, is dealt with) I will run this spec and report the result here rather than claim it.No test was added for the helper itself: asserting my own string in a unit test would prove nothing, and the value of this change is only visible in a real browser run, which is what the existing visual spec already does.