@applitools/screenshoter 3.8.13 → 3.8.15
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 +60 -0
- package/package.json +7 -8
- package/src/take-screenshot.js +11 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.8.15](https://github.com/applitools/eyes.sdk.javascript1/compare/js/screenshoter@3.8.14...js/screenshoter@3.8.15) (2023-11-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Dependencies
|
|
7
|
+
|
|
8
|
+
* @applitools/spec-driver-webdriver bumped to 1.0.49
|
|
9
|
+
|
|
10
|
+
* @applitools/driver bumped to 1.15.0
|
|
11
|
+
#### Features
|
|
12
|
+
|
|
13
|
+
* added warning when driver used with capabilities that may conflict with applitools lib workflow ([#2011](https://github.com/applitools/eyes.sdk.javascript1/issues/2011)) ([081006d](https://github.com/applitools/eyes.sdk.javascript1/commit/081006d879894db03a2713129b66586496b6eb02))
|
|
14
|
+
|
|
15
|
+
## [3.8.14](https://github.com/applitools/eyes.sdk.javascript1/compare/js/screenshoter@3.8.13...js/screenshoter@3.8.14) (2023-10-17)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* allow css scrolling when taking screenshot of the webview ([2d3a257](https://github.com/applitools/eyes.sdk.javascript1/commit/2d3a2572768e7f979d16297ca316a79ab2538adb))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Code Refactoring
|
|
24
|
+
|
|
25
|
+
* disallow usage of global Buffer ([#1957](https://github.com/applitools/eyes.sdk.javascript1/issues/1957)) ([adcc082](https://github.com/applitools/eyes.sdk.javascript1/commit/adcc082f20f6b92e819b96424e995d9a69d99758))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Dependencies
|
|
29
|
+
|
|
30
|
+
* @applitools/utils bumped to 1.6.2
|
|
31
|
+
#### Code Refactoring
|
|
32
|
+
|
|
33
|
+
* disallow usage of global Buffer ([#1957](https://github.com/applitools/eyes.sdk.javascript1/issues/1957)) ([adcc082](https://github.com/applitools/eyes.sdk.javascript1/commit/adcc082f20f6b92e819b96424e995d9a69d99758))
|
|
34
|
+
* @applitools/logger bumped to 2.0.12
|
|
35
|
+
#### Code Refactoring
|
|
36
|
+
|
|
37
|
+
* disallow usage of global Buffer ([#1957](https://github.com/applitools/eyes.sdk.javascript1/issues/1957)) ([adcc082](https://github.com/applitools/eyes.sdk.javascript1/commit/adcc082f20f6b92e819b96424e995d9a69d99758))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
* @applitools/image bumped to 1.1.7
|
|
42
|
+
#### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* avoid using ascii text decoder ([1b68d39](https://github.com/applitools/eyes.sdk.javascript1/commit/1b68d3945d96b17b9ab1f1a87d352206fd0c81d6))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
#### Code Refactoring
|
|
48
|
+
|
|
49
|
+
* disallow usage of global Buffer ([#1957](https://github.com/applitools/eyes.sdk.javascript1/issues/1957)) ([adcc082](https://github.com/applitools/eyes.sdk.javascript1/commit/adcc082f20f6b92e819b96424e995d9a69d99758))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
* @applitools/spec-driver-webdriver bumped to 1.0.48
|
|
54
|
+
|
|
55
|
+
* @applitools/driver bumped to 1.14.4
|
|
56
|
+
#### Code Refactoring
|
|
57
|
+
|
|
58
|
+
* disallow usage of global Buffer ([#1957](https://github.com/applitools/eyes.sdk.javascript1/issues/1957)) ([adcc082](https://github.com/applitools/eyes.sdk.javascript1/commit/adcc082f20f6b92e819b96424e995d9a69d99758))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
3
63
|
## [3.8.13](https://github.com/applitools/eyes.sdk.javascript1/compare/js/screenshoter@3.8.12...js/screenshoter@3.8.13) (2023-09-29)
|
|
4
64
|
|
|
5
65
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/screenshoter",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.15",
|
|
4
4
|
"description": "Applitools universal screenshoter for web and native applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"test:unit": "MOCHA_GROUP=unit run --top-level mocha ./test/unit/*.spec.js",
|
|
44
44
|
"test:it": "MOCHA_GROUP=it run --top-level mocha ./test/it/*.spec.js",
|
|
45
45
|
"test:e2e": "yarn test:e2e:web && yarn test:e2e:android && yarn test:e2e:ios",
|
|
46
|
-
"test:e2e:web": "MOCHA_GROUP=web run --top-level mocha ./test/e2e/web/*.spec.js
|
|
46
|
+
"test:e2e:web": "MOCHA_GROUP=web run --top-level mocha ./test/e2e/web/*.spec.js",
|
|
47
47
|
"test:e2e:android": "APPLITOOLS_TEST_REMOTE=sauce MOCHA_GROUP=android run --top-level mocha ./test/e2e/android*/*.spec.js --parallel --jobs ${MOCHA_JOBS:-3}",
|
|
48
48
|
"test:e2e:ios": "APPLITOOLS_TEST_REMOTE=sauce MOCHA_GROUP=ios run --top-level mocha ./test/e2e/ios*/*.spec.js --parallel --jobs ${MOCHA_JOBS:-4}",
|
|
49
49
|
"setup": "yarn setup:web",
|
|
@@ -56,17 +56,16 @@
|
|
|
56
56
|
"appium:setup": "mkdir -p ./logs && appium --address 127.0.0.1 --port 4723 --base-path /wd/hub --log-level error:info --log ./logs/appium.log --relaxed-security &"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@applitools/image": "1.1.
|
|
60
|
-
"@applitools/logger": "2.0.
|
|
59
|
+
"@applitools/image": "1.1.7",
|
|
60
|
+
"@applitools/logger": "2.0.12",
|
|
61
61
|
"@applitools/snippets": "2.4.24",
|
|
62
|
-
"@applitools/utils": "1.6.
|
|
62
|
+
"@applitools/utils": "1.6.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@applitools/driver": "^1.
|
|
66
|
-
"@applitools/spec-driver-webdriver": "^1.0.
|
|
65
|
+
"@applitools/driver": "^1.15.0",
|
|
66
|
+
"@applitools/spec-driver-webdriver": "^1.0.49",
|
|
67
67
|
"@applitools/test-utils": "^1.5.17",
|
|
68
68
|
"appium": "^1.22.3",
|
|
69
|
-
"chromedriver": "^115.0.1",
|
|
70
69
|
"pixelmatch": "^5.3.0",
|
|
71
70
|
"webdriver": "^7.31.1"
|
|
72
71
|
},
|
package/src/take-screenshot.js
CHANGED
|
@@ -33,24 +33,28 @@ async function takeScreenshot({
|
|
|
33
33
|
// screenshot of a window/app was requested (fully or viewport)
|
|
34
34
|
const window = !region && (!frames || frames.length === 0)
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const originalEnvironment = await driver.getEnvironment()
|
|
37
37
|
|
|
38
|
-
//
|
|
38
|
+
// world should be switched to webview if webview screenshot or the window screenshot is requested
|
|
39
|
+
// in case of window screenshot we will be switching to native app view
|
|
39
40
|
let activeWorld
|
|
40
|
-
if (
|
|
41
|
+
if (originalEnvironment.isNative && (webview || (window && originalEnvironment.isWeb))) {
|
|
41
42
|
if (webview === true) {
|
|
42
43
|
const worlds = await driver.getWorlds()
|
|
43
44
|
webview = worlds && worlds.find(name => name.includes('WEBVIEW'))
|
|
44
45
|
}
|
|
45
46
|
activeWorld = await driver.getCurrentWorld()
|
|
46
|
-
await driver.switchWorld(webview)
|
|
47
|
+
if (activeWorld !== webview) await driver.switchWorld(webview)
|
|
48
|
+
else activeWorld = undefined
|
|
47
49
|
}
|
|
48
50
|
|
|
51
|
+
const environment = await driver.getEnvironment()
|
|
52
|
+
|
|
49
53
|
// framed screenshots could be taken only when screenshot of window/app fully was requested
|
|
50
54
|
framed = framed && fully && window
|
|
51
55
|
// screenshots with status bar could be taken only when screenshot of app or framed app fully was requested
|
|
52
56
|
withStatusBar = withStatusBar && environment.isNative && window && (!fully || framed)
|
|
53
|
-
scrollingMode = environment.
|
|
57
|
+
scrollingMode = !environment.isWeb ? 'scroll' : scrollingMode
|
|
54
58
|
|
|
55
59
|
const activeContext = driver.currentContext
|
|
56
60
|
const context =
|
|
@@ -65,7 +69,7 @@ async function takeScreenshot({
|
|
|
65
69
|
if (scrollingElement) {
|
|
66
70
|
if (environment.isWeb && hideScrollbars) await scrollingElement.hideScrollbars()
|
|
67
71
|
// this is unwanted but necessary side effect, because it is not possible to extract initial scroll position
|
|
68
|
-
if (environment.
|
|
72
|
+
if (!environment.isWeb && !window) await scrollingElement.scrollTo({x: 0, y: 0}, {force: true})
|
|
69
73
|
await scrollingElement.preserveState()
|
|
70
74
|
}
|
|
71
75
|
}
|
|
@@ -80,7 +84,7 @@ async function takeScreenshot({
|
|
|
80
84
|
if (environment.isWeb && hideScrollbars) await target.scroller.hideScrollbars()
|
|
81
85
|
}
|
|
82
86
|
|
|
83
|
-
if (!window &&
|
|
87
|
+
if (!window && environment.isWeb) await scrollIntoViewport({...target, logger})
|
|
84
88
|
|
|
85
89
|
if (fully && !target.region && target.scroller) await target.scroller.moveTo({x: 0, y: 0})
|
|
86
90
|
|