@applitools/screenshoter 3.3.16 → 3.3.19
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 +7 -6
- package/src/getTarget.js +1 -27
- package/src/take-stitched-screenshot.js +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/screenshoter",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.19",
|
|
4
4
|
"description": "Applitools universal screenshoter for web and native applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -60,16 +60,17 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@applitools/snippets": "2.2.
|
|
64
|
-
"@applitools/utils": "1.
|
|
63
|
+
"@applitools/snippets": "2.2.3",
|
|
64
|
+
"@applitools/utils": "1.3.0",
|
|
65
65
|
"png-async": "0.9.4"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@applitools/bongo": "^2.0.3",
|
|
69
|
-
"@applitools/driver": "1.
|
|
69
|
+
"@applitools/driver": "^1.8.1",
|
|
70
|
+
"@applitools/logger": "^1.1.4",
|
|
70
71
|
"@applitools/scripts": "1.1.0",
|
|
71
|
-
"@applitools/spec-driver-webdriverio": "1.2.
|
|
72
|
-
"@applitools/test-utils": "1.3.
|
|
72
|
+
"@applitools/spec-driver-webdriverio": "1.2.9",
|
|
73
|
+
"@applitools/test-utils": "1.3.2",
|
|
73
74
|
"appium": "^1.22.2",
|
|
74
75
|
"chromedriver": "^95.0.0",
|
|
75
76
|
"eslint": "^7.9.0",
|
package/src/getTarget.js
CHANGED
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
1
|
const utils = require('@applitools/utils')
|
|
4
2
|
|
|
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
|
-
|
|
27
3
|
async function getTarget({window, context, region, fully, scrollingMode}) {
|
|
28
4
|
if (window) {
|
|
29
5
|
// window/app
|
|
@@ -63,11 +39,9 @@ async function getTarget({window, context, region, fully, scrollingMode}) {
|
|
|
63
39
|
}
|
|
64
40
|
} else {
|
|
65
41
|
const scrollingElement = await context.getScrollingElement()
|
|
66
|
-
const navBar = isNavigationBar(region)
|
|
67
|
-
const tabBar = isTabBar(region)
|
|
68
42
|
return {
|
|
69
43
|
context: elementContext,
|
|
70
|
-
region: await element.getRegion(
|
|
44
|
+
region: await element.getRegion(),
|
|
71
45
|
scrollingElement,
|
|
72
46
|
}
|
|
73
47
|
}
|
|
@@ -65,6 +65,17 @@ async function takeStitchedScreenshot({
|
|
|
65
65
|
if (region) region = utils.geometry.intersect(region, contentRegion)
|
|
66
66
|
else region = contentRegion
|
|
67
67
|
|
|
68
|
+
if (targetRegion.x !== region.x && targetRegion.width !== region.width) {
|
|
69
|
+
logger.verbose('Compensating for region width differences...')
|
|
70
|
+
logger.verbose(
|
|
71
|
+
'region before compensation and the values to be used (a.k.a. expectedRemainingOffset)',
|
|
72
|
+
region,
|
|
73
|
+
expectedRemainingOffset,
|
|
74
|
+
)
|
|
75
|
+
region.x += expectedRemainingOffset.x
|
|
76
|
+
region.width += expectedRemainingOffset.x
|
|
77
|
+
logger.verbose('region after compensation', region)
|
|
78
|
+
}
|
|
68
79
|
region = utils.geometry.round(region)
|
|
69
80
|
|
|
70
81
|
const [initialRegion, ...partRegions] = utils.geometry.divide(region, image.size, overlap)
|