@applitools/spec-driver-puppeteer 1.7.5 → 1.8.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/CHANGELOG.md +29 -0
- package/dist/spec-driver.js +19 -5
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.8.0](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-puppeteer@1.7.5...js/spec-driver-puppeteer@1.8.0) (2026-05-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add bypassCSP support for UFG snapshot capture ([#3783](https://github.com/Applitools-Dev/sdk/issues/3783)) ([9e98933](https://github.com/Applitools-Dev/sdk/commit/9e98933b8ffba2ad1928aa2b2110e9a25209a599))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/dom-shared bumped to 1.2.0
|
|
14
|
+
#### Features
|
|
15
|
+
|
|
16
|
+
* add bypassCSP support for UFG snapshot capture ([#3783](https://github.com/Applitools-Dev/sdk/issues/3783)) ([9e98933](https://github.com/Applitools-Dev/sdk/commit/9e98933b8ffba2ad1928aa2b2110e9a25209a599))
|
|
17
|
+
* @applitools/snippets bumped to 2.9.0
|
|
18
|
+
#### Features
|
|
19
|
+
|
|
20
|
+
* add bypassCSP support for UFG snapshot capture ([#3783](https://github.com/Applitools-Dev/sdk/issues/3783)) ([9e98933](https://github.com/Applitools-Dev/sdk/commit/9e98933b8ffba2ad1928aa2b2110e9a25209a599))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
* @applitools/driver bumped to 1.26.0
|
|
25
|
+
#### Features
|
|
26
|
+
|
|
27
|
+
* add bypassCSP support for UFG snapshot capture ([#3783](https://github.com/Applitools-Dev/sdk/issues/3783)) ([9e98933](https://github.com/Applitools-Dev/sdk/commit/9e98933b8ffba2ad1928aa2b2110e9a25209a599))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
3
32
|
## [1.7.5](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-puppeteer@1.7.4...js/spec-driver-puppeteer@1.7.5) (2026-04-16)
|
|
4
33
|
|
|
5
34
|
|
package/dist/spec-driver.js
CHANGED
|
@@ -76,6 +76,8 @@ function transformArgument(arg) {
|
|
|
76
76
|
function scriptRunner(script, arg, ...elements) {
|
|
77
77
|
const func = new Function(script.startsWith('function') ? `return (${script}).apply(null, arguments)` : script);
|
|
78
78
|
return func(transform(arg));
|
|
79
|
+
// Use plain loops instead of Array/Object prototype methods — pages may monkey-patch
|
|
80
|
+
// Array.prototype.map, Object.entries, Object.assign, etc. to throw.
|
|
79
81
|
function transform(arg) {
|
|
80
82
|
if (!arg) {
|
|
81
83
|
return arg;
|
|
@@ -84,12 +86,18 @@ function scriptRunner(script, arg, ...elements) {
|
|
|
84
86
|
return elements.shift();
|
|
85
87
|
}
|
|
86
88
|
else if (Array.isArray(arg)) {
|
|
87
|
-
|
|
89
|
+
const result = [];
|
|
90
|
+
for (let i = 0; i < arg.length; i++)
|
|
91
|
+
result[i] = transform(arg[i]);
|
|
92
|
+
return result;
|
|
88
93
|
}
|
|
89
94
|
else if (typeof arg === 'object') {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
const result = {};
|
|
96
|
+
for (const key in arg) {
|
|
97
|
+
if (Object.prototype.hasOwnProperty.call(arg, key))
|
|
98
|
+
result[key] = transform(arg[key]);
|
|
99
|
+
}
|
|
100
|
+
return result;
|
|
93
101
|
}
|
|
94
102
|
else {
|
|
95
103
|
return arg;
|
|
@@ -168,8 +176,9 @@ function extractContext(page) {
|
|
|
168
176
|
}
|
|
169
177
|
exports.extractContext = extractContext;
|
|
170
178
|
async function executeScript(frame, script, arg) {
|
|
179
|
+
const [argWithElementMarkers, ...elements] = transformArgument(arg);
|
|
171
180
|
script = utils.types.isString(script) ? script : `function() {return (${script.toString()}).apply(null, arguments)}`;
|
|
172
|
-
const result = await frame.evaluateHandle(scriptRunner, script, ...
|
|
181
|
+
const result = await frame.evaluateHandle(scriptRunner, script, argWithElementMarkers, ...elements);
|
|
173
182
|
return handleToObject(result);
|
|
174
183
|
}
|
|
175
184
|
exports.executeScript = executeScript;
|
|
@@ -183,6 +192,11 @@ async function executeBrowserCommands(page, commands, logger) {
|
|
|
183
192
|
lastResponse = await page.evaluateOnNewDocument(currentCommand.params.source);
|
|
184
193
|
}
|
|
185
194
|
break;
|
|
195
|
+
case 'Page.setBypassCSP':
|
|
196
|
+
if (currentCommand.params) {
|
|
197
|
+
await page.setBypassCSP(currentCommand.params.enabled);
|
|
198
|
+
}
|
|
199
|
+
break;
|
|
186
200
|
default: {
|
|
187
201
|
native = false;
|
|
188
202
|
const userAgent = await (await page.browser().userAgent()).toLowerCase();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/spec-driver-puppeteer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"puppeteer",
|
|
6
6
|
"chrome devtools protocol",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"up:framework": "echo \"$(jq '.devDependencies.puppeteer = $ENV.APPLITOOLS_FRAMEWORK_VERSION' ./package.json)\" > ./package.json"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@applitools/driver": "1.
|
|
44
|
+
"@applitools/driver": "1.26.0",
|
|
45
45
|
"@applitools/utils": "1.14.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|