@applitools/screenshoter 3.4.5 → 3.4.8
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.4.
|
|
3
|
+
"version": "3.4.8",
|
|
4
4
|
"description": "Applitools universal screenshoter for web and native applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git://github.com/applitools/eyes.sdk.javascript1.git",
|
|
21
|
-
"directory": "packages/screenshoter"
|
|
21
|
+
"directory": "js/packages/screenshoter"
|
|
22
22
|
},
|
|
23
23
|
"license": "SEE LICENSE IN LICENSE",
|
|
24
24
|
"author": {
|
|
@@ -43,12 +43,14 @@
|
|
|
43
43
|
"scripts": {
|
|
44
44
|
"lint": "eslint . --ext .js",
|
|
45
45
|
"test": "yarn test:it && yarn test:e2e",
|
|
46
|
+
"test:sanity": "yarn test:unit && yarn test:it && yarn test:e2e:web",
|
|
46
47
|
"test:unit": "mocha ./test/unit/*.spec.js --no-timeouts",
|
|
47
48
|
"test:it": "mocha ./test/it/*.spec.js --no-timeouts",
|
|
48
49
|
"test:e2e": "yarn test:e2e:web && yarn && yarn test:e2e:android && yarn test:e2e:ios",
|
|
49
50
|
"test:e2e:web": "mocha ./test/e2e/web/*.spec.js --no-timeouts -r @applitools/test-utils/mocha-hooks/docker",
|
|
50
51
|
"test:e2e:android": "APPLITOOLS_TEST_REMOTE=sauce mocha ./test/e2e/android*/*.spec.js --no-timeouts --parallel --jobs ${MOCHA_JOBS:-2}",
|
|
51
52
|
"test:e2e:ios": "APPLITOOLS_TEST_REMOTE=sauce mocha ./test/e2e/ios*/*.spec.js --no-timeouts --parallel --jobs ${MOCHA_JOBS:-2}",
|
|
53
|
+
"setup": "yarn setup:web",
|
|
52
54
|
"setup:web": "yarn docker:setup",
|
|
53
55
|
"setup:android": "echo \"setup:android - do nothing\"",
|
|
54
56
|
"setup:ios": "echo \"setup:ios - do nothing\"",
|
|
@@ -70,18 +72,18 @@
|
|
|
70
72
|
}
|
|
71
73
|
},
|
|
72
74
|
"dependencies": {
|
|
73
|
-
"@applitools/logger": "1.1.
|
|
74
|
-
"@applitools/snippets": "2.4.
|
|
75
|
-
"@applitools/utils": "1.3.
|
|
75
|
+
"@applitools/logger": "1.1.14",
|
|
76
|
+
"@applitools/snippets": "2.4.4",
|
|
77
|
+
"@applitools/utils": "1.3.10",
|
|
76
78
|
"jpeg-js": "0.4.4",
|
|
77
79
|
"png-async": "0.9.4"
|
|
78
80
|
},
|
|
79
81
|
"devDependencies": {
|
|
80
|
-
"@applitools/bongo": "^2.1.
|
|
81
|
-
"@applitools/driver": "^1.9.
|
|
82
|
-
"@applitools/scripts": "1.1.0",
|
|
83
|
-
"@applitools/spec-driver-webdriverio": "1.2.
|
|
84
|
-
"@applitools/test-utils": "1.
|
|
82
|
+
"@applitools/bongo": "^2.1.6",
|
|
83
|
+
"@applitools/driver": "^1.9.12",
|
|
84
|
+
"@applitools/scripts": "^1.1.0",
|
|
85
|
+
"@applitools/spec-driver-webdriverio": "^1.2.16",
|
|
86
|
+
"@applitools/test-utils": "^1.4.0",
|
|
85
87
|
"appium": "^1.22.3",
|
|
86
88
|
"chromedriver": "^101.0.0",
|
|
87
89
|
"eslint": "^8.16.0",
|
|
@@ -57,7 +57,7 @@ async function takeStitchedScreenshot({
|
|
|
57
57
|
logger.log('Crop region calculated: ', cropRegion)
|
|
58
58
|
if (utils.geometry.isEmpty(cropRegion)) throw new Error('Screenshot region is out of viewport')
|
|
59
59
|
|
|
60
|
-
image.crop(withStatusBar ? utils.geometry.offset(cropRegion, {x: 0, y: driver.
|
|
60
|
+
image.crop(withStatusBar ? utils.geometry.offset(cropRegion, {x: 0, y: driver.statusBarSize}) : cropRegion)
|
|
61
61
|
await image.debug({...debug, name: 'initial', suffix: 'region'})
|
|
62
62
|
|
|
63
63
|
const contentRegion = utils.geometry.region({x: 0, y: 0}, contentSize)
|
|
@@ -151,7 +151,7 @@ async function takeStitchedScreenshot({
|
|
|
151
151
|
stitchedImage.frame(
|
|
152
152
|
firstImage,
|
|
153
153
|
lastImage,
|
|
154
|
-
withStatusBar ? utils.geometry.offset(cropRegion, {x: 0, y: driver.
|
|
154
|
+
withStatusBar ? utils.geometry.offset(cropRegion, {x: 0, y: driver.statusBarSize}) : cropRegion,
|
|
155
155
|
)
|
|
156
156
|
await stitchedImage.debug({...debug, name: 'framed'})
|
|
157
157
|
|
|
@@ -99,7 +99,7 @@ function makeTakeMarkedScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
|
99
99
|
else image.scale(1 / driver.pixelRatio / driver.viewportScale)
|
|
100
100
|
|
|
101
101
|
if (stabilization.rotate) image.rotate(stabilization.rotate)
|
|
102
|
-
else if (driver.orientation
|
|
102
|
+
else if (driver.orientation.startsWith('landscape') && image.width < image.height) image.rotate(-90)
|
|
103
103
|
|
|
104
104
|
if (stabilization.crop) image.crop(stabilization.crop)
|
|
105
105
|
else {
|
|
@@ -126,7 +126,7 @@ function makeTakeMarkedScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
|
126
126
|
const image = makeImage(await driver.takeScreenshot())
|
|
127
127
|
|
|
128
128
|
if (stabilization.rotate) image.rotate(stabilization.rotate)
|
|
129
|
-
else if (driver.orientation
|
|
129
|
+
else if (driver.orientation.startsWith('landscape') && image.width < image.height) image.rotate(-90)
|
|
130
130
|
|
|
131
131
|
await image.debug({...debug, name: 'marker'})
|
|
132
132
|
|
|
@@ -156,26 +156,24 @@ function makeTakeNativeScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
|
156
156
|
else image.scale(1 / driver.pixelRatio / driver.viewportScale)
|
|
157
157
|
|
|
158
158
|
if (stabilization.rotate) image.rotate(stabilization.rotate)
|
|
159
|
-
else if (driver.orientation
|
|
159
|
+
else if (driver.orientation.startsWith('landscape') && image.width < image.height) image.rotate(-90)
|
|
160
160
|
|
|
161
161
|
if (stabilization.crop) image.crop(stabilization.crop)
|
|
162
162
|
else {
|
|
163
|
-
const
|
|
163
|
+
const viewportRegion = await driver.getViewportRegion()
|
|
164
|
+
const cropRegion = {...viewportRegion}
|
|
164
165
|
if (withStatusBar) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
image.crop({
|
|
168
|
-
top: driver.statusBarHeight,
|
|
169
|
-
bottom: driver.orientation === 'landscape' ? 0 : driver.navigationBarHeight,
|
|
170
|
-
left: driver.platformVersion >= 8 ? driver.navigationBarHeight : 0,
|
|
171
|
-
right: driver.platformVersion < 8 ? driver.navigationBarHeight : 0,
|
|
172
|
-
})
|
|
173
|
-
} else {
|
|
174
|
-
image.crop({x: 0, y: driver.statusBarHeight, width: viewportSize.width, height: viewportSize.height})
|
|
166
|
+
cropRegion.y = 0
|
|
167
|
+
cropRegion.height += driver.statusBarSize
|
|
175
168
|
}
|
|
169
|
+
image.crop(cropRegion)
|
|
176
170
|
}
|
|
177
171
|
|
|
178
|
-
await image.debug({
|
|
172
|
+
await image.debug({
|
|
173
|
+
...debug,
|
|
174
|
+
name,
|
|
175
|
+
suffix: `viewport${withStatusBar ? '-with-statusbar' : ''}`,
|
|
176
|
+
})
|
|
179
177
|
|
|
180
178
|
return image
|
|
181
179
|
}
|