Skip to content

Commit 90f0ce2

Browse files
authored
[code-infra] Fix flaky dashboard screenshot - take 2 (#43937)
Signed-off-by: Jan Potoms <2109932+Janpot@users.noreply.github.com>
1 parent 085a6b0 commit 90f0ce2

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ jobs:
467467
command: xvfb-run pnpm test:regressions
468468
- run:
469469
name: Build packages for fixtures
470-
command: xvfb-run pnpm release:build
470+
command: pnpm release:build
471471
- run:
472472
name: Run visual regression tests using Pigment CSS
473473
command: xvfb-run pnpm test:regressions-pigment-css

apps/pigment-css-vite-app/src/pages/fixtures/index.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ async function main() {
5050
routes = routes.map((route) => route.replace(baseUrl, ''));
5151

5252
async function renderFixture(index) {
53+
await page.evaluate(() => {
54+
// Playwright hides scrollbar when capturing a screenshot on an element or with fullPage: true.
55+
// When the body has a scrollbar, this causes a brief layout shift. Disable the body overflow
56+
// altogether to prevent this
57+
window.document.body.style.overflow = 'hidden';
58+
});
59+
5360
// Use client-side routing which is much faster than full page navigation via page.goto().
5461
// Could become an issue with test isolation.
5562
// If tests are flaky due to global pollution switch to page.goto(route);

test/regressions/index.test.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ async function main() {
5454
* @param {string} route
5555
*/
5656
async function renderFixture(route) {
57-
// Use client-side routing which is much faster than full page navigation via page.goto().
5857
await page.evaluate((_route) => {
58+
// Use client-side routing which is much faster than full page navigation via page.goto().
5959
window.muiFixture.navigate(`${_route}#no-dev`);
60+
61+
// Playwright hides scrollbar when capturing a screenshot on an element or with fullPage: true.
62+
// When the body has a scrollbar, this causes a brief layout shift. Disable the body overflow
63+
// altogether to prevent this
64+
window.document.body.style.overflow = 'hidden';
6065
}, route);
6166

6267
// Move cursor offscreen to not trigger unwanted hover effects.

test/regressions/template.html

-9
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77
<style>
88
body {
99
background-color: white;
10-
/*
11-
Hide scrollbars but keep scrollable. Playwright hides scrollbar when capturing a screenshot on an element
12-
or with fullPage: true. When the body has a scrollbar, this causes a brief layout shift.
13-
*/
14-
-ms-overflow-style: none; /* Internet Explorer 10+ */
15-
scrollbar-width: none; /* Firefox */
16-
}
17-
body::-webkit-scrollbar {
18-
display: none; /* Safari and Chrome */
1910
}
2011
</style>
2112
</head>

0 commit comments

Comments
 (0)