Skip to content

Commit 1deba54

Browse files
OrKoNDevtools-frontend LUCI CQ
authored andcommitted
Stability improvements of existing screenshot tests
This CL reduces retries to 1 (no-retries) and the threshold for diffs to 0.1. This CL also adds the following flags that should help to render in a more stable way: - `--disable-font-subpixel-positioning` disables subpixel positioning for fonts. - `--disable-lcd-text` disables subpixel antialiasing. - `--force-device-scale-factor=1` forces device scale factor to be 1. - `--hide-scrollbars` hides scrollbars which might affect rendering. Also, this CL imports a Roboto web font into component docs and adds a special CSS class to force all fonts to be the same font (see front_end/design_system_tokens.css and front_end/ui/components/docs/component_docs_styles.css). Bug: 401489541 Change-Id: I94e6a733d63459d1692197536511dad199ee168b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6342613 Commit-Queue: Alex Rudenko <[email protected]> Reviewed-by: Jack Franklin <[email protected]>
1 parent 2200f6f commit 1deba54

File tree

88 files changed

+78
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+78
-75
lines changed

front_end/design_system_tokens.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,12 @@
491491
--source-code-font-family: monospace;
492492
}
493493

494+
&.platform-screenshot-test {
495+
--default-font-family: roboto;
496+
--monospace-font-family: roboto;
497+
--source-code-font-family: roboto;
498+
}
499+
494500
--ref-typeface-weight-regular: 400;
495501
--ref-typeface-weight-medium: 500;
496502
--ref-typeface-weight-bold: 700;

front_end/ui/components/docs/component_docs_styles.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
* found in the LICENSE file.
55
*/
66

7+
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');
8+
79
body {
810
margin: 0;
911
padding: 0;
10-
font-family: ".SFNSDisplay-Regular", "Helvetica Neue", "Lucida Grande", sans-serif;
1112
}
1213

1314
#index-page h1 {

front_end/ui/components/docs/console_insight/references.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,5 @@ A direct citation is a link to a reference, but it only applies to a specific pa
100100
},
101101

102102
Host.AidaClient.AidaAccessPreconditions.AVAILABLE);
103+
component.disableAnimations = true;
103104
document.getElementById('container')?.appendChild(component);

front_end/ui/components/docs/toggle_fonts.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
const PLATFROM_SCREENSHOT_TESTS = 'platform-screenshot-test';
56
const PLATFORM_MAC_CLASS = 'platform-mac';
67
const PLATFORM_LINUX_CLASS = 'platform-linux';
78
const PLATFORM_WINDOWS_CLASS = 'platform-windows';
@@ -34,6 +35,7 @@ export function init(): void {
3435
button.className = 'component-docs-ui';
3536

3637
const loop = [
38+
PLATFROM_SCREENSHOT_TESTS,
3739
PLATFORM_LINUX_CLASS,
3840
PLATFORM_MAC_CLASS,
3941
PLATFORM_WINDOWS_CLASS,

test/conductor/hooks.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ function launchChrome() {
8282
'--site-per-process', // Default on Desktop anyway, but ensure that we always use out-of-process frames when we intend to.
8383
'--host-resolver-rules=MAP *.test 127.0.0.1',
8484
'--disable-gpu',
85+
'--disable-font-subpixel-positioning',
86+
'--disable-lcd-text',
87+
'--force-device-scale-factor=1',
88+
'--hide-scrollbars',
8589
'--enable-blink-features=CSSContainerQueries,HighlightInheritance', // TODO(crbug.com/1218390) Remove globally enabled flags and conditionally enable them
8690
'--disable-blink-features=WebAssemblyJSPromiseIntegration', // TODO(crbug.com/325123665) Remove once heap snapshots work again with JSPI
8791
`--disable-features=${disabledFeatures.join(',')}`,
@@ -99,7 +103,7 @@ function launchChrome() {
99103

100104
// Always set the default viewport because setting only the window size for
101105
// headful mode would result in much smaller actual viewport.
102-
opts.defaultViewport = {width: viewportWidth, height: viewportHeight};
106+
opts.defaultViewport = {width: viewportWidth, height: viewportHeight, deviceScaleFactor: 1};
103107
// Toggle either viewport or window size depending on headless vs not.
104108
if (!headless) {
105109
launchArgs.push(`--window-size=${windowWidth},${windowHeight}`);
-285 Bytes
-6 Bytes
-2.1 KB
-44 Bytes
-731 Bytes

0 commit comments

Comments
 (0)