@percy/core 1.29.4-beta.2 → 1.29.4-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.
package/dist/discovery.js CHANGED
@@ -61,6 +61,19 @@ function debugSnapshotOptions(snapshot) {
61
61
  }
62
62
  }
63
63
 
64
+ // parse browser cookies in correct format if flag is enabled
65
+ // it assumes that cookiesStr is string returned by document.cookie
66
+ function parseCookies(cookiesStr) {
67
+ if (process.env.PERCY_DO_NOT_USE_CAPTURED_COOKIES === 'true' || !(typeof cookiesStr === 'string' && cookiesStr !== '')) return null;
68
+ return cookiesStr.split('; ').map(c => {
69
+ const eqIdx = c.indexOf('=');
70
+ return {
71
+ name: c.substring(0, eqIdx),
72
+ value: c.substring(eqIdx + 1)
73
+ };
74
+ });
75
+ }
76
+
64
77
  // Wait for a page's asset discovery network to idle
65
78
  function waitForDiscoveryNetworkIdle(page, options) {
66
79
  let {
@@ -163,6 +176,7 @@ function processSnapshotResources({
163
176
  // Triggers the capture of resource requests for a page by iterating over snapshot widths to resize
164
177
  // the page and calling any provided execute options.
165
178
  async function* captureSnapshotResources(page, snapshot, options) {
179
+ var _snapshot$domSnapshot;
166
180
  const log = logger('core:discovery');
167
181
  let {
168
182
  discovery,
@@ -176,20 +190,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
176
190
  mobile,
177
191
  captureForDevices
178
192
  } = options;
179
- let cookies;
180
- if (process.env.PERCY_DO_NOT_USE_CAPTURED_COOKIES !== 'true') {
181
- var _snapshot$domSnapshot;
182
- cookies = snapshot === null || snapshot === void 0 ? void 0 : (_snapshot$domSnapshot = snapshot.domSnapshot) === null || _snapshot$domSnapshot === void 0 ? void 0 : _snapshot$domSnapshot.cookies;
183
- }
184
- if (typeof cookies === 'string' && cookies !== '') {
185
- cookies = cookies.split('; ').map(c => c.split('='));
186
- cookies = cookies.map(([key, value]) => {
187
- return {
188
- name: key,
189
- value: value
190
- };
191
- });
192
- }
193
+ let cookies = parseCookies(snapshot === null || snapshot === void 0 ? void 0 : (_snapshot$domSnapshot = snapshot.domSnapshot) === null || _snapshot$domSnapshot === void 0 ? void 0 : _snapshot$domSnapshot.cookies);
193
194
 
194
195
  // iterate over device to trigger reqeusts and capture other dpr width
195
196
  async function* captureResponsiveAssets() {
package/dist/network.js CHANGED
@@ -510,7 +510,7 @@ async function saveResponseResource(network, request) {
510
510
  // font anyway as font responses from the browser may not be properly encoded,
511
511
  // so request them directly.
512
512
  if (mimeType !== null && mimeType !== void 0 && mimeType.includes('font') || detectedMime && detectedMime.includes('font')) {
513
- log.debug('- Requesting asset directly');
513
+ log.debug('- Requesting asset directly', meta);
514
514
  body = await makeDirectRequest(network, request);
515
515
  }
516
516
  resource = createResource(url, body, mimeType, {
@@ -525,7 +525,7 @@ async function saveResponseResource(network, request) {
525
525
  log.debug(`- mimetype: ${resource.mimetype}`, meta);
526
526
  } catch (error) {
527
527
  log.debug(`Encountered an error processing resource: ${url}`, meta);
528
- log.debug(error);
528
+ log.debug(error, meta);
529
529
  }
530
530
  }
531
531
  if (resource) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.29.4-beta.2",
3
+ "version": "1.29.4-beta.3",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,11 +43,11 @@
43
43
  "test:types": "tsd"
44
44
  },
45
45
  "dependencies": {
46
- "@percy/client": "1.29.4-beta.2",
47
- "@percy/config": "1.29.4-beta.2",
48
- "@percy/dom": "1.29.4-beta.2",
49
- "@percy/logger": "1.29.4-beta.2",
50
- "@percy/webdriver-utils": "1.29.4-beta.2",
46
+ "@percy/client": "1.29.4-beta.3",
47
+ "@percy/config": "1.29.4-beta.3",
48
+ "@percy/dom": "1.29.4-beta.3",
49
+ "@percy/logger": "1.29.4-beta.3",
50
+ "@percy/webdriver-utils": "1.29.4-beta.3",
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": "f316b7f672fbec81d3f13c53591735f102bc17a1"
63
+ "gitHead": "8c61c0ad7a8a1b61f199a2a011ac296764cdc2eb"
64
64
  }