@applitools/screenshoter 3.5.4 → 3.6.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/screenshoter",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Applitools universal screenshoter for web and native applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@applitools/image": "1.0.2",
|
|
76
|
-
"@applitools/logger": "1.1.
|
|
76
|
+
"@applitools/logger": "1.1.24",
|
|
77
77
|
"@applitools/snippets": "2.4.5",
|
|
78
78
|
"@applitools/utils": "1.3.12",
|
|
79
79
|
"jpeg-js": "0.4.4",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@applitools/bongo": "^2.2.0",
|
|
84
|
-
"@applitools/driver": "^1.
|
|
84
|
+
"@applitools/driver": "^1.10.3",
|
|
85
85
|
"@applitools/scripts": "^1.1.0",
|
|
86
|
-
"@applitools/spec-driver-webdriverio": "^1.
|
|
86
|
+
"@applitools/spec-driver-webdriverio": "^1.3.0",
|
|
87
87
|
"@applitools/test-utils": "^1.5.1",
|
|
88
88
|
"appium": "^1.22.3",
|
|
89
89
|
"chromedriver": "^101.0.0",
|
package/src/take-screenshot.js
CHANGED
|
@@ -23,13 +23,20 @@ async function takeScreenshot({
|
|
|
23
23
|
debug,
|
|
24
24
|
logger,
|
|
25
25
|
lazyLoad,
|
|
26
|
+
webview,
|
|
26
27
|
}) {
|
|
27
28
|
debug =
|
|
28
29
|
debug ||
|
|
29
30
|
(process.env.APPLITOOLS_DEBUG_SCREENSHOTS_DIR ? {path: process.env.APPLITOOLS_DEBUG_SCREENSHOTS_DIR} : debug)
|
|
30
31
|
logger = logger ? logger.extend({label: 'screenshoter'}) : makeLogger({label: 'screenshoter'})
|
|
32
|
+
|
|
31
33
|
// screenshot of a window/app was requested (fully or viewport)
|
|
32
34
|
const window = !region && (!frames || frames.length === 0)
|
|
35
|
+
|
|
36
|
+
// switch worlds as needed
|
|
37
|
+
if (webview && driver.isNative) await driver.switchWorld(typeof webview === 'string' ? {id: webview} : null)
|
|
38
|
+
if (window && !webview && driver.isWebView) await driver.switchWorld({goHome: true})
|
|
39
|
+
|
|
33
40
|
// framed screenshots could be taken only when screenshot of window/app fully was requested
|
|
34
41
|
framed = framed && fully && window
|
|
35
42
|
// screenshots with status bar could be taken only when screenshot of app or framed app fully was requested
|
|
@@ -115,6 +122,9 @@ async function takeScreenshot({
|
|
|
115
122
|
|
|
116
123
|
// restore focus on original active context
|
|
117
124
|
await activeContext.focus()
|
|
125
|
+
|
|
126
|
+
// return driver to previous app world if switched
|
|
127
|
+
await driver.switchWorld({restoreState: true})
|
|
118
128
|
},
|
|
119
129
|
}
|
|
120
130
|
}
|
|
@@ -7,7 +7,7 @@ function makeTakeViewportScreenshot(options) {
|
|
|
7
7
|
const {driver} = options
|
|
8
8
|
if (driver.isNative) {
|
|
9
9
|
return makeTakeNativeScreenshot(options)
|
|
10
|
-
} else if (driver.isIOS) {
|
|
10
|
+
} else if (driver.isIOS || driver.isWebView) {
|
|
11
11
|
// safari on ios takes screenshot with browser and os interfaces
|
|
12
12
|
return makeTakeMarkedScreenshot(options)
|
|
13
13
|
} else if (driver.browserName === 'Firefox') {
|