@percy/core 1.30.11-beta.1 → 1.30.11-beta.3
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.
- package/dist/config.js +18 -0
- package/dist/discovery.js +5 -1
- package/dist/snapshot.js +6 -3
- package/dist/utils.js +6 -0
- package/package.json +8 -8
- package/types/index.d.ts +1 -0
package/dist/config.js
CHANGED
|
@@ -122,6 +122,14 @@ export const configSchema = {
|
|
|
122
122
|
thTestCaseExecutionId: {
|
|
123
123
|
type: 'string'
|
|
124
124
|
},
|
|
125
|
+
browsers: {
|
|
126
|
+
type: 'array',
|
|
127
|
+
items: {
|
|
128
|
+
type: 'string',
|
|
129
|
+
minLength: 1
|
|
130
|
+
},
|
|
131
|
+
onlyWeb: true
|
|
132
|
+
},
|
|
125
133
|
fullPage: {
|
|
126
134
|
type: 'boolean',
|
|
127
135
|
onlyAutomate: true
|
|
@@ -330,6 +338,10 @@ export const configSchema = {
|
|
|
330
338
|
minimum: 1,
|
|
331
339
|
maximum: 30000
|
|
332
340
|
},
|
|
341
|
+
scrollToBottom: {
|
|
342
|
+
type: 'boolean',
|
|
343
|
+
default: false
|
|
344
|
+
},
|
|
333
345
|
disableCache: {
|
|
334
346
|
type: 'boolean'
|
|
335
347
|
},
|
|
@@ -476,6 +488,9 @@ export const snapshotSchema = {
|
|
|
476
488
|
thTestCaseExecutionId: {
|
|
477
489
|
$ref: '/config/snapshot#/properties/thTestCaseExecutionId'
|
|
478
490
|
},
|
|
491
|
+
browsers: {
|
|
492
|
+
$ref: '/config/snapshot#/properties/browsers'
|
|
493
|
+
},
|
|
479
494
|
reshuffleInvalidTags: {
|
|
480
495
|
$ref: '/config/snapshot#/properties/reshuffleInvalidTags'
|
|
481
496
|
},
|
|
@@ -530,6 +545,9 @@ export const snapshotSchema = {
|
|
|
530
545
|
},
|
|
531
546
|
retry: {
|
|
532
547
|
$ref: '/config/discovery#/properties/retry'
|
|
548
|
+
},
|
|
549
|
+
scrollToBottom: {
|
|
550
|
+
$ref: '/config/discovery#/properties/scrollToBottom'
|
|
533
551
|
}
|
|
534
552
|
}
|
|
535
553
|
}
|
package/dist/discovery.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logger from '@percy/logger';
|
|
2
2
|
import Queue from './queue.js';
|
|
3
3
|
import Page from './page.js';
|
|
4
|
-
import { normalizeURL, hostnameMatches, createResource, createRootResource, createPercyCSSResource, createLogResource, yieldAll, snapshotLogName, waitForTimeout, withRetries, waitForSelectorInsideBrowser, isGzipped } from './utils.js';
|
|
4
|
+
import { normalizeURL, hostnameMatches, createResource, createRootResource, createPercyCSSResource, createLogResource, yieldAll, snapshotLogName, waitForTimeout, withRetries, waitForSelectorInsideBrowser, isGzipped, maybeScrollToBottom } from './utils.js';
|
|
5
5
|
import { sha256hash } from '@percy/client/utils';
|
|
6
6
|
import Pako from 'pako';
|
|
7
7
|
|
|
@@ -36,6 +36,7 @@ function debugSnapshotOptions(snapshot) {
|
|
|
36
36
|
debugProp(snapshot, 'waitForTimeout');
|
|
37
37
|
debugProp(snapshot, 'waitForSelector');
|
|
38
38
|
debugProp(snapshot, 'scopeOptions.scroll');
|
|
39
|
+
debugProp(snapshot, 'browsers');
|
|
39
40
|
debugProp(snapshot, 'execute.afterNavigation');
|
|
40
41
|
debugProp(snapshot, 'execute.beforeResize');
|
|
41
42
|
debugProp(snapshot, 'execute.afterResize');
|
|
@@ -52,6 +53,7 @@ function debugSnapshotOptions(snapshot) {
|
|
|
52
53
|
debugProp(snapshot, 'clientInfo');
|
|
53
54
|
debugProp(snapshot, 'environmentInfo');
|
|
54
55
|
debugProp(snapshot, 'domSnapshot', Boolean);
|
|
56
|
+
debugProp(snapshot, 'discovery.scrollToBottom');
|
|
55
57
|
if (Array.isArray(snapshot.domSnapshot)) {
|
|
56
58
|
debugProp(snapshot, 'domSnapshot.0.userAgent');
|
|
57
59
|
} else {
|
|
@@ -327,6 +329,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
|
|
|
327
329
|
yield page.eval((_, s) => window.__PERCY__.snapshot = s, snapshot);
|
|
328
330
|
yield page.evaluate(snapshot.execute.afterNavigation);
|
|
329
331
|
}
|
|
332
|
+
yield* maybeScrollToBottom(page, discovery);
|
|
330
333
|
|
|
331
334
|
// Running before page idle since this will trigger many network calls
|
|
332
335
|
// so need to run as early as possible. plus it is just reading urls from dom srcset
|
|
@@ -365,6 +368,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
|
|
|
365
368
|
});
|
|
366
369
|
}
|
|
367
370
|
yield page.evaluate(execute === null || execute === void 0 ? void 0 : execute.afterResize);
|
|
371
|
+
yield* maybeScrollToBottom(page, discovery);
|
|
368
372
|
}
|
|
369
373
|
}
|
|
370
374
|
if (capture && !snapshot.domSnapshot) {
|
package/dist/snapshot.js
CHANGED
|
@@ -151,14 +151,17 @@ function getSnapshotOptions(options, {
|
|
|
151
151
|
captureMockedServiceWorker: config.discovery.captureMockedServiceWorker,
|
|
152
152
|
captureSrcset: config.discovery.captureSrcset,
|
|
153
153
|
userAgent: config.discovery.userAgent,
|
|
154
|
-
retry: config.discovery.retry
|
|
154
|
+
retry: config.discovery.retry,
|
|
155
|
+
scrollToBottom: config.discovery.scrollToBottom
|
|
155
156
|
}
|
|
156
157
|
}, options], (path, prev, next) => {
|
|
157
|
-
var _next, _next2;
|
|
158
|
+
var _next, _next2, _next3;
|
|
158
159
|
switch (path.map(k => k.toString()).join('.')) {
|
|
159
160
|
case 'widths':
|
|
160
161
|
// dedup, sort, and override widths when not empty
|
|
161
162
|
return [path, !((_next = next) !== null && _next !== void 0 && _next.length) ? prev : [...new Set(next)].sort((a, b) => a - b)];
|
|
163
|
+
case 'browsers':
|
|
164
|
+
return [path, !((_next2 = next) !== null && _next2 !== void 0 && _next2.length) ? prev : [...new Set(next)]];
|
|
162
165
|
case 'percyCSS':
|
|
163
166
|
// concatenate percy css
|
|
164
167
|
return [path, [prev, next].filter(Boolean).join('\n')];
|
|
@@ -167,7 +170,7 @@ function getSnapshotOptions(options, {
|
|
|
167
170
|
return Array.isArray(next) || typeof next !== 'object' ? [path.concat('beforeSnapshot'), next] : [path];
|
|
168
171
|
case 'discovery.disallowedHostnames':
|
|
169
172
|
// prevent disallowing the root hostname
|
|
170
|
-
return [path, !((
|
|
173
|
+
return [path, !((_next3 = next) !== null && _next3 !== void 0 && _next3.length) ? prev : (prev ?? []).concat(next).filter(h => !hostnameMatches(h, options.url))];
|
|
171
174
|
}
|
|
172
175
|
|
|
173
176
|
// ensure additional snapshots have complete names
|
package/dist/utils.js
CHANGED
|
@@ -558,6 +558,7 @@ const OPTION_MAPPINGS = {
|
|
|
558
558
|
testcase: 'testCase',
|
|
559
559
|
labels: 'labels',
|
|
560
560
|
thtestcaseexecutionid: 'thTestCaseExecutionId',
|
|
561
|
+
browsers: 'browsers',
|
|
561
562
|
resources: 'resources',
|
|
562
563
|
meta: 'meta',
|
|
563
564
|
snapshot: 'snapshot'
|
|
@@ -570,4 +571,9 @@ export function normalizeOptions(options) {
|
|
|
570
571
|
normalizedOptions[normalizedKey] = options[key];
|
|
571
572
|
}
|
|
572
573
|
return normalizedOptions;
|
|
574
|
+
}
|
|
575
|
+
export async function* maybeScrollToBottom(page, discovery) {
|
|
576
|
+
if (discovery.scrollToBottom && page.enableJavaScript) {
|
|
577
|
+
yield page.eval('await scrollToBottom()');
|
|
578
|
+
}
|
|
573
579
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.30.11-beta.
|
|
3
|
+
"version": "1.30.11-beta.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"test:types": "tsd"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@percy/client": "1.30.11-beta.
|
|
47
|
-
"@percy/config": "1.30.11-beta.
|
|
48
|
-
"@percy/dom": "1.30.11-beta.
|
|
49
|
-
"@percy/logger": "1.30.11-beta.
|
|
50
|
-
"@percy/monitoring": "1.30.11-beta.
|
|
51
|
-
"@percy/webdriver-utils": "1.30.11-beta.
|
|
46
|
+
"@percy/client": "1.30.11-beta.3",
|
|
47
|
+
"@percy/config": "1.30.11-beta.3",
|
|
48
|
+
"@percy/dom": "1.30.11-beta.3",
|
|
49
|
+
"@percy/logger": "1.30.11-beta.3",
|
|
50
|
+
"@percy/monitoring": "1.30.11-beta.3",
|
|
51
|
+
"@percy/webdriver-utils": "1.30.11-beta.3",
|
|
52
52
|
"content-disposition": "^0.5.4",
|
|
53
53
|
"cross-spawn": "^7.0.3",
|
|
54
54
|
"extract-zip": "^2.0.1",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"ws": "^8.17.1",
|
|
62
62
|
"yaml": "^2.4.1"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "7ce086a9bc13a1f58cf71ba3ae0a69787ad2a0cb"
|
|
65
65
|
}
|
package/types/index.d.ts
CHANGED