@percy/webdriver-utils 1.32.8-beta.5 → 1.32.9-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -89,6 +89,13 @@ export default class AutomateProvider extends GenericProvider {
|
|
|
89
89
|
const metadata = {
|
|
90
90
|
screenshotType: screenshotType
|
|
91
91
|
};
|
|
92
|
+
// percy-api needs the factor to relax its tile-count limit. Added only when it really
|
|
93
|
+
// scaled -- these land in the largest table on the platform.
|
|
94
|
+
const scaleFactor = tileResponse.applied_scale_factor;
|
|
95
|
+
if (tileResponse.scale_to_fit === true && Number.isFinite(scaleFactor) && scaleFactor > 0 && scaleFactor <= 1) {
|
|
96
|
+
metadata.scaleToFit = true;
|
|
97
|
+
metadata.appliedScaleFactor = scaleFactor;
|
|
98
|
+
}
|
|
92
99
|
return {
|
|
93
100
|
tiles: tiles,
|
|
94
101
|
domInfoSha: tileResponse.dom_sha,
|
|
@@ -45,6 +45,11 @@ export default class GenericProvider {
|
|
|
45
45
|
}
|
|
46
46
|
addDefaultOptions() {
|
|
47
47
|
this.options.freezeAnimation = this.options.freezeAnimatedImage || this.options.freezeAnimation || false;
|
|
48
|
+
// PERCY_SCALE_TO_FIT opts a whole run in without per-snapshot config. Coerced to a
|
|
49
|
+
// real boolean: mobile-common compares with `== true`, so a truthy string would no-op.
|
|
50
|
+
// fullPage-only: the host shrinks tiles solely in its full-page loop, so outside it the
|
|
51
|
+
// flag would report a scale factor for tiles that were never scaled.
|
|
52
|
+
this.options.scaleToFit = this.options.fullPage === true && (this.options.scaleToFit === true || this.options.scaleToFit !== false && process.env.PERCY_SCALE_TO_FIT === 'true');
|
|
48
53
|
}
|
|
49
54
|
async createDriver() {
|
|
50
55
|
this.driver = new Driver(this.sessionId, this.commandExecutorUrl, this.capabilities);
|
|
@@ -27,6 +27,10 @@ export default class PlaywrightProvider extends GenericProvider {
|
|
|
27
27
|
async screenshot(name, options) {
|
|
28
28
|
let response = null;
|
|
29
29
|
let error;
|
|
30
|
+
// This override does not call super.screenshot(), which is where GenericProvider applies
|
|
31
|
+
// addDefaultOptions -- so without this the scaleToFit fullPage gate, its boolean
|
|
32
|
+
// coercion and PERCY_SCALE_TO_FIT were all skipped on the playwright path.
|
|
33
|
+
this.addDefaultOptions();
|
|
30
34
|
log.debug(`[${name}] : Preparing to capture screenshots on playwright with automate ...`);
|
|
31
35
|
try {
|
|
32
36
|
log.debug(`[${name}] : Marking automate session as percy ...`);
|
|
@@ -116,6 +120,13 @@ export default class PlaywrightProvider extends GenericProvider {
|
|
|
116
120
|
const metadata = {
|
|
117
121
|
screenshotType: screenshotType
|
|
118
122
|
};
|
|
123
|
+
// Same pair as automateProvider: the host shrinks tiles, so percy-api needs the factor
|
|
124
|
+
// to relax its tile-count limit. Without this a playwright capture reports none.
|
|
125
|
+
const scaleFactor = tileResponse.applied_scale_factor;
|
|
126
|
+
if (tileResponse.scale_to_fit === true && Number.isFinite(scaleFactor) && scaleFactor > 0 && scaleFactor <= 1) {
|
|
127
|
+
metadata.scaleToFit = true;
|
|
128
|
+
metadata.appliedScaleFactor = scaleFactor;
|
|
129
|
+
}
|
|
119
130
|
return {
|
|
120
131
|
tiles: tiles,
|
|
121
132
|
domInfoSha: tileResponse.dom_sha,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/webdriver-utils",
|
|
3
|
-
"version": "1.32.
|
|
3
|
+
"version": "1.32.9-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"test:coverage": "yarn test --coverage"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@percy/config": "1.32.
|
|
33
|
-
"@percy/sdk-utils": "1.32.
|
|
32
|
+
"@percy/config": "1.32.9-beta.0",
|
|
33
|
+
"@percy/sdk-utils": "1.32.9-beta.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "b80116ed1841a2548d2c59cab8d69f5a4d9bd74f"
|
|
36
36
|
}
|