@percy/core 1.31.5-beta.2 → 1.31.5
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/api.js +1 -1
- package/dist/config.js +27 -0
- package/dist/discovery.js +1 -0
- package/dist/page.js +10 -11
- package/package.json +9 -9
package/dist/api.js
CHANGED
|
@@ -118,7 +118,7 @@ export function createPercyServer(percy, port) {
|
|
|
118
118
|
.route('get', '/percy-agent.js', async (req, res) => {
|
|
119
119
|
logger('core:server').deprecated(['It looks like you’re using @percy/cli with an older SDK.', 'Please upgrade to the latest version to fix this warning.', 'See these docs for more info: https://www.browserstack.com/docs/percy/migration/migrate-to-cli'].join(' '));
|
|
120
120
|
let content = await fs.promises.readFile(PERCY_DOM, 'utf-8');
|
|
121
|
-
let wrapper = '(window.PercyAgent = class {
|
|
121
|
+
let wrapper = '(window.PercyAgent = class { snapshot(n, o) { return PercyDOM.serialize(o); } });';
|
|
122
122
|
return res.send(200, 'application/javascript', content.concat(wrapper));
|
|
123
123
|
})
|
|
124
124
|
// post one or more snapshots, optionally async
|
package/dist/config.js
CHANGED
|
@@ -293,6 +293,30 @@ export const configSchema = {
|
|
|
293
293
|
ignoreStyleSheetSerializationErrors: {
|
|
294
294
|
type: 'boolean',
|
|
295
295
|
default: false
|
|
296
|
+
},
|
|
297
|
+
pseudoClassEnabledElements: {
|
|
298
|
+
type: 'object',
|
|
299
|
+
additionalProperties: false,
|
|
300
|
+
properties: {
|
|
301
|
+
id: {
|
|
302
|
+
type: 'array',
|
|
303
|
+
items: {
|
|
304
|
+
type: 'string'
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
className: {
|
|
308
|
+
type: 'array',
|
|
309
|
+
items: {
|
|
310
|
+
type: 'string'
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
xpath: {
|
|
314
|
+
type: 'array',
|
|
315
|
+
items: {
|
|
316
|
+
type: 'string'
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
296
320
|
}
|
|
297
321
|
}
|
|
298
322
|
},
|
|
@@ -531,6 +555,9 @@ export const snapshotSchema = {
|
|
|
531
555
|
ignoreStyleSheetSerializationErrors: {
|
|
532
556
|
$ref: '/config/snapshot#/properties/ignoreStyleSheetSerializationErrors'
|
|
533
557
|
},
|
|
558
|
+
pseudoClassEnabledElements: {
|
|
559
|
+
$ref: '/config/snapshot#/properties/pseudoClassEnabledElements'
|
|
560
|
+
},
|
|
534
561
|
discovery: {
|
|
535
562
|
type: 'object',
|
|
536
563
|
additionalProperties: false,
|
package/dist/discovery.js
CHANGED
|
@@ -57,6 +57,7 @@ function debugSnapshotOptions(snapshot) {
|
|
|
57
57
|
debugProp(snapshot, 'discovery.scrollToBottom');
|
|
58
58
|
debugProp(snapshot, 'ignoreCanvasSerializationErrors');
|
|
59
59
|
debugProp(snapshot, 'ignoreStyleSheetSerializationErrors');
|
|
60
|
+
debugProp(snapshot, 'pseudoClassEnabledElements', JSON.stringify);
|
|
60
61
|
if (Array.isArray(snapshot.domSnapshot)) {
|
|
61
62
|
debugProp(snapshot, 'domSnapshot.0.userAgent');
|
|
62
63
|
} else {
|
package/dist/page.js
CHANGED
|
@@ -187,7 +187,8 @@ export class Page {
|
|
|
187
187
|
domTransformation,
|
|
188
188
|
reshuffleInvalidTags,
|
|
189
189
|
ignoreCanvasSerializationErrors,
|
|
190
|
-
ignoreStyleSheetSerializationErrors
|
|
190
|
+
ignoreStyleSheetSerializationErrors,
|
|
191
|
+
pseudoClassEnabledElements
|
|
191
192
|
} = snapshot;
|
|
192
193
|
this.log.debug(`Taking snapshot: ${name}${width ? ` @${width}px` : ''}`, this.meta);
|
|
193
194
|
|
|
@@ -213,25 +214,23 @@ export class Page {
|
|
|
213
214
|
await this.network.idle();
|
|
214
215
|
await this.insertPercyDom();
|
|
215
216
|
|
|
216
|
-
// serialize and capture a DOM snapshot
|
|
217
|
+
// serialize and capture a DOM snapshot
|
|
217
218
|
this.log.debug('Serialize DOM', this.meta);
|
|
218
219
|
|
|
219
220
|
/* istanbul ignore next: no instrumenting injected code */
|
|
220
|
-
let capture = await this.eval(
|
|
221
|
-
/* eslint-disable no-undef */
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
};
|
|
226
|
-
/* eslint-enable no-undef */
|
|
227
|
-
}, {
|
|
221
|
+
let capture = await this.eval((_, options) => ({
|
|
222
|
+
/* eslint-disable-next-line no-undef */
|
|
223
|
+
domSnapshot: PercyDOM.serialize(options),
|
|
224
|
+
url: document.URL
|
|
225
|
+
}), {
|
|
228
226
|
enableJavaScript,
|
|
229
227
|
disableShadowDOM,
|
|
230
228
|
forceShadowAsLightDOM,
|
|
231
229
|
domTransformation,
|
|
232
230
|
reshuffleInvalidTags,
|
|
233
231
|
ignoreCanvasSerializationErrors,
|
|
234
|
-
ignoreStyleSheetSerializationErrors
|
|
232
|
+
ignoreStyleSheetSerializationErrors,
|
|
233
|
+
pseudoClassEnabledElements
|
|
235
234
|
});
|
|
236
235
|
return {
|
|
237
236
|
...snapshot,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/core",
|
|
3
|
-
"version": "1.31.5
|
|
3
|
+
"version": "1.31.5",
|
|
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": "
|
|
12
|
+
"tag": "latest"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
15
|
"node": ">=14"
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"test:types": "tsd"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@percy/client": "1.31.5
|
|
47
|
-
"@percy/config": "1.31.5
|
|
48
|
-
"@percy/dom": "1.31.5
|
|
49
|
-
"@percy/logger": "1.31.5
|
|
50
|
-
"@percy/monitoring": "1.31.5
|
|
51
|
-
"@percy/webdriver-utils": "1.31.5
|
|
46
|
+
"@percy/client": "1.31.5",
|
|
47
|
+
"@percy/config": "1.31.5",
|
|
48
|
+
"@percy/dom": "1.31.5",
|
|
49
|
+
"@percy/logger": "1.31.5",
|
|
50
|
+
"@percy/monitoring": "1.31.5",
|
|
51
|
+
"@percy/webdriver-utils": "1.31.5",
|
|
52
52
|
"content-disposition": "^0.5.4",
|
|
53
53
|
"cross-spawn": "^7.0.3",
|
|
54
54
|
"extract-zip": "^2.0.1",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"ws": "^8.17.1",
|
|
62
62
|
"yaml": "^2.4.1"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "835297c48a25843d8c719d6b476134c603721d13"
|
|
65
65
|
}
|