You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(e2e): make visual-regression editor captures deterministic (#2192)
Blur the active element before capturing so a hydration focus race on the
TipTap toolbar cannot leave a button highlighted in some runs and not
others, which produced spurious diffs on the content-editor and content-new
screens.
Also decide visual drift from git status of the snapshots directory rather
than from a non-zero Playwright exit. A flaky render can fail the first-pass
diff yet regenerate byte-identical baselines under --update-snapshots; the
old candidate-emptiness check always saw the committed baselines and flagged
drift regardless. Now a clean tree after regeneration is treated as flake or
infra failure and keeps the check green with a warning.
if [ -z "$(ls -A visual-out/candidates 2>/dev/null)" ]; then
108
-
# Non-zero exit but nothing regenerated -> infra failure, not drift.
107
+
# Real drift == the regeneration changed tracked baselines or added
108
+
# new ones. Untracked new files count (bootstrap: a PR that adds a
109
+
# page has no committed baseline yet). A clean tree means the failure
110
+
# did not correspond to a stable pixel difference -- treat it as flake
111
+
# or infra and keep the check green with a warning.
112
+
if [ -z "$(git status --porcelain -- "$SNAP_DIR")" ]; then
109
113
echo "false" > visual-out/has-drift
110
114
echo "has_drift=false" >> "$GITHUB_OUTPUT"
111
-
echo "::warning::Visual suite failed without producing candidate baselines (likely an infra failure, not a UI diff)."
112
-
else
113
-
echo "true" > visual-out/has-drift
114
-
echo "has_drift=true" >> "$GITHUB_OUTPUT"
115
-
echo "Visual drift detected — candidates and diff images staged for the Report workflow."
115
+
echo "::warning::Visual suite exited non-zero but regenerated baselines are identical to the committed ones (flaky render or infra failure, not a UI diff)."
116
+
exit 0
117
+
fi
118
+
119
+
# Stage the candidate baselines for the Report/Apply workflows.
120
+
mkdir -p visual-out/candidates
121
+
if [ -d "$SNAP_DIR" ]; then
122
+
cp -r "$SNAP_DIR/." visual-out/candidates/
116
123
fi
124
+
echo "true" > visual-out/has-drift
125
+
echo "has_drift=true" >> "$GITHUB_OUTPUT"
126
+
echo "Visual drift detected — candidates and diff images staged for the Report workflow."
0 commit comments