@percy/client 1.30.9-beta.2 → 1.30.9-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/client.js +29 -0
- package/package.json +4 -4
package/dist/client.js
CHANGED
|
@@ -21,6 +21,25 @@ function validateId(type, id) {
|
|
|
21
21
|
throw new Error(`Invalid ${type} ID`);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
function makeRegions(regions, algorithm, algorithmConfiguration) {
|
|
25
|
+
let regionObj;
|
|
26
|
+
if (algorithm) {
|
|
27
|
+
regionObj = {};
|
|
28
|
+
regionObj.algorithm = algorithm;
|
|
29
|
+
regionObj.configuration = algorithmConfiguration;
|
|
30
|
+
}
|
|
31
|
+
if (!Array.isArray(regions) && !regionObj) return null;
|
|
32
|
+
if (regionObj) {
|
|
33
|
+
regions || (regions = []);
|
|
34
|
+
regions.push(regionObj);
|
|
35
|
+
}
|
|
36
|
+
return regions.map(region => ({
|
|
37
|
+
...region,
|
|
38
|
+
elementSelector: region.elementSelector || {
|
|
39
|
+
fullpage: true
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
24
43
|
|
|
25
44
|
// Validate project path arguments
|
|
26
45
|
function validateProjectPath(path) {
|
|
@@ -407,6 +426,9 @@ export class PercyClient {
|
|
|
407
426
|
testCase,
|
|
408
427
|
labels,
|
|
409
428
|
thTestCaseExecutionId,
|
|
429
|
+
regions,
|
|
430
|
+
algorithm,
|
|
431
|
+
algorithmConfiguration,
|
|
410
432
|
resources = [],
|
|
411
433
|
meta
|
|
412
434
|
} = {}) {
|
|
@@ -417,6 +439,7 @@ export class PercyClient {
|
|
|
417
439
|
this.log.warn('Warning: Missing `clientInfo` and/or `environmentInfo` properties', meta);
|
|
418
440
|
}
|
|
419
441
|
let tagsArr = tagsList(labels);
|
|
442
|
+
let regionsArr = makeRegions(regions, algorithm, algorithmConfiguration);
|
|
420
443
|
this.log.debug(`Validating resources: ${name}...`, meta);
|
|
421
444
|
for (let resource of resources) {
|
|
422
445
|
if (resource.sha || resource.content || !resource.filepath) continue;
|
|
@@ -434,6 +457,7 @@ export class PercyClient {
|
|
|
434
457
|
'test-case': testCase || null,
|
|
435
458
|
tags: tagsArr,
|
|
436
459
|
'scope-options': scopeOptions || {},
|
|
460
|
+
regions: regionsArr || null,
|
|
437
461
|
'minimum-height': minHeight || null,
|
|
438
462
|
'enable-javascript': enableJavaScript || null,
|
|
439
463
|
'enable-layout': enableLayout || false,
|
|
@@ -503,6 +527,9 @@ export class PercyClient {
|
|
|
503
527
|
consideredElementsData,
|
|
504
528
|
metadata,
|
|
505
529
|
sync,
|
|
530
|
+
regions,
|
|
531
|
+
algorithm,
|
|
532
|
+
algorithmConfiguration,
|
|
506
533
|
meta = {}
|
|
507
534
|
} = {}) {
|
|
508
535
|
validateId('snapshot', snapshotId);
|
|
@@ -517,6 +544,7 @@ export class PercyClient {
|
|
|
517
544
|
tile.content = await fs.promises.readFile(tile.filepath);
|
|
518
545
|
}
|
|
519
546
|
}
|
|
547
|
+
let regionsArr = makeRegions(regions, algorithm, algorithmConfiguration);
|
|
520
548
|
this.log.debug(`${tiles.length} tiles for comparision: ${tag.name}...`, meta);
|
|
521
549
|
return this.post(`snapshots/${snapshotId}/comparisons`, {
|
|
522
550
|
data: {
|
|
@@ -524,6 +552,7 @@ export class PercyClient {
|
|
|
524
552
|
attributes: {
|
|
525
553
|
'external-debug-url': externalDebugUrl || null,
|
|
526
554
|
'ignore-elements-data': ignoredElementsData || null,
|
|
555
|
+
regions: regionsArr || null,
|
|
527
556
|
'consider-elements-data': consideredElementsData || null,
|
|
528
557
|
'dom-info-sha': domInfoSha || null,
|
|
529
558
|
sync: !!sync,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/client",
|
|
3
|
-
"version": "1.30.9-beta.
|
|
3
|
+
"version": "1.30.9-beta.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"test:coverage": "yarn test --coverage"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@percy/env": "1.30.9-beta.
|
|
37
|
-
"@percy/logger": "1.30.9-beta.
|
|
36
|
+
"@percy/env": "1.30.9-beta.4",
|
|
37
|
+
"@percy/logger": "1.30.9-beta.4",
|
|
38
38
|
"pac-proxy-agent": "^7.0.2",
|
|
39
39
|
"pako": "^2.1.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "da775ecb34bc01824f0dee8f208201c373ca78d4"
|
|
42
42
|
}
|