@applitools/spec-driver-puppeteer 1.3.5 → 1.4.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/CHANGELOG.md +38 -0
- package/dist/spec-driver.js +36 -10
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.3](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-puppeteer@1.4.2...js/spec-driver-puppeteer@1.4.3) (2024-03-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* @applitools/driver bumped to 1.16.5
|
|
9
|
+
#### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* trigger js release again ([1695f3d](https://github.com/Applitools-Dev/sdk/commit/1695f3d9967c7ab7b5d8c8637e86faa935a9047f))
|
|
12
|
+
|
|
13
|
+
## [1.4.2](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-puppeteer@1.4.1...js/spec-driver-puppeteer@1.4.2) (2024-03-18)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* @applitools/driver bumped to 1.16.4
|
|
19
|
+
#### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* trigger js release ([dbc9bf8](https://github.com/Applitools-Dev/sdk/commit/dbc9bf8da3ab5d93e570881ba2c61efa47a1b342))
|
|
22
|
+
|
|
23
|
+
## [1.4.1](https://github.com/Applitools-Dev/sdk/compare/js/spec-driver-puppeteer@1.4.0...js/spec-driver-puppeteer@1.4.1) (2024-03-17)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Dependencies
|
|
27
|
+
|
|
28
|
+
* @applitools/driver bumped to 1.16.3
|
|
29
|
+
#### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* skip execution of getCurrentWorld and getWorlds when env var is set ([#2234](https://github.com/Applitools-Dev/sdk/issues/2234)) ([3a88602](https://github.com/Applitools-Dev/sdk/commit/3a886028b0437b73dae0474408d9bb74ba940dec))
|
|
32
|
+
* trigger build ([acb9c88](https://github.com/Applitools-Dev/sdk/commit/acb9c88161cf55e8b1e409425b5571d69a2e1d5c))
|
|
33
|
+
|
|
34
|
+
## [1.4.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/spec-driver-puppeteer@1.3.5...js/spec-driver-puppeteer@1.4.0) (2024-02-13)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
* added support for puppeteer >= 22 ([#2185](https://github.com/applitools/eyes.sdk.javascript1/issues/2185)) ([59d23a9](https://github.com/applitools/eyes.sdk.javascript1/commit/59d23a9689d77c7db06df53b67fa293a3b3f166e))
|
|
40
|
+
|
|
3
41
|
## [1.3.5](https://github.com/applitools/eyes.sdk.javascript1/compare/js/spec-driver-puppeteer@1.3.4...js/spec-driver-puppeteer@1.3.5) (2024-01-30)
|
|
4
42
|
|
|
5
43
|
|
package/dist/spec-driver.js
CHANGED
|
@@ -100,6 +100,26 @@ const XPATH_SELECTOR_START = ['/', '(', '../', './', '*/'];
|
|
|
100
100
|
function isXpathSelector(selector) {
|
|
101
101
|
return XPATH_SELECTOR_START.some(start => selector.startsWith(start));
|
|
102
102
|
}
|
|
103
|
+
function getFrameworkMajorVersion() {
|
|
104
|
+
let frameworkManifestPath;
|
|
105
|
+
try {
|
|
106
|
+
frameworkManifestPath = require.resolve('puppeteer/package.json', { paths: [`${process.cwd()}/node_modules`] });
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
frameworkManifestPath = 'puppeteer/package.json';
|
|
110
|
+
}
|
|
111
|
+
return Number.parseInt(require(frameworkManifestPath).version);
|
|
112
|
+
}
|
|
113
|
+
function getPuppeteer() {
|
|
114
|
+
let frameworkPath;
|
|
115
|
+
try {
|
|
116
|
+
frameworkPath = require.resolve('puppeteer', { paths: [`${process.cwd()}/node_modules`] });
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
frameworkPath = 'puppeteer';
|
|
120
|
+
}
|
|
121
|
+
return require(frameworkPath);
|
|
122
|
+
}
|
|
103
123
|
function isDriver(page) {
|
|
104
124
|
if (!page)
|
|
105
125
|
return false;
|
|
@@ -155,12 +175,22 @@ async function executeScript(frame, script, arg) {
|
|
|
155
175
|
exports.executeScript = executeScript;
|
|
156
176
|
async function findElement(frame, selector, parent) {
|
|
157
177
|
const root = parent !== null && parent !== void 0 ? parent : frame;
|
|
158
|
-
|
|
178
|
+
if (isXpathSelector(selector)) {
|
|
179
|
+
return getFrameworkMajorVersion() < 22
|
|
180
|
+
? root.$x(selector).then(elements => elements[0])
|
|
181
|
+
: root.$(`xpath/${selector}`);
|
|
182
|
+
}
|
|
183
|
+
return root.$(selector);
|
|
159
184
|
}
|
|
160
185
|
exports.findElement = findElement;
|
|
161
186
|
async function findElements(frame, selector, parent) {
|
|
162
187
|
const root = parent !== null && parent !== void 0 ? parent : frame;
|
|
163
|
-
|
|
188
|
+
if (isXpathSelector(selector)) {
|
|
189
|
+
return getFrameworkMajorVersion() < 22
|
|
190
|
+
? root.$x(selector)
|
|
191
|
+
: root.$$(`xpath/${selector}`);
|
|
192
|
+
}
|
|
193
|
+
return root.$$(selector);
|
|
164
194
|
}
|
|
165
195
|
exports.findElements = findElements;
|
|
166
196
|
async function setElementText(_frame, element, text) {
|
|
@@ -250,14 +280,8 @@ const browserNames = ['chrome', 'firefox'];
|
|
|
250
280
|
* installed in the SDK, then this function will error.
|
|
251
281
|
*/
|
|
252
282
|
async function build(env) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
frameworkPath = require.resolve('puppeteer', { paths: [`${process.cwd()}/node_modules`] });
|
|
256
|
-
}
|
|
257
|
-
catch {
|
|
258
|
-
frameworkPath = 'puppeteer';
|
|
259
|
-
}
|
|
260
|
-
const puppeteer = require(frameworkPath);
|
|
283
|
+
const puppeteer = getPuppeteer();
|
|
284
|
+
const puppeteerVersion = getFrameworkMajorVersion();
|
|
261
285
|
const parseEnv = require('@applitools/test-utils/src/parse-env');
|
|
262
286
|
const { browser, attach, proxy, args = [], headless } = parseEnv(env, 'cdp');
|
|
263
287
|
if (!browserNames.includes(browser))
|
|
@@ -278,6 +302,8 @@ async function build(env) {
|
|
|
278
302
|
product: browser,
|
|
279
303
|
protocol: 'cdp',
|
|
280
304
|
};
|
|
305
|
+
if (puppeteerVersion >= 22 && options.headless === true)
|
|
306
|
+
options.headless = 'shell';
|
|
281
307
|
if (proxy) {
|
|
282
308
|
options.proxy = {
|
|
283
309
|
server: proxy.https || proxy.http || proxy.server,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/spec-driver-puppeteer",
|
|
3
|
-
"version": "1.3
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"puppeteer",
|
|
6
6
|
"chrome devtools protocol",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"up:framework": "echo \"$(jq '.devDependencies.puppeteer = $ENV.APPLITOOLS_FRAMEWORK_VERSION' ./package.json)\" > ./package.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@applitools/driver": "1.16.
|
|
43
|
+
"@applitools/driver": "1.16.5",
|
|
44
44
|
"@applitools/utils": "1.7.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@applitools/api-extractor": "^1.2.22",
|
|
48
48
|
"@applitools/test-utils": "^1.5.17",
|
|
49
49
|
"@types/node": "^12.20.55",
|
|
50
|
-
"puppeteer": "^
|
|
50
|
+
"puppeteer": "^22.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"puppeteer": ">=5.3.0"
|