@applitools/screenshoter 3.3.2 → 3.3.6
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 +22 -0
- package/package.json +26 -15
- package/src/image.js +15 -12
- package/src/scroll-into-viewport.js +16 -7
- package/src/take-viewport-screenshot.js +8 -30
- package/.bongo/dry-run/package-lock.json +0 -73
- package/.bongo/dry-run/package.json +0 -5
- package/.bongo/dry-run.tgz +0 -0
- package/.eslintrc +0 -39
- package/test/e2e/android.spec.js +0 -335
- package/test/e2e/external.spec.js +0 -155
- package/test/e2e/ios.spec.js +0 -338
- package/test/e2e/web-ios.spec.js +0 -72
- package/test/e2e/web.spec.js +0 -334
- package/test/fixtures/android/app-fully-non-scrollable.png +0 -0
- package/test/fixtures/android/app-fully-recycler.png +0 -0
- package/test/fixtures/android/app-fully-scroll-statusbar.png +0 -0
- package/test/fixtures/android/app-fully-scroll.png +0 -0
- package/test/fixtures/android/app-statusbar.png +0 -0
- package/test/fixtures/android/app.png +0 -0
- package/test/fixtures/android/element.png +0 -0
- package/test/fixtures/android/region.png +0 -0
- package/test/fixtures/android/x-app-fully-collapsing.png +0 -0
- package/test/fixtures/android/x-app-fully-recycler.png +0 -0
- package/test/fixtures/android/x-element-fully.png +0 -0
- package/test/fixtures/external/agl.png +0 -0
- package/test/fixtures/image/house.cropped-rect.png +0 -0
- package/test/fixtures/image/house.cropped-region.png +0 -0
- package/test/fixtures/image/house.framed-higher-wider.png +0 -0
- package/test/fixtures/image/house.framed-higher.png +0 -0
- package/test/fixtures/image/house.framed-shorter-thinner.png +0 -0
- package/test/fixtures/image/house.framed-wider.png +0 -0
- package/test/fixtures/image/house.png +0 -0
- package/test/fixtures/image/house.rotated.png +0 -0
- package/test/fixtures/image/house.scaled.png +0 -0
- package/test/fixtures/image/house.stitched.png +0 -0
- package/test/fixtures/ios/app-fully-collapsing.png +0 -0
- package/test/fixtures/ios/app-fully-collection.png +0 -0
- package/test/fixtures/ios/app-fully-overlapped-statusbar.png +0 -0
- package/test/fixtures/ios/app-fully-overlapped.png +0 -0
- package/test/fixtures/ios/app-fully-scroll-statusbar.png +0 -0
- package/test/fixtures/ios/app-fully-scroll.png +0 -0
- package/test/fixtures/ios/app-fully-superview.png +0 -0
- package/test/fixtures/ios/app-fully-table.png +0 -0
- package/test/fixtures/ios/app-statusbar.png +0 -0
- package/test/fixtures/ios/app.png +0 -0
- package/test/fixtures/ios/element-fully.png +0 -0
- package/test/fixtures/ios/element.png +0 -0
- package/test/fixtures/ios/region.png +0 -0
- package/test/fixtures/ios/webview-fully.png +0 -0
- package/test/fixtures/ios/webview.png +0 -0
- package/test/fixtures/pattern/iPad_5th_landscape.png +0 -0
- package/test/fixtures/pattern/iPad_5th_portrait.png +0 -0
- package/test/fixtures/pattern/iPad_9th_landscape.png +0 -0
- package/test/fixtures/pattern/iPad_9th_portrait.png +0 -0
- package/test/fixtures/pattern/iPhone_11_landscape.png +0 -0
- package/test/fixtures/pattern/iPhone_11_portrait.png +0 -0
- package/test/fixtures/pattern/iPhone_13_landscape.png +0 -0
- package/test/fixtures/pattern/iPhone_13_portrait.png +0 -0
- package/test/fixtures/pattern/iPhone_SE_landscape.png +0 -0
- package/test/fixtures/pattern/iPhone_SE_portrait.png +0 -0
- package/test/fixtures/pattern/iPhone_XS_portrait_nomarker.png +0 -0
- package/test/fixtures/pattern/iPhone_XS_portrait_noviewport.png +0 -0
- package/test/fixtures/web/element-fully.png +0 -0
- package/test/fixtures/web/element.png +0 -0
- package/test/fixtures/web/frame-fully.png +0 -0
- package/test/fixtures/web/frame.png +0 -0
- package/test/fixtures/web/inner-element-fully.png +0 -0
- package/test/fixtures/web/inner-element.png +0 -0
- package/test/fixtures/web/inner-frame-fully.png +0 -0
- package/test/fixtures/web/inner-frame.png +0 -0
- package/test/fixtures/web/inner-region-fully.png +0 -0
- package/test/fixtures/web/inner-region.png +0 -0
- package/test/fixtures/web/page-fully.png +0 -0
- package/test/fixtures/web/page.png +0 -0
- package/test/fixtures/web/region-fully.png +0 -0
- package/test/fixtures/web/region.png +0 -0
- package/test/fixtures/web-ios/page-fully.png +0 -0
- package/test/fixtures/web-ios/page.png +0 -0
- package/test/it/find-pattern.spec.js +0 -33
- package/test/it/image.spec.js +0 -146
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@
|
|
|
4
4
|
## Unreleased
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## 3.3.6 - 2022/2/9
|
|
8
|
+
|
|
9
|
+
- fix testing
|
|
10
|
+
- updated to @applitools/utils@1.2.12 (from 1.2.11)
|
|
11
|
+
|
|
12
|
+
## 3.3.5 - 2022/2/8
|
|
13
|
+
|
|
14
|
+
- add "files" field to the package.json to avoid unnecessary files to be published
|
|
15
|
+
- updated to @applitools/utils@1.2.11 (from 1.2.5)
|
|
16
|
+
|
|
17
|
+
## 3.3.4 - 2021/12/23
|
|
18
|
+
|
|
19
|
+
- updated to @applitools/snippets@2.1.12 (from 2.1.11)
|
|
20
|
+
|
|
21
|
+
## 3.3.3 - 2021/12/22
|
|
22
|
+
|
|
23
|
+
- improve default rotation and scaling logic
|
|
24
|
+
- improve scroll into viewport algorithm
|
|
25
|
+
- fix lazy handling of image rotation
|
|
26
|
+
- updated to @applitools/snippets@2.1.11 (from 2.1.10)
|
|
27
|
+
- updated to @applitools/utils@1.2.5 (from 1.2.4)
|
|
28
|
+
|
|
7
29
|
## 3.3.2 - 2021/12/20
|
|
8
30
|
|
|
9
31
|
- add basic support of webview screenshots on ios
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/screenshoter",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.6",
|
|
4
4
|
"description": "Applitools universal screenshoter for web and native applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -26,19 +26,29 @@
|
|
|
26
26
|
"email": "team@applitools.com"
|
|
27
27
|
},
|
|
28
28
|
"main": "./index.js",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
29
|
+
"files": [
|
|
30
|
+
"src",
|
|
31
|
+
"index.js"
|
|
32
|
+
],
|
|
33
33
|
"scripts": {
|
|
34
34
|
"lint": "eslint . --ext .js",
|
|
35
35
|
"test": "yarn test:it && yarn test:e2e",
|
|
36
|
-
"test:it": "mocha
|
|
37
|
-
"test:e2e": "mocha
|
|
36
|
+
"test:it": "mocha ./test/it/*.spec.js --no-timeouts",
|
|
37
|
+
"test:e2e": "mocha ./test/e2e/**/*.spec.js --no-timeouts --parallel --jobs ${MOCHA_JOBS:-1}",
|
|
38
|
+
"test:e2e:web": "mocha ./test/e2e/web/*.spec.js --no-timeouts -r @applitools/test-utils/mocha-hooks/docker --parallel --jobs ${MOCHA_JOBS:-15}",
|
|
39
|
+
"test:e2e:android": "mocha ./test/e2e/android*/*.spec.js --no-timeouts --parallel --jobs ${MOCHA_JOBS:-1}",
|
|
40
|
+
"test:e2e:ios": "mocha ./test/e2e/ios*/*.spec.js --no-timeouts --parallel --jobs ${MOCHA_JOBS:-1}",
|
|
41
|
+
"setup": "yarn docker:setup && yarn android:setup && yarn ios:setup && yarn appium:setup",
|
|
42
|
+
"setup:web": "yarn docker:setup",
|
|
43
|
+
"setup:android": "yarn android:setup && yarn appium:setup",
|
|
44
|
+
"setup:ios": "yarn ios:setup && yarn appium:setup",
|
|
45
|
+
"android:setup": "node ./scripts/android-emulator.js",
|
|
38
46
|
"docker:setup": "node ../scripts/scripts/generate-docker-compose-config.js && docker-compose up -d",
|
|
39
47
|
"docker:teardown": "docker-compose down",
|
|
40
|
-
"setup": "
|
|
48
|
+
"ios:setup": "node ./scripts/ios-simulator.js",
|
|
49
|
+
"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 &",
|
|
41
50
|
"deps": "bongo deps",
|
|
51
|
+
"gh:publish": "gh workflow run publish-screenshoter.yml --ref $(git rev-parse --abbrev-ref HEAD)",
|
|
42
52
|
"preversion": "bongo preversion",
|
|
43
53
|
"version": "bongo version",
|
|
44
54
|
"postversion": "bongo postversion --skip-release-notification"
|
|
@@ -49,22 +59,23 @@
|
|
|
49
59
|
}
|
|
50
60
|
},
|
|
51
61
|
"dependencies": {
|
|
52
|
-
"@applitools/snippets": "2.1.
|
|
53
|
-
"@applitools/utils": "1.2.
|
|
62
|
+
"@applitools/snippets": "2.1.12",
|
|
63
|
+
"@applitools/utils": "1.2.12",
|
|
54
64
|
"png-async": "0.9.4"
|
|
55
65
|
},
|
|
56
66
|
"devDependencies": {
|
|
57
|
-
"@applitools/driver": "1.4.
|
|
58
|
-
"@applitools/sdk-release-kit": "0.13.
|
|
59
|
-
"@applitools/spec-driver-webdriverio": "1.2.
|
|
60
|
-
"@applitools/test-utils": "1.0.
|
|
67
|
+
"@applitools/driver": "1.4.12",
|
|
68
|
+
"@applitools/sdk-release-kit": "0.13.11",
|
|
69
|
+
"@applitools/spec-driver-webdriverio": "1.2.7",
|
|
70
|
+
"@applitools/test-utils": "1.0.11",
|
|
71
|
+
"appium": "^1.22.2",
|
|
61
72
|
"chromedriver": "^95.0.0",
|
|
62
73
|
"eslint": "^7.9.0",
|
|
63
74
|
"eslint-plugin-mocha-no-only": "^1.1.1",
|
|
64
75
|
"eslint-plugin-node": "^11.1.0",
|
|
65
76
|
"eslint-plugin-prettier": "^3.1.4",
|
|
66
77
|
"husky": "^4.3.8",
|
|
67
|
-
"mocha": "^
|
|
78
|
+
"mocha": "^9.2.0",
|
|
68
79
|
"pixelmatch": "^5.2.1",
|
|
69
80
|
"prettier": "1.19.0",
|
|
70
81
|
"webdriverio": "^7.16.7"
|
package/src/image.js
CHANGED
|
@@ -38,7 +38,9 @@ function makeImage(data) {
|
|
|
38
38
|
return true
|
|
39
39
|
},
|
|
40
40
|
get size() {
|
|
41
|
-
return utils.geometry.round(
|
|
41
|
+
return utils.geometry.round(
|
|
42
|
+
utils.geometry.rotate(utils.geometry.scale(size, transforms.scale), transforms.rotate),
|
|
43
|
+
)
|
|
42
44
|
},
|
|
43
45
|
get transforms() {
|
|
44
46
|
return {...transforms}
|
|
@@ -51,6 +53,12 @@ function makeImage(data) {
|
|
|
51
53
|
},
|
|
52
54
|
scale(ratio) {
|
|
53
55
|
transforms.scale *= ratio
|
|
56
|
+
// size = utils.geometry.scale(size, ratio)
|
|
57
|
+
return this
|
|
58
|
+
},
|
|
59
|
+
rotate(degrees) {
|
|
60
|
+
transforms.rotate = (transforms.rotate + degrees) % 360
|
|
61
|
+
// size = utils.geometry.rotate(size, degrees)
|
|
54
62
|
return this
|
|
55
63
|
},
|
|
56
64
|
crop(region) {
|
|
@@ -64,17 +72,12 @@ function makeImage(data) {
|
|
|
64
72
|
} else {
|
|
65
73
|
region = utils.geometry.scale(region, 1 / transforms.scale)
|
|
66
74
|
}
|
|
67
|
-
region = utils.geometry.rotate(region, transforms.rotate)
|
|
68
|
-
|
|
75
|
+
region = utils.geometry.rotate(region, -transforms.rotate, utils.geometry.rotate(size, transforms.rotate))
|
|
76
|
+
region = transforms.crop
|
|
69
77
|
? utils.geometry.intersect(transforms.crop, utils.geometry.offset(region, transforms.crop))
|
|
70
78
|
: utils.geometry.intersect({x: 0, y: 0, ...size}, region)
|
|
71
|
-
|
|
72
|
-
size = utils.geometry.
|
|
73
|
-
|
|
74
|
-
return this
|
|
75
|
-
},
|
|
76
|
-
rotate(degree) {
|
|
77
|
-
transforms.rotate = (transforms.rotate + degree) % 360
|
|
79
|
+
transforms.crop = region
|
|
80
|
+
size = utils.geometry.size(transforms.crop)
|
|
78
81
|
return this
|
|
79
82
|
},
|
|
80
83
|
copy(srcImage, offset) {
|
|
@@ -204,9 +207,9 @@ async function transform(image, transforms) {
|
|
|
204
207
|
}
|
|
205
208
|
}, image)
|
|
206
209
|
|
|
207
|
-
image = transforms.rotate > 0 ? await rotate(image, transforms.rotate) : image
|
|
208
210
|
image = transforms.crop ? await extract(image, transforms.crop) : image
|
|
209
211
|
image = transforms.scale !== 1 ? await scale(image, transforms.scale) : image
|
|
212
|
+
image = transforms.rotate !== 0 ? await rotate(image, transforms.rotate) : image
|
|
210
213
|
return image
|
|
211
214
|
}
|
|
212
215
|
|
|
@@ -296,7 +299,7 @@ async function rotate(image, degrees) {
|
|
|
296
299
|
for (let srcY = 0, dstX = 0; srcY < image.height; ++srcY, ++dstX) {
|
|
297
300
|
for (let srcX = 0, dstY = image.width - 1; srcX < image.width; ++srcX, --dstY) {
|
|
298
301
|
const pixel = image.data.readUInt32BE((srcY * image.width + srcX) * 4)
|
|
299
|
-
dstImage.data.writeUInt32BE(pixel, (
|
|
302
|
+
dstImage.data.writeUInt32BE(pixel, (dstY * dstImage.width + dstX) * 4)
|
|
300
303
|
}
|
|
301
304
|
}
|
|
302
305
|
} else {
|
|
@@ -15,14 +15,23 @@ async function scrollIntoViewport({context, scroller, region, logger}) {
|
|
|
15
15
|
let remainingOffset = {x: elementContextRegion.x, y: elementContextRegion.y}
|
|
16
16
|
while (currentContext) {
|
|
17
17
|
const scrollingElement = await currentContext.getScrollingElement()
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
if (!scrollingElement) {
|
|
19
|
+
currentContext = currentContext.parent
|
|
20
|
+
continue
|
|
21
|
+
}
|
|
21
22
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const scrollableRegion = await scrollingElement.getClientRegion()
|
|
24
|
+
const requiredOffset = {
|
|
25
|
+
x: Math.max(
|
|
26
|
+
remainingOffset.x - (scrollableRegion.x + Math.max(scrollableRegion.width - elementContextRegion.width, 0)),
|
|
27
|
+
0,
|
|
28
|
+
),
|
|
29
|
+
y: Math.max(
|
|
30
|
+
remainingOffset.y - (scrollableRegion.y + Math.max(scrollableRegion.height - elementContextRegion.height, 0)),
|
|
31
|
+
0,
|
|
32
|
+
),
|
|
33
|
+
}
|
|
34
|
+
const actualOffset = await scroller.moveTo(requiredOffset, scrollingElement)
|
|
26
35
|
|
|
27
36
|
remainingOffset = utils.geometry.offset(
|
|
28
37
|
utils.geometry.offsetNegative(remainingOffset, actualOffset),
|
|
@@ -27,14 +27,13 @@ function makeTakeViewportScreenshot(options) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function makeTakeDefaultScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
30
|
-
const calculateScaleRatio = makeCalculateScaleRatio({driver})
|
|
31
30
|
return async function takeScreenshot({name} = {}) {
|
|
32
31
|
logger.verbose('Taking screenshot...')
|
|
33
32
|
const image = makeImage(await driver.takeScreenshot())
|
|
34
33
|
await image.debug({...debug, name, suffix: 'original'})
|
|
35
34
|
|
|
36
35
|
if (stabilization.scale) image.scale(stabilization.scale)
|
|
37
|
-
else image.scale(
|
|
36
|
+
else image.scale(1 / driver.pixelRatio)
|
|
38
37
|
|
|
39
38
|
if (stabilization.rotate) image.crop(stabilization.rotate)
|
|
40
39
|
|
|
@@ -45,7 +44,6 @@ function makeTakeDefaultScreenshot({driver, stabilization = {}, debug, logger})
|
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
function makeTakeMainContextScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
48
|
-
const calculateScaleRatio = makeCalculateScaleRatio({driver})
|
|
49
47
|
return async function takeScreenshot({name} = {}) {
|
|
50
48
|
logger.verbose('Taking screenshot...')
|
|
51
49
|
const originalContext = driver.currentContext
|
|
@@ -55,7 +53,7 @@ function makeTakeMainContextScreenshot({driver, stabilization = {}, debug, logge
|
|
|
55
53
|
await image.debug({...debug, name, suffix: 'original'})
|
|
56
54
|
|
|
57
55
|
if (stabilization.scale) image.scale(stabilization.scale)
|
|
58
|
-
else image.scale(
|
|
56
|
+
else image.scale(1 / driver.pixelRatio)
|
|
59
57
|
|
|
60
58
|
if (stabilization.rotate) image.rotate(stabilization.rotate)
|
|
61
59
|
|
|
@@ -66,7 +64,6 @@ function makeTakeMainContextScreenshot({driver, stabilization = {}, debug, logge
|
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
function makeTakeSafari11Screenshot({driver, stabilization = {}, debug, logger}) {
|
|
69
|
-
const calculateScaleRatio = makeCalculateScaleRatio({driver})
|
|
70
67
|
let viewportSize
|
|
71
68
|
|
|
72
69
|
return async function takeScreenshot({name} = {}) {
|
|
@@ -75,7 +72,7 @@ function makeTakeSafari11Screenshot({driver, stabilization = {}, debug, logger})
|
|
|
75
72
|
await image.debug({...debug, name, suffix: 'original'})
|
|
76
73
|
|
|
77
74
|
if (stabilization.scale) image.scale(stabilization.scale)
|
|
78
|
-
else image.scale(
|
|
75
|
+
else image.scale(1 / driver.pixelRatio)
|
|
79
76
|
|
|
80
77
|
if (stabilization.rotate) image.rotate(stabilization.rotate)
|
|
81
78
|
|
|
@@ -91,7 +88,6 @@ function makeTakeSafari11Screenshot({driver, stabilization = {}, debug, logger})
|
|
|
91
88
|
}
|
|
92
89
|
|
|
93
90
|
function makeTakeMarkedScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
94
|
-
const calculateScaleRatio = makeCalculateScaleRatio({driver})
|
|
95
91
|
let viewportRegion
|
|
96
92
|
|
|
97
93
|
return async function takeScreenshot({name} = {}) {
|
|
@@ -100,9 +96,10 @@ function makeTakeMarkedScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
|
100
96
|
await image.debug({...debug, name, suffix: 'original'})
|
|
101
97
|
|
|
102
98
|
if (stabilization.scale) image.scale(stabilization.scale)
|
|
103
|
-
else image.scale(
|
|
99
|
+
else image.scale(1 / driver.pixelRatio)
|
|
104
100
|
|
|
105
101
|
if (stabilization.rotate) image.rotate(stabilization.rotate)
|
|
102
|
+
else if (driver.orientation === 'landscape' && image.width < image.height) image.rotate(-90)
|
|
106
103
|
|
|
107
104
|
if (stabilization.crop) image.crop(stabilization.crop)
|
|
108
105
|
else {
|
|
@@ -122,7 +119,8 @@ function makeTakeMarkedScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
|
122
119
|
try {
|
|
123
120
|
const image = makeImage(await driver.takeScreenshot())
|
|
124
121
|
|
|
125
|
-
if (stabilization.rotate)
|
|
122
|
+
if (stabilization.rotate) image.rotate(stabilization.rotate)
|
|
123
|
+
else if (driver.orientation === 'landscape' && image.width < image.height) image.rotate(-90)
|
|
126
124
|
|
|
127
125
|
await image.debug({...debug, name: 'marker'})
|
|
128
126
|
|
|
@@ -148,6 +146,7 @@ function makeTakeNativeScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
|
148
146
|
else image.scale(1 / driver.pixelRatio)
|
|
149
147
|
|
|
150
148
|
if (stabilization.rotate) image.rotate(stabilization.rotate)
|
|
149
|
+
else if (driver.orientation === 'landscape' && image.width < image.height) image.rotate(-90)
|
|
151
150
|
|
|
152
151
|
if (stabilization.crop) image.crop(stabilization.crop)
|
|
153
152
|
else {
|
|
@@ -164,25 +163,4 @@ function makeTakeNativeScreenshot({driver, stabilization = {}, debug, logger}) {
|
|
|
164
163
|
}
|
|
165
164
|
}
|
|
166
165
|
|
|
167
|
-
function makeCalculateScaleRatio({driver}) {
|
|
168
|
-
let viewportWidth, contentWidth
|
|
169
|
-
const VIEWPORT_THRESHOLD = 1
|
|
170
|
-
const CONTENT_THRESHOLD = 10
|
|
171
|
-
return async function calculateScaleRatio(imageWidth) {
|
|
172
|
-
if (!viewportWidth) viewportWidth = await driver.getViewportSize().then(size => size.width)
|
|
173
|
-
if (!contentWidth) contentWidth = await driver.mainContext.getContentSize().then(size => size.width)
|
|
174
|
-
// If the image's width is the same as the viewport's width or the
|
|
175
|
-
// top level context's width, no scaling is necessary.
|
|
176
|
-
if (
|
|
177
|
-
(imageWidth >= viewportWidth - VIEWPORT_THRESHOLD && imageWidth <= viewportWidth + VIEWPORT_THRESHOLD) ||
|
|
178
|
-
(imageWidth >= contentWidth - CONTENT_THRESHOLD && imageWidth <= contentWidth + CONTENT_THRESHOLD)
|
|
179
|
-
) {
|
|
180
|
-
return 1
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
const scaledImageWidth = Math.round(imageWidth / driver.pixelRatio)
|
|
184
|
-
return viewportWidth / scaledImageWidth / driver.pixelRatio
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
166
|
module.exports = makeTakeViewportScreenshot
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dry-run",
|
|
3
|
-
"lockfileVersion": 2,
|
|
4
|
-
"requires": true,
|
|
5
|
-
"packages": {
|
|
6
|
-
"": {
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"@applitools/screenshoter": "file:../dry-run.tgz"
|
|
9
|
-
}
|
|
10
|
-
},
|
|
11
|
-
"node_modules/@applitools/screenshoter": {
|
|
12
|
-
"version": "3.3.1",
|
|
13
|
-
"resolved": "file:../dry-run.tgz",
|
|
14
|
-
"integrity": "sha512-Nn4m2tV2g1+ECbNzbJ4NJzvpx02lYAZ6MM4HXuT16ShCZPXi2fCuvnJEZX3D5j/EkZjEB6yFZWXrKT70m2Djew==",
|
|
15
|
-
"license": "SEE LICENSE IN LICENSE",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@applitools/snippets": "2.1.10",
|
|
18
|
-
"@applitools/utils": "1.2.4",
|
|
19
|
-
"png-async": "0.9.4"
|
|
20
|
-
},
|
|
21
|
-
"engines": {
|
|
22
|
-
"node": ">= 8.9.0"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"node_modules/@applitools/snippets": {
|
|
26
|
-
"version": "2.1.10",
|
|
27
|
-
"resolved": "https://registry.npmjs.org/@applitools/snippets/-/snippets-2.1.10.tgz",
|
|
28
|
-
"integrity": "sha512-LGjtd8IZOwbhETqKRDX9CX85+BskkFUkuMuLvriSDEEQiSm0MpFbbcJVMjYaVL2qobaJbY+3WvK0g7+gkZuuqA==",
|
|
29
|
-
"engines": {
|
|
30
|
-
"node": ">=8.9.0"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"node_modules/@applitools/utils": {
|
|
34
|
-
"version": "1.2.4",
|
|
35
|
-
"resolved": "https://registry.npmjs.org/@applitools/utils/-/utils-1.2.4.tgz",
|
|
36
|
-
"integrity": "sha512-w7ma6FFGyqhdP6LEcuHFWOcH7EzBjnoAX3UfbFWcTHA3QXnXPX37Y2ENYRodfwkorP1cUKyUHwNXJB/BMIj/hg==",
|
|
37
|
-
"engines": {
|
|
38
|
-
"node": ">= 8.9.0"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"node_modules/png-async": {
|
|
42
|
-
"version": "0.9.4",
|
|
43
|
-
"resolved": "https://registry.npmjs.org/png-async/-/png-async-0.9.4.tgz",
|
|
44
|
-
"integrity": "sha512-B//AXX9TkneKfgtOpT1mdUnnhk2BImGD+a98vImsMU8uo1dBeHyW/kM2erWZ/CsYteTPU/xKG+t6T62heHkC3A=="
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"@applitools/screenshoter": {
|
|
49
|
-
"version": "file:../dry-run.tgz",
|
|
50
|
-
"integrity": "sha512-Nn4m2tV2g1+ECbNzbJ4NJzvpx02lYAZ6MM4HXuT16ShCZPXi2fCuvnJEZX3D5j/EkZjEB6yFZWXrKT70m2Djew==",
|
|
51
|
-
"requires": {
|
|
52
|
-
"@applitools/snippets": "2.1.10",
|
|
53
|
-
"@applitools/utils": "1.2.4",
|
|
54
|
-
"png-async": "0.9.4"
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"@applitools/snippets": {
|
|
58
|
-
"version": "2.1.10",
|
|
59
|
-
"resolved": "https://registry.npmjs.org/@applitools/snippets/-/snippets-2.1.10.tgz",
|
|
60
|
-
"integrity": "sha512-LGjtd8IZOwbhETqKRDX9CX85+BskkFUkuMuLvriSDEEQiSm0MpFbbcJVMjYaVL2qobaJbY+3WvK0g7+gkZuuqA=="
|
|
61
|
-
},
|
|
62
|
-
"@applitools/utils": {
|
|
63
|
-
"version": "1.2.4",
|
|
64
|
-
"resolved": "https://registry.npmjs.org/@applitools/utils/-/utils-1.2.4.tgz",
|
|
65
|
-
"integrity": "sha512-w7ma6FFGyqhdP6LEcuHFWOcH7EzBjnoAX3UfbFWcTHA3QXnXPX37Y2ENYRodfwkorP1cUKyUHwNXJB/BMIj/hg=="
|
|
66
|
-
},
|
|
67
|
-
"png-async": {
|
|
68
|
-
"version": "0.9.4",
|
|
69
|
-
"resolved": "https://registry.npmjs.org/png-async/-/png-async-0.9.4.tgz",
|
|
70
|
-
"integrity": "sha512-B//AXX9TkneKfgtOpT1mdUnnhk2BImGD+a98vImsMU8uo1dBeHyW/kM2erWZ/CsYteTPU/xKG+t6T62heHkC3A=="
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
package/.bongo/dry-run.tgz
DELETED
|
Binary file
|
package/.eslintrc
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"commonjs": true,
|
|
4
|
-
"es6": true,
|
|
5
|
-
"node": true,
|
|
6
|
-
"mocha": true
|
|
7
|
-
},
|
|
8
|
-
"parserOptions": {
|
|
9
|
-
"ecmaVersion": 2018,
|
|
10
|
-
"sourceType": "module"
|
|
11
|
-
},
|
|
12
|
-
"extends": ["plugin:node/recommended"],
|
|
13
|
-
"plugins": ["prettier", "mocha-no-only", "node"],
|
|
14
|
-
"ignorePatterns": [
|
|
15
|
-
"node_modules/",
|
|
16
|
-
"dist/",
|
|
17
|
-
"screenshots/",
|
|
18
|
-
"applitools.config.js",
|
|
19
|
-
"logs",
|
|
20
|
-
"tmp/",
|
|
21
|
-
"**/test/coverage/generic/"
|
|
22
|
-
],
|
|
23
|
-
"rules": {
|
|
24
|
-
"prettier/prettier": ["error", {"allowParens": "avoid", "printWidth": 120}],
|
|
25
|
-
"no-process-exit": "off",
|
|
26
|
-
"no-const-assign": "error",
|
|
27
|
-
"no-this-before-super": "error",
|
|
28
|
-
"no-undef": "warn",
|
|
29
|
-
"no-unreachable": "warn",
|
|
30
|
-
"no-unused-vars": [
|
|
31
|
-
1,
|
|
32
|
-
{"varsIgnorePattern": "^_", "args": "all", "argsIgnorePattern": "^_"}
|
|
33
|
-
],
|
|
34
|
-
"constructor-super": "warn",
|
|
35
|
-
"valid-typeof": "warn",
|
|
36
|
-
"mocha-no-only/mocha-no-only": "error",
|
|
37
|
-
"node/no-unpublished-require": ["off"]
|
|
38
|
-
}
|
|
39
|
-
}
|