@applitools/screenshoter 3.3.13 → 3.3.16

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.13",
3
+ "version": "3.3.16",
4
4
  "description": "Applitools universal screenshoter for web and native applications",
5
5
  "keywords": [
6
6
  "applitools",
@@ -35,7 +35,7 @@
35
35
  "test": "yarn test:it && yarn test:e2e",
36
36
  "test:unit": "mocha ./test/unit/*.spec.js --no-timeouts",
37
37
  "test:it": "mocha ./test/it/*.spec.js --no-timeouts",
38
- "test:e2e": "mocha ./test/e2e/**/*.spec.js --no-timeouts --parallel --jobs ${MOCHA_JOBS:-1}",
38
+ "test:e2e": "yarn test:e2e:web && yarn && test:e2e:android && yarn test:e2e:ios",
39
39
  "test:e2e:web": "APPLITOOLS_SHOW_LOGS=true mocha ./test/e2e/web/*.spec.js --no-timeouts -r @applitools/test-utils/mocha-hooks/docker",
40
40
  "test:e2e:android": "APPLITOOLS_TEST_REMOTE=sauce mocha ./test/e2e/android*/*.spec.js --no-timeouts --parallel --jobs ${MOCHA_JOBS:-2}",
41
41
  "test:e2e:ios": "APPLITOOLS_TEST_REMOTE=sauce mocha ./test/e2e/ios*/*.spec.js --no-timeouts --parallel --jobs ${MOCHA_JOBS:-2}",
@@ -61,15 +61,15 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@applitools/snippets": "2.2.2",
64
- "@applitools/utils": "1.2.13",
64
+ "@applitools/utils": "1.2.14",
65
65
  "png-async": "0.9.4"
66
66
  },
67
67
  "devDependencies": {
68
- "@applitools/driver": "1.5.5",
68
+ "@applitools/bongo": "^2.0.3",
69
+ "@applitools/driver": "1.7.0",
69
70
  "@applitools/scripts": "1.1.0",
70
- "@applitools/sdk-release-kit": "1.0.4",
71
71
  "@applitools/spec-driver-webdriverio": "1.2.8",
72
- "@applitools/test-utils": "1.1.5",
72
+ "@applitools/test-utils": "1.3.1",
73
73
  "appium": "^1.22.2",
74
74
  "chromedriver": "^95.0.0",
75
75
  "eslint": "^7.9.0",
package/src/getTarget.js CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  const utils = require('@applitools/utils')
4
4
 
5
+ function isNavigationBar(region) {
6
+ if (
7
+ (region.value && region.value.includes(`type == "XCUIElementTypeNavigationBar"`)) ||
8
+ (region.selector && region.selector.includes(`type == "XCUIElementTypeNavigationBar"`))
9
+ ) {
10
+ return true
11
+ } else {
12
+ return false
13
+ }
14
+ }
15
+
16
+ function isTabBar(region) {
17
+ if (
18
+ (region.value && region.value.includes('type == "XCUIElementTypeTabBar"')) ||
19
+ (region.selector && region.selector.includes(`type == "XCUIElementTypeTabBar"`))
20
+ ) {
21
+ return true
22
+ } else {
23
+ return false
24
+ }
25
+ }
26
+
5
27
  async function getTarget({window, context, region, fully, scrollingMode}) {
6
28
  if (window) {
7
29
  // window/app
@@ -41,9 +63,11 @@ async function getTarget({window, context, region, fully, scrollingMode}) {
41
63
  }
42
64
  } else {
43
65
  const scrollingElement = await context.getScrollingElement()
66
+ const navBar = isNavigationBar(region)
67
+ const tabBar = isTabBar(region)
44
68
  return {
45
69
  context: elementContext,
46
- region: await element.getRegion(),
70
+ region: await element.getRegion(navBar || tabBar),
47
71
  scrollingElement,
48
72
  }
49
73
  }
@@ -163,7 +163,18 @@ function makeTakeNativeScreenshot({driver, stabilization = {}, debug, logger}) {
163
163
  const viewportSize = await driver.getViewportSize()
164
164
  const cropRegion = withStatusBar
165
165
  ? {x: 0, y: 0, width: viewportSize.width, height: viewportSize.height + driver.statusBarHeight}
166
- : {top: driver.statusBarHeight, bottom: driver.navigationBarHeight, left: 0, right: 0}
166
+ : {
167
+ top: driver.statusBarHeight,
168
+ bottom: driver.orientation === 'landscape' ? 0 : driver.navigationBarHeight,
169
+ left:
170
+ driver.isAndroid && driver.orientation === 'landscape' && driver.platformVersion > 7
171
+ ? driver.navigationBarHeight
172
+ : 0,
173
+ right:
174
+ driver.isAndroid && driver.orientation === 'landscape' && driver.platformVersion < 8
175
+ ? driver.navigationBarHeight
176
+ : 0,
177
+ }
167
178
  image.crop(cropRegion)
168
179
  }
169
180