@percy/core 1.29.4-beta.2 → 1.29.4-beta.4
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 +21 -14
- package/dist/network.js +2 -2
- package/package.json +7 -7
package/dist/discovery.js
CHANGED
|
@@ -61,6 +61,25 @@ 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
|
+
const name = c.substring(0, eqIdx);
|
|
71
|
+
const value = c.substring(eqIdx + 1);
|
|
72
|
+
const cookieObj = {
|
|
73
|
+
name,
|
|
74
|
+
value
|
|
75
|
+
};
|
|
76
|
+
if (name.startsWith('__Secure')) {
|
|
77
|
+
cookieObj.secure = true;
|
|
78
|
+
}
|
|
79
|
+
return cookieObj;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
64
83
|
// Wait for a page's asset discovery network to idle
|
|
65
84
|
function waitForDiscoveryNetworkIdle(page, options) {
|
|
66
85
|
let {
|
|
@@ -163,6 +182,7 @@ function processSnapshotResources({
|
|
|
163
182
|
// Triggers the capture of resource requests for a page by iterating over snapshot widths to resize
|
|
164
183
|
// the page and calling any provided execute options.
|
|
165
184
|
async function* captureSnapshotResources(page, snapshot, options) {
|
|
185
|
+
var _snapshot$domSnapshot;
|
|
166
186
|
const log = logger('core:discovery');
|
|
167
187
|
let {
|
|
168
188
|
discovery,
|
|
@@ -176,20 +196,7 @@ async function* captureSnapshotResources(page, snapshot, options) {
|
|
|
176
196
|
mobile,
|
|
177
197
|
captureForDevices
|
|
178
198
|
} = 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
|
-
}
|
|
199
|
+
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
200
|
|
|
194
201
|
// iterate over device to trigger reqeusts and capture other dpr width
|
|
195
202
|
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.
|
|
3
|
+
"version": "1.29.4-beta.4",
|
|
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.
|
|
47
|
-
"@percy/config": "1.29.4-beta.
|
|
48
|
-
"@percy/dom": "1.29.4-beta.
|
|
49
|
-
"@percy/logger": "1.29.4-beta.
|
|
50
|
-
"@percy/webdriver-utils": "1.29.4-beta.
|
|
46
|
+
"@percy/client": "1.29.4-beta.4",
|
|
47
|
+
"@percy/config": "1.29.4-beta.4",
|
|
48
|
+
"@percy/dom": "1.29.4-beta.4",
|
|
49
|
+
"@percy/logger": "1.29.4-beta.4",
|
|
50
|
+
"@percy/webdriver-utils": "1.29.4-beta.4",
|
|
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": "
|
|
63
|
+
"gitHead": "373606636f133996307a33529e6f45632d18bdd9"
|
|
64
64
|
}
|