@applitools/screenshoter 3.8.12 → 3.8.14

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 CHANGED
@@ -1,5 +1,70 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.8.14](https://github.com/applitools/eyes.sdk.javascript1/compare/js/screenshoter@3.8.13...js/screenshoter@3.8.14) (2023-10-17)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * allow css scrolling when taking screenshot of the webview ([2d3a257](https://github.com/applitools/eyes.sdk.javascript1/commit/2d3a2572768e7f979d16297ca316a79ab2538adb))
9
+
10
+
11
+ ### Code Refactoring
12
+
13
+ * 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))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * @applitools/utils bumped to 1.6.2
19
+ #### Code Refactoring
20
+
21
+ * 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))
22
+ * @applitools/logger bumped to 2.0.12
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
+
29
+ * @applitools/image bumped to 1.1.7
30
+ #### Bug Fixes
31
+
32
+ * avoid using ascii text decoder ([1b68d39](https://github.com/applitools/eyes.sdk.javascript1/commit/1b68d3945d96b17b9ab1f1a87d352206fd0c81d6))
33
+
34
+
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/spec-driver-webdriver bumped to 1.0.48
42
+
43
+ * @applitools/driver bumped to 1.14.4
44
+ #### Code Refactoring
45
+
46
+ * 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))
47
+
48
+
49
+
50
+
51
+ ## [3.8.13](https://github.com/applitools/eyes.sdk.javascript1/compare/js/screenshoter@3.8.12...js/screenshoter@3.8.13) (2023-09-29)
52
+
53
+
54
+ ### Bug Fixes
55
+
56
+ * force native on get environment ([#1939](https://github.com/applitools/eyes.sdk.javascript1/issues/1939)) ([f42854e](https://github.com/applitools/eyes.sdk.javascript1/commit/f42854eacc769751447204143cb4d50113edc732))
57
+
58
+
59
+ ### Dependencies
60
+
61
+ * @applitools/spec-driver-webdriver bumped to 1.0.47
62
+
63
+ * @applitools/driver bumped to 1.14.3
64
+ #### Bug Fixes
65
+
66
+ * force native on get environment ([#1939](https://github.com/applitools/eyes.sdk.javascript1/issues/1939)) ([f42854e](https://github.com/applitools/eyes.sdk.javascript1/commit/f42854eacc769751447204143cb4d50113edc732))
67
+
3
68
  ## [3.8.12](https://github.com/applitools/eyes.sdk.javascript1/compare/js/screenshoter@3.8.11...js/screenshoter@3.8.12) (2023-09-25)
4
69
 
5
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/screenshoter",
3
- "version": "3.8.12",
3
+ "version": "3.8.14",
4
4
  "description": "Applitools universal screenshoter for web and native applications",
5
5
  "keywords": [
6
6
  "applitools",
@@ -56,14 +56,14 @@
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.6",
60
- "@applitools/logger": "2.0.11",
59
+ "@applitools/image": "1.1.7",
60
+ "@applitools/logger": "2.0.12",
61
61
  "@applitools/snippets": "2.4.24",
62
- "@applitools/utils": "1.6.1"
62
+ "@applitools/utils": "1.6.2"
63
63
  },
64
64
  "devDependencies": {
65
- "@applitools/driver": "^1.14.2",
66
- "@applitools/spec-driver-webdriver": "^1.0.46",
65
+ "@applitools/driver": "^1.14.4",
66
+ "@applitools/spec-driver-webdriver": "^1.0.48",
67
67
  "@applitools/test-utils": "^1.5.17",
68
68
  "appium": "^1.22.3",
69
69
  "chromedriver": "^115.0.1",
@@ -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 environment = await driver.getEnvironment()
36
+ const originalEnvironment = await driver.getEnvironment()
37
37
 
38
- // switch worlds as needed
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 (environment.isNative && (webview || (window && environment.isWeb))) {
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.isNative ? 'scroll' : scrollingMode
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.isNative && !window) await scrollingElement.scrollTo({x: 0, y: 0}, {force: true})
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 && !environment.isNative) await scrollIntoViewport({...target, logger})
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