diff options
| author | Hana Kim <hyangah@gmail.com> | 2026-03-27 16:34:54 -0400 |
|---|---|---|
| committer | Hyang-Ah Hana Kim <hyangah@gmail.com> | 2026-03-28 11:55:01 -0700 |
| commit | 764f79e85197be12b4ab14db0a118c4931d50d2a (patch) | |
| tree | 3065a22ac6cfc115d32b48c39f3ba812629e9aaf /internal/api/api.go | |
| parent | 6ce2f68b79f236c20f1dce90d794effe6b4ad6bd (diff) | |
| download | go-x-pkgsite-764f79e85197be12b4ab14db0a118c4931d50d2a.tar.xz | |
tests/screentest: fix flaky mobile viewport screen captures
When "capture viewport 540x1080" shrinks the headless browser window from desktop to mobile size, the layout shifts and triggers CSS transitions. Because screentest takes the screenshot immediately after resizing, it often captures the page mid-animation. This causes element height changes and unexpected scrollbars, making the image diff fail randomly.
Fixed by injecting a style tag that globally disables all CSS transitions during the hideElements initialization. This causes layout resizes to snap instantly, ensuring the captured image is always fully settled and consistent.
Change-Id: I43310708ced5f0cff5bf011bfb407fa22705d9a2
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/760580
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'internal/api/api.go')
0 files changed, 0 insertions, 0 deletions
