@percy/client 1.30.9-beta.2 → 1.30.9-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.
Files changed (2) hide show
  1. package/dist/client.js +15 -0
  2. package/package.json +4 -4
package/dist/client.js CHANGED
@@ -21,6 +21,15 @@ function validateId(type, id) {
21
21
  throw new Error(`Invalid ${type} ID`);
22
22
  }
23
23
  }
24
+ function ensureElementSelector(regions) {
25
+ if (!Array.isArray(regions)) return null;
26
+ return regions.map(region => ({
27
+ ...region,
28
+ elementSelector: region.elementSelector || {
29
+ fullpage: true
30
+ }
31
+ }));
32
+ }
24
33
 
25
34
  // Validate project path arguments
26
35
  function validateProjectPath(path) {
@@ -407,6 +416,7 @@ export class PercyClient {
407
416
  testCase,
408
417
  labels,
409
418
  thTestCaseExecutionId,
419
+ regions,
410
420
  resources = [],
411
421
  meta
412
422
  } = {}) {
@@ -417,6 +427,7 @@ export class PercyClient {
417
427
  this.log.warn('Warning: Missing `clientInfo` and/or `environmentInfo` properties', meta);
418
428
  }
419
429
  let tagsArr = tagsList(labels);
430
+ let regionsArr = ensureElementSelector(regions);
420
431
  this.log.debug(`Validating resources: ${name}...`, meta);
421
432
  for (let resource of resources) {
422
433
  if (resource.sha || resource.content || !resource.filepath) continue;
@@ -434,6 +445,7 @@ export class PercyClient {
434
445
  'test-case': testCase || null,
435
446
  tags: tagsArr,
436
447
  'scope-options': scopeOptions || {},
448
+ regions: regionsArr || null,
437
449
  'minimum-height': minHeight || null,
438
450
  'enable-javascript': enableJavaScript || null,
439
451
  'enable-layout': enableLayout || false,
@@ -503,6 +515,7 @@ export class PercyClient {
503
515
  consideredElementsData,
504
516
  metadata,
505
517
  sync,
518
+ regions,
506
519
  meta = {}
507
520
  } = {}) {
508
521
  validateId('snapshot', snapshotId);
@@ -517,6 +530,7 @@ export class PercyClient {
517
530
  tile.content = await fs.promises.readFile(tile.filepath);
518
531
  }
519
532
  }
533
+ let regionsArr = ensureElementSelector(regions);
520
534
  this.log.debug(`${tiles.length} tiles for comparision: ${tag.name}...`, meta);
521
535
  return this.post(`snapshots/${snapshotId}/comparisons`, {
522
536
  data: {
@@ -524,6 +538,7 @@ export class PercyClient {
524
538
  attributes: {
525
539
  'external-debug-url': externalDebugUrl || null,
526
540
  'ignore-elements-data': ignoredElementsData || null,
541
+ regions: regionsArr || null,
527
542
  'consider-elements-data': consideredElementsData || null,
528
543
  'dom-info-sha': domInfoSha || null,
529
544
  sync: !!sync,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/client",
3
- "version": "1.30.9-beta.2",
3
+ "version": "1.30.9-beta.3",
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.2",
37
- "@percy/logger": "1.30.9-beta.2",
36
+ "@percy/env": "1.30.9-beta.3",
37
+ "@percy/logger": "1.30.9-beta.3",
38
38
  "pac-proxy-agent": "^7.0.2",
39
39
  "pako": "^2.1.0"
40
40
  },
41
- "gitHead": "13493f9b47d1c7bc9e6f86a1499970012e4e169a"
41
+ "gitHead": "06ceb56e04806677d41a22eb1ccbee81a8d32c15"
42
42
  }