@applitools/screenshoter 3.8.38 → 3.9.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.9.0](https://github.com/Applitools-Dev/sdk/compare/js/screenshoter@3.8.38...js/screenshoter@3.9.0) (2024-10-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* capture status bar ([#2571](https://github.com/Applitools-Dev/sdk/issues/2571)) ([5e1c75e](https://github.com/Applitools-Dev/sdk/commit/5e1c75ef9cf34af80f08806a3bceaf06a94f2780))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/snippets bumped to 2.5.1
|
|
14
|
+
#### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* isStaleElement error ([#2567](https://github.com/Applitools-Dev/sdk/issues/2567)) ([2675086](https://github.com/Applitools-Dev/sdk/commit/2675086aa28589082249e2958942ee29a5f2ef12))
|
|
17
|
+
* @applitools/driver bumped to 1.19.3
|
|
18
|
+
|
|
19
|
+
* @applitools/spec-driver-webdriver bumped to 1.1.15
|
|
20
|
+
|
|
21
|
+
|
|
3
22
|
## [3.8.38](https://github.com/Applitools-Dev/sdk/compare/js/screenshoter@3.8.37...js/screenshoter@3.8.38) (2024-10-03)
|
|
4
23
|
|
|
5
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/screenshoter",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Applitools universal screenshoter for web and native applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@applitools/image": "1.1.13",
|
|
60
60
|
"@applitools/logger": "2.0.18",
|
|
61
|
-
"@applitools/snippets": "2.5.
|
|
61
|
+
"@applitools/snippets": "2.5.1",
|
|
62
62
|
"@applitools/utils": "1.7.4"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@applitools/driver": "^1.19.
|
|
66
|
-
"@applitools/spec-driver-webdriver": "^1.1.
|
|
65
|
+
"@applitools/driver": "^1.19.3",
|
|
66
|
+
"@applitools/spec-driver-webdriver": "^1.1.15",
|
|
67
67
|
"@applitools/test-utils": "^1.5.17",
|
|
68
68
|
"appium": "^1.22.3",
|
|
69
69
|
"pixelmatch": "^5.3.0",
|
package/src/take-screenshot.js
CHANGED
|
@@ -14,7 +14,7 @@ async function takeScreenshot({
|
|
|
14
14
|
scrollingMode,
|
|
15
15
|
hideScrollbars,
|
|
16
16
|
hideCaret,
|
|
17
|
-
|
|
17
|
+
captureStatusBar,
|
|
18
18
|
overlap,
|
|
19
19
|
framed,
|
|
20
20
|
wait,
|
|
@@ -53,7 +53,7 @@ async function takeScreenshot({
|
|
|
53
53
|
// framed screenshots could be taken only when screenshot of window/app fully was requested
|
|
54
54
|
framed = framed && fully && window
|
|
55
55
|
// screenshots with status bar could be taken only when screenshot of app or framed app fully was requested
|
|
56
|
-
|
|
56
|
+
captureStatusBar = captureStatusBar && environment.isNative && window && (!fully || framed)
|
|
57
57
|
scrollingMode = !environment.isWeb ? 'scroll' : scrollingMode
|
|
58
58
|
|
|
59
59
|
const activeContext = driver.currentContext
|
|
@@ -92,7 +92,7 @@ async function takeScreenshot({
|
|
|
92
92
|
fully && target.scroller
|
|
93
93
|
? await takeStitchedScreenshot({
|
|
94
94
|
...target,
|
|
95
|
-
|
|
95
|
+
captureStatusBar,
|
|
96
96
|
overlap,
|
|
97
97
|
framed,
|
|
98
98
|
wait,
|
|
@@ -101,7 +101,7 @@ async function takeScreenshot({
|
|
|
101
101
|
logger,
|
|
102
102
|
lazyLoad,
|
|
103
103
|
})
|
|
104
|
-
: await takeSimpleScreenshot({...target,
|
|
104
|
+
: await takeSimpleScreenshot({...target, captureStatusBar, wait, stabilization, debug, logger})
|
|
105
105
|
|
|
106
106
|
const viewport = await driver.getViewport()
|
|
107
107
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const utils = require('@applitools/utils')
|
|
2
2
|
const makeTakeViewportScreenshot = require('./take-viewport-screenshot')
|
|
3
3
|
|
|
4
|
-
async function takeSimpleScreenshot({context, region,
|
|
4
|
+
async function takeSimpleScreenshot({context, region, captureStatusBar, wait, stabilization, debug = {}, logger}) {
|
|
5
5
|
logger.verbose('Taking image of...')
|
|
6
6
|
|
|
7
7
|
const driver = context.driver
|
|
@@ -9,7 +9,7 @@ async function takeSimpleScreenshot({context, region, withStatusBar, wait, stabi
|
|
|
9
9
|
|
|
10
10
|
await utils.general.sleep(wait)
|
|
11
11
|
|
|
12
|
-
const image = await takeViewportScreenshot({
|
|
12
|
+
const image = await takeViewportScreenshot({captureStatusBar})
|
|
13
13
|
|
|
14
14
|
if (region) {
|
|
15
15
|
const cropRegion = await driver.getRegionInViewport(context, region)
|
|
@@ -8,7 +8,7 @@ async function takeStitchedScreenshot({
|
|
|
8
8
|
context,
|
|
9
9
|
scroller,
|
|
10
10
|
region,
|
|
11
|
-
|
|
11
|
+
captureStatusBar,
|
|
12
12
|
overlap = {top: 10, bottom: 50},
|
|
13
13
|
framed,
|
|
14
14
|
wait,
|
|
@@ -48,7 +48,7 @@ async function takeStitchedScreenshot({
|
|
|
48
48
|
)
|
|
49
49
|
|
|
50
50
|
logger.verbose('Getting initial image...')
|
|
51
|
-
let image = await takeViewportScreenshot({name: 'initial',
|
|
51
|
+
let image = await takeViewportScreenshot({name: 'initial', captureStatusBar})
|
|
52
52
|
const firstImage = framed ? makeImage(image) : null
|
|
53
53
|
|
|
54
54
|
const scrollerRegion = await scroller.getClientRegion()
|
|
@@ -61,7 +61,7 @@ async function takeStitchedScreenshot({
|
|
|
61
61
|
logger.log('Crop region calculated: ', cropRegion)
|
|
62
62
|
if (utils.geometry.isEmpty(cropRegion)) throw new Error('Screenshot region is out of viewport')
|
|
63
63
|
|
|
64
|
-
image.crop(
|
|
64
|
+
image.crop(captureStatusBar ? utils.geometry.offset(cropRegion, {x: 0, y: viewport.statusBarSize}) : cropRegion)
|
|
65
65
|
await image.debug({...debug, name: 'initial', suffix: 'region'})
|
|
66
66
|
|
|
67
67
|
const contentRegion = utils.geometry.region({x: 0, y: 0}, contentSize)
|
|
@@ -158,7 +158,7 @@ async function takeStitchedScreenshot({
|
|
|
158
158
|
stitchedImage.frame(
|
|
159
159
|
firstImage,
|
|
160
160
|
lastImage,
|
|
161
|
-
|
|
161
|
+
captureStatusBar ? utils.geometry.offset(cropRegion, {x: 0, y: viewport.statusBarSize}) : cropRegion,
|
|
162
162
|
)
|
|
163
163
|
await stitchedImage.debug({...debug, name: 'framed'})
|
|
164
164
|
|
|
@@ -150,7 +150,7 @@ function makeTakeMarkedScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
function makeTakeNativeScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
153
|
-
return async function takeScreenshot({name,
|
|
153
|
+
return async function takeScreenshot({name, captureStatusBar} = {}) {
|
|
154
154
|
logger.verbose('Taking native driver screenshot...')
|
|
155
155
|
const viewport = await driver.getViewport()
|
|
156
156
|
const image = makeImage(await driver.takeScreenshot())
|
|
@@ -165,7 +165,7 @@ function makeTakeNativeScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
|
165
165
|
if (stabilization.crop) image.crop(stabilization.crop)
|
|
166
166
|
else {
|
|
167
167
|
const cropRegion = {...viewport.viewportLocation, ...viewport.viewportSize}
|
|
168
|
-
if (
|
|
168
|
+
if (captureStatusBar) {
|
|
169
169
|
cropRegion.y = 0
|
|
170
170
|
cropRegion.height += viewport.statusBarSize
|
|
171
171
|
}
|
|
@@ -175,7 +175,7 @@ function makeTakeNativeScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
|
175
175
|
await image.debug({
|
|
176
176
|
...debug,
|
|
177
177
|
name,
|
|
178
|
-
suffix: `viewport${
|
|
178
|
+
suffix: `viewport${captureStatusBar ? '-with-statusbar' : ''}`,
|
|
179
179
|
})
|
|
180
180
|
|
|
181
181
|
return image
|