@percy/core 1.26.0 → 1.26.2-beta.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/network.js CHANGED
@@ -9,7 +9,7 @@ const ALLOWED_RESOURCES = ['Document', 'Stylesheet', 'Image', 'Media', 'Font', '
9
9
  // The Interceptor class creates common handlers for dealing with intercepting asset requests
10
10
  // for a given page using various devtools protocol events and commands.
11
11
  export class Network {
12
- static TIMEOUT = 30000;
12
+ static TIMEOUT = undefined;
13
13
  log = logger('core:discovery');
14
14
  #pending = new Map();
15
15
  #requests = new Map();
@@ -25,6 +25,7 @@ export class Network {
25
25
  page.session.browser.version.userAgent.replace('Headless', '');
26
26
  this.intercept = options.intercept;
27
27
  this.meta = options.meta;
28
+ this._initializeNetworkIdleWaitTimeout();
28
29
  }
29
30
  watch(session) {
30
31
  session.on('Network.requestWillBeSent', this._handleRequestWillBeSent);
@@ -262,6 +263,13 @@ export class Network {
262
263
  }
263
264
  this._forgetRequest(request);
264
265
  };
266
+ _initializeNetworkIdleWaitTimeout() {
267
+ if (Network.TIMEOUT) return;
268
+ Network.TIMEOUT = parseInt(process.env.PERCY_NETWORK_IDLE_WAIT_TIMEOUT) || 30000;
269
+ if (Network.TIMEOUT > 60000) {
270
+ this.log.warn('Setting PERCY_NETWORK_IDLE_WAIT_TIMEOUT over 60000ms is not recommended. ' + 'If your page needs more than 60000ms to idle due to CPU/Network load, ' + 'its recommended to increase CI resources where this cli is running.');
271
+ }
272
+ }
265
273
  }
266
274
 
267
275
  // Returns the normalized origin URL of a request
package/dist/page.js CHANGED
@@ -4,7 +4,7 @@ import Network from './network.js';
4
4
  import { PERCY_DOM } from './api.js';
5
5
  import { hostname, waitFor, waitForTimeout as sleep, serializeFunction } from './utils.js';
6
6
  export class Page {
7
- static TIMEOUT = 30000;
7
+ static TIMEOUT = undefined;
8
8
  log = logger('core:page');
9
9
  constructor(session, options) {
10
10
  this.session = session;
@@ -12,6 +12,7 @@ export class Page {
12
12
  this.enableJavaScript = options.enableJavaScript ?? true;
13
13
  this.network = new Network(this, options);
14
14
  this.meta = options.meta;
15
+ this._initializeLoadTimeout();
15
16
  session.on('Runtime.executionContextCreated', this._handleExecutionContextCreated);
16
17
  session.on('Runtime.executionContextDestroyed', this._handleExecutionContextDestroyed);
17
18
  session.on('Runtime.executionContextsCleared', this._handleExecutionContextsCleared);
@@ -241,5 +242,12 @@ export class Page {
241
242
  _handleExecutionContextsCleared = () => {
242
243
  this.contextId = null;
243
244
  };
245
+ _initializeLoadTimeout() {
246
+ if (Page.TIMEOUT) return;
247
+ Page.TIMEOUT = parseInt(process.env.PERCY_PAGE_LOAD_TIMEOUT) || 30000;
248
+ if (Page.TIMEOUT > 60000) {
249
+ this.log.warn('Setting PERCY_PAGE_LOAD_TIMEOUT over 60000ms is not recommended. ' + 'If your page needs more than 60000ms to load due to CPU/Network load, ' + 'its recommended to increase CI resources where this cli is running.');
250
+ }
251
+ }
244
252
  }
245
253
  export default Page;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.26.0",
3
+ "version": "1.26.2-beta.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": "beta"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -40,10 +40,10 @@
40
40
  "test:types": "tsd"
41
41
  },
42
42
  "dependencies": {
43
- "@percy/client": "1.26.0",
44
- "@percy/config": "1.26.0",
45
- "@percy/dom": "1.26.0",
46
- "@percy/logger": "1.26.0",
43
+ "@percy/client": "1.26.2-beta.0",
44
+ "@percy/config": "1.26.2-beta.0",
45
+ "@percy/dom": "1.26.2-beta.0",
46
+ "@percy/logger": "1.26.2-beta.0",
47
47
  "content-disposition": "^0.5.4",
48
48
  "cross-spawn": "^7.0.3",
49
49
  "extract-zip": "^2.0.1",
@@ -54,5 +54,5 @@
54
54
  "rimraf": "^3.0.2",
55
55
  "ws": "^8.0.0"
56
56
  },
57
- "gitHead": "0792d3978ca2169a45e8788eba012a61f81f5159"
57
+ "gitHead": "14191aa65d5da5190039ae0938c9fd8edab7cd28"
58
58
  }