@percy/core 1.28.2-beta.0 → 1.28.2-beta.1
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/discovery.js +22 -8
- package/dist/percy.js +4 -2
- package/package.json +7 -7
package/dist/discovery.js
CHANGED
|
@@ -152,6 +152,7 @@ function processSnapshotResources({
|
|
|
152
152
|
// Triggers the capture of resource requests for a page by iterating over snapshot widths to resize
|
|
153
153
|
// the page and calling any provided execute options.
|
|
154
154
|
async function* captureSnapshotResources(page, snapshot, options) {
|
|
155
|
+
const log = logger('core:discovery');
|
|
155
156
|
let {
|
|
156
157
|
discovery,
|
|
157
158
|
additionalSnapshots = [],
|
|
@@ -161,7 +162,8 @@ async function* captureSnapshotResources(page, snapshot, options) {
|
|
|
161
162
|
capture,
|
|
162
163
|
captureWidths,
|
|
163
164
|
deviceScaleFactor,
|
|
164
|
-
mobile
|
|
165
|
+
mobile,
|
|
166
|
+
captureForDevices
|
|
165
167
|
} = options;
|
|
166
168
|
|
|
167
169
|
// used to take snapshots and remove any discovered root resource
|
|
@@ -215,6 +217,21 @@ async function* captureSnapshotResources(page, snapshot, options) {
|
|
|
215
217
|
} = snap;
|
|
216
218
|
let [width] = widths;
|
|
217
219
|
|
|
220
|
+
// iterate over device to trigger reqeusts and capture other dpr width
|
|
221
|
+
if (captureForDevices) {
|
|
222
|
+
for (const device of captureForDevices) {
|
|
223
|
+
yield waitForDiscoveryNetworkIdle(page, discovery);
|
|
224
|
+
// We are not adding these widths and pixels ratios in loop below because we want to explicitly reload the page after resize which we dont do below
|
|
225
|
+
yield* captureSnapshotResources(page, {
|
|
226
|
+
...snapshot,
|
|
227
|
+
widths: [device.width]
|
|
228
|
+
}, {
|
|
229
|
+
deviceScaleFactor: device.deviceScaleFactor,
|
|
230
|
+
mobile: true
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
218
235
|
// iterate over widths to trigger reqeusts and capture other widths
|
|
219
236
|
if (isBaseSnapshot || captureWidths) {
|
|
220
237
|
for (let i = 0; i < widths.length - 1; i++) {
|
|
@@ -239,12 +256,8 @@ async function* captureSnapshotResources(page, snapshot, options) {
|
|
|
239
256
|
}
|
|
240
257
|
|
|
241
258
|
// recursively trigger resource requests for any alternate device pixel ratio
|
|
242
|
-
if (
|
|
243
|
-
|
|
244
|
-
yield* captureSnapshotResources(page, snapshot, {
|
|
245
|
-
deviceScaleFactor: discovery.devicePixelRatio,
|
|
246
|
-
mobile: true
|
|
247
|
-
});
|
|
259
|
+
if (discovery.devicePixelRatio) {
|
|
260
|
+
log.deprecated('discovery.devicePixelRatio is deprecated percy will now auto capture resource in all devicePixelRatio, Ignoring configuration');
|
|
248
261
|
}
|
|
249
262
|
|
|
250
263
|
// wait for final network idle when not capturing DOM
|
|
@@ -354,7 +367,8 @@ export function createDiscoveryQueue(percy) {
|
|
|
354
367
|
try {
|
|
355
368
|
yield* captureSnapshotResources(page, snapshot, {
|
|
356
369
|
captureWidths: !snapshot.domSnapshot && percy.deferUploads,
|
|
357
|
-
capture: callback
|
|
370
|
+
capture: callback,
|
|
371
|
+
captureForDevices: percy.deviceDetails || []
|
|
358
372
|
});
|
|
359
373
|
} finally {
|
|
360
374
|
// always close the page when done
|
package/dist/percy.js
CHANGED
|
@@ -145,12 +145,14 @@ export class Percy {
|
|
|
145
145
|
if (this.readyState != null) return;
|
|
146
146
|
this.readyState = 0;
|
|
147
147
|
try {
|
|
148
|
+
var _this$build;
|
|
148
149
|
// start the snapshots queue immediately when not delayed or deferred
|
|
149
150
|
if (!this.delayUploads && !this.deferUploads) yield this.#snapshots.start();
|
|
150
151
|
// do not start the discovery queue when not needed
|
|
151
152
|
if (!this.skipDiscovery) yield this.#discovery.start();
|
|
152
153
|
// start a local API server for SDK communication
|
|
153
154
|
if (this.server) yield this.server.listen();
|
|
155
|
+
if (this.projectType === 'web') this.deviceDetails = yield this.client.getDeviceDetails((_this$build = this.build) === null || _this$build === void 0 ? void 0 : _this$build.id);
|
|
154
156
|
const snapshotType = this.projectType === 'web' ? 'snapshot' : 'comparison';
|
|
155
157
|
this.syncQueue = new WaitForJob(snapshotType, this);
|
|
156
158
|
// log and mark this instance as started
|
|
@@ -258,10 +260,10 @@ export class Percy {
|
|
|
258
260
|
// snapshots. Once asset discovery has completed for the provided snapshots, the queued task will
|
|
259
261
|
// resolve and an upload task will be queued separately.
|
|
260
262
|
snapshot(options, snapshotPromise = {}) {
|
|
261
|
-
var _this$
|
|
263
|
+
var _this$build2;
|
|
262
264
|
if (this.readyState !== 1) {
|
|
263
265
|
throw new Error('Not running');
|
|
264
|
-
} else if ((_this$
|
|
266
|
+
} else if ((_this$build2 = this.build) !== null && _this$build2 !== void 0 && _this$build2.error) {
|
|
265
267
|
throw new Error(this.build.error);
|
|
266
268
|
} else if (Array.isArray(options)) {
|
|
267
269
|
return yieldAll(options.map(o => this.yield.snapshot(o, snapshotPromise)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.28.2-beta.
|
|
3
|
+
"version": "1.28.2-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"test:types": "tsd"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@percy/client": "1.28.2-beta.
|
|
47
|
-
"@percy/config": "1.28.2-beta.
|
|
48
|
-
"@percy/dom": "1.28.2-beta.
|
|
49
|
-
"@percy/logger": "1.28.2-beta.
|
|
50
|
-
"@percy/webdriver-utils": "1.28.2-beta.
|
|
46
|
+
"@percy/client": "1.28.2-beta.1",
|
|
47
|
+
"@percy/config": "1.28.2-beta.1",
|
|
48
|
+
"@percy/dom": "1.28.2-beta.1",
|
|
49
|
+
"@percy/logger": "1.28.2-beta.1",
|
|
50
|
+
"@percy/webdriver-utils": "1.28.2-beta.1",
|
|
51
51
|
"content-disposition": "^0.5.4",
|
|
52
52
|
"cross-spawn": "^7.0.3",
|
|
53
53
|
"extract-zip": "^2.0.1",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"rimraf": "^3.0.2",
|
|
59
59
|
"ws": "^8.0.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "c4d0637366dbc28eeda234f93d44424d9c565f49"
|
|
62
62
|
}
|