@percy/client 1.30.8 → 1.30.9-alpha-1.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.
- package/dist/client.js +31 -1
- package/package.json +5 -5
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) {
|
|
@@ -175,7 +194,8 @@ export class PercyClient {
|
|
|
175
194
|
tags: tagsArr,
|
|
176
195
|
'cli-start-time': cliStartTime,
|
|
177
196
|
source: source,
|
|
178
|
-
'skip-base-build': (_this$config$percy2 = this.config.percy) === null || _this$config$percy2 === void 0 ? void 0 : _this$config$percy2.skipBaseBuild
|
|
197
|
+
'skip-base-build': (_this$config$percy2 = this.config.percy) === null || _this$config$percy2 === void 0 ? void 0 : _this$config$percy2.skipBaseBuild,
|
|
198
|
+
'testhub-build-uuid': this.env.testhubBuildUuid
|
|
179
199
|
},
|
|
180
200
|
relationships: {
|
|
181
201
|
resources: {
|
|
@@ -406,6 +426,9 @@ export class PercyClient {
|
|
|
406
426
|
testCase,
|
|
407
427
|
labels,
|
|
408
428
|
thTestCaseExecutionId,
|
|
429
|
+
regions,
|
|
430
|
+
algorithm,
|
|
431
|
+
algorithmConfiguration,
|
|
409
432
|
resources = [],
|
|
410
433
|
meta
|
|
411
434
|
} = {}) {
|
|
@@ -416,6 +439,7 @@ export class PercyClient {
|
|
|
416
439
|
this.log.warn('Warning: Missing `clientInfo` and/or `environmentInfo` properties', meta);
|
|
417
440
|
}
|
|
418
441
|
let tagsArr = tagsList(labels);
|
|
442
|
+
let regionsArr = makeRegions(regions, algorithm, algorithmConfiguration);
|
|
419
443
|
this.log.debug(`Validating resources: ${name}...`, meta);
|
|
420
444
|
for (let resource of resources) {
|
|
421
445
|
if (resource.sha || resource.content || !resource.filepath) continue;
|
|
@@ -433,6 +457,7 @@ export class PercyClient {
|
|
|
433
457
|
'test-case': testCase || null,
|
|
434
458
|
tags: tagsArr,
|
|
435
459
|
'scope-options': scopeOptions || {},
|
|
460
|
+
regions: regionsArr || null,
|
|
436
461
|
'minimum-height': minHeight || null,
|
|
437
462
|
'enable-javascript': enableJavaScript || null,
|
|
438
463
|
'enable-layout': enableLayout || false,
|
|
@@ -502,6 +527,9 @@ export class PercyClient {
|
|
|
502
527
|
consideredElementsData,
|
|
503
528
|
metadata,
|
|
504
529
|
sync,
|
|
530
|
+
regions,
|
|
531
|
+
algorithm,
|
|
532
|
+
algorithmConfiguration,
|
|
505
533
|
meta = {}
|
|
506
534
|
} = {}) {
|
|
507
535
|
validateId('snapshot', snapshotId);
|
|
@@ -516,6 +544,7 @@ export class PercyClient {
|
|
|
516
544
|
tile.content = await fs.promises.readFile(tile.filepath);
|
|
517
545
|
}
|
|
518
546
|
}
|
|
547
|
+
let regionsArr = makeRegions(regions, algorithm, algorithmConfiguration);
|
|
519
548
|
this.log.debug(`${tiles.length} tiles for comparision: ${tag.name}...`, meta);
|
|
520
549
|
return this.post(`snapshots/${snapshotId}/comparisons`, {
|
|
521
550
|
data: {
|
|
@@ -523,6 +552,7 @@ export class PercyClient {
|
|
|
523
552
|
attributes: {
|
|
524
553
|
'external-debug-url': externalDebugUrl || null,
|
|
525
554
|
'ignore-elements-data': ignoredElementsData || null,
|
|
555
|
+
regions: regionsArr || null,
|
|
526
556
|
'consider-elements-data': consideredElementsData || null,
|
|
527
557
|
'dom-info-sha': domInfoSha || null,
|
|
528
558
|
sync: !!sync,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/client",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.9-alpha-1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public",
|
|
12
|
-
"tag": "
|
|
12
|
+
"tag": "alpha"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=14"
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"test:coverage": "yarn test --coverage"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@percy/env": "1.30.
|
|
37
|
-
"@percy/logger": "1.30.
|
|
36
|
+
"@percy/env": "1.30.9-alpha-1.0",
|
|
37
|
+
"@percy/logger": "1.30.9-alpha-1.0",
|
|
38
38
|
"pac-proxy-agent": "^7.0.2",
|
|
39
39
|
"pako": "^2.1.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "c9741e74fdbd7d2c152bcdcb619e9b5c1da13be6"
|
|
42
42
|
}
|