@percy/core 1.30.11-beta.2 → 1.30.11-beta.4
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 +7 -0
- package/dist/discovery.js +4 -1
- package/dist/snapshot.js +2 -1
- package/dist/utils.js +5 -0
- package/package.json +8 -8
package/dist/config.js
CHANGED
|
@@ -338,6 +338,10 @@ export const configSchema = {
|
|
|
338
338
|
minimum: 1,
|
|
339
339
|
maximum: 30000
|
|
340
340
|
},
|
|
341
|
+
scrollToBottom: {
|
|
342
|
+
type: 'boolean',
|
|
343
|
+
default: false
|
|
344
|
+
},
|
|
341
345
|
disableCache: {
|
|
342
346
|
type: 'boolean'
|
|
343
347
|
},
|
|
@@ -541,6 +545,9 @@ export const snapshotSchema = {
|
|
|
541
545
|
},
|
|
542
546
|
retry: {
|
|
543
547
|
$ref: '/config/discovery#/properties/retry'
|
|
548
|
+
},
|
|
549
|
+
scrollToBottom: {
|
|
550
|
+
$ref: '/config/discovery#/properties/scrollToBottom'
|
|
544
551
|
}
|
|
545
552
|
}
|
|
546
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
|
|
|
@@ -53,6 +53,7 @@ function debugSnapshotOptions(snapshot) {
|
|
|
53
53
|
debugProp(snapshot, 'clientInfo');
|
|
54
54
|
debugProp(snapshot, 'environmentInfo');
|
|
55
55
|
debugProp(snapshot, 'domSnapshot', Boolean);
|
|
56
|
+
debugProp(snapshot, 'discovery.scrollToBottom');
|
|
56
57
|
if (Array.isArray(snapshot.domSnapshot)) {
|
|
57
58
|
debugProp(snapshot, 'domSnapshot.0.userAgent');
|
|
58
59
|
} else {
|
|
@@ -328,6 +329,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
|
|
|
328
329
|
yield page.eval((_, s) => window.__PERCY__.snapshot = s, snapshot);
|
|
329
330
|
yield page.evaluate(snapshot.execute.afterNavigation);
|
|
330
331
|
}
|
|
332
|
+
yield* maybeScrollToBottom(page, discovery);
|
|
331
333
|
|
|
332
334
|
// Running before page idle since this will trigger many network calls
|
|
333
335
|
// so need to run as early as possible. plus it is just reading urls from dom srcset
|
|
@@ -366,6 +368,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
|
|
|
366
368
|
});
|
|
367
369
|
}
|
|
368
370
|
yield page.evaluate(execute === null || execute === void 0 ? void 0 : execute.afterResize);
|
|
371
|
+
yield* maybeScrollToBottom(page, discovery);
|
|
369
372
|
}
|
|
370
373
|
}
|
|
371
374
|
if (capture && !snapshot.domSnapshot) {
|
package/dist/snapshot.js
CHANGED
|
@@ -151,7 +151,8 @@ 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
158
|
var _next, _next2, _next3;
|
package/dist/utils.js
CHANGED
|
@@ -571,4 +571,9 @@ export function normalizeOptions(options) {
|
|
|
571
571
|
normalizedOptions[normalizedKey] = options[key];
|
|
572
572
|
}
|
|
573
573
|
return normalizedOptions;
|
|
574
|
+
}
|
|
575
|
+
export async function* maybeScrollToBottom(page, discovery) {
|
|
576
|
+
if (discovery.scrollToBottom && page.enableJavaScript) {
|
|
577
|
+
yield page.eval('await scrollToBottom()');
|
|
578
|
+
}
|
|
574
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.4",
|
|
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.4",
|
|
47
|
+
"@percy/config": "1.30.11-beta.4",
|
|
48
|
+
"@percy/dom": "1.30.11-beta.4",
|
|
49
|
+
"@percy/logger": "1.30.11-beta.4",
|
|
50
|
+
"@percy/monitoring": "1.30.11-beta.4",
|
|
51
|
+
"@percy/webdriver-utils": "1.30.11-beta.4",
|
|
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": "f6b78917a050f858985d710d207a5651fb2cf56c"
|
|
65
65
|
}
|