@percy/core 1.30.4 → 1.30.5-alpha.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/discovery.js CHANGED
@@ -107,6 +107,9 @@ function waitForDiscoveryNetworkIdle(page, options) {
107
107
  let filter = r => hostnameMatches(allowedHostnames, r.url);
108
108
  return page.network.idle(filter, networkIdleTimeout, captureResponsiveAssetsEnabled);
109
109
  }
110
+ async function waitForFontLoading(page) {
111
+ await Promise.race([page.eval('await document.fonts.ready;'), new Promise(res => setTimeout(res, 5000))]);
112
+ }
110
113
 
111
114
  // Creates an initial resource map for a snapshot containing serialized DOM
112
115
  function parseDomResources({
@@ -264,6 +267,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
264
267
  deviceScaleFactor: device.deviceScaleFactor,
265
268
  mobile: true
266
269
  });
270
+ yield waitForFontLoading(page);
267
271
  yield waitForDiscoveryNetworkIdle(page, discovery);
268
272
  }
269
273
  }
@@ -345,6 +349,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
345
349
  for (let i = 0; i < widths.length - 1; i++) {
346
350
  if (captureWidths) yield* takeSnapshot(snap, width);
347
351
  yield page.evaluate(execute === null || execute === void 0 ? void 0 : execute.beforeResize);
352
+ yield waitForFontLoading(page);
348
353
  yield waitForDiscoveryNetworkIdle(page, discovery);
349
354
  yield resizePage(width = widths[i + 1]);
350
355
  if (snapshot.responsiveSnapshotCapture) {
@@ -376,6 +381,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
376
381
 
377
382
  // wait for final network idle when not capturing DOM
378
383
  if (capture && snapshot.domSnapshot) {
384
+ yield waitForFontLoading(page);
379
385
  yield waitForDiscoveryNetworkIdle(page, discovery);
380
386
  yield* captureResponsiveAssets();
381
387
  capture(processSnapshotResources(snapshot));
package/dist/timing.js ADDED
@@ -0,0 +1,21 @@
1
+ import logger from '@percy/logger';
2
+ export default class TimeIt {
3
+ log = logger('timer');
4
+ // returns a singleton instance
5
+ constructor() {
6
+ let {
7
+ instance = this
8
+ } = this.constructor;
9
+ this.constructor.instance = instance;
10
+ return instance;
11
+ }
12
+ async measure(name, identifier, callback) {
13
+ const startTime = Date.now();
14
+ try {
15
+ return await callback();
16
+ } finally {
17
+ const duration = Date.now() - startTime;
18
+ this.log.debug(`${name} - ${identifier} - ${duration / 1000}s`);
19
+ }
20
+ }
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.30.4",
3
+ "version": "1.30.5-alpha.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": "latest"
12
+ "tag": "alpha"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -43,11 +43,11 @@
43
43
  "test:types": "tsd"
44
44
  },
45
45
  "dependencies": {
46
- "@percy/client": "1.30.4",
47
- "@percy/config": "1.30.4",
48
- "@percy/dom": "1.30.4",
49
- "@percy/logger": "1.30.4",
50
- "@percy/webdriver-utils": "1.30.4",
46
+ "@percy/client": "1.30.5-alpha.0",
47
+ "@percy/config": "1.30.5-alpha.0",
48
+ "@percy/dom": "1.30.5-alpha.0",
49
+ "@percy/logger": "1.30.5-alpha.0",
50
+ "@percy/webdriver-utils": "1.30.5-alpha.0",
51
51
  "content-disposition": "^0.5.4",
52
52
  "cross-spawn": "^7.0.3",
53
53
  "extract-zip": "^2.0.1",
@@ -60,5 +60,5 @@
60
60
  "ws": "^8.17.1",
61
61
  "yaml": "^2.4.1"
62
62
  },
63
- "gitHead": "282289e3e0c9401f31483d6a52178fd00d1177f7"
63
+ "gitHead": "36a251be65edbc48f440a7645470933280c2357c"
64
64
  }