@applitools/screenshoter 3.4.0 → 3.4.1

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.0",
3
+ "version": "3.4.1",
4
4
  "description": "Applitools universal screenshoter for web and native applications",
5
5
  "keywords": [
6
6
  "applitools",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "devDependencies": {
77
77
  "@applitools/bongo": "^2.1.4",
78
- "@applitools/driver": "^1.9.1",
78
+ "@applitools/driver": "^1.9.2",
79
79
  "@applitools/scripts": "1.1.0",
80
80
  "@applitools/spec-driver-webdriverio": "1.2.10",
81
81
  "@applitools/test-utils": "1.3.2",
package/src/get-target.js CHANGED
@@ -32,7 +32,9 @@ async function getTarget({window, context, region, fully, scrollingMode, logger}
32
32
  // if element is in a native context, then scroll it to the top, otherwise, it will be not possible to get all of its size
33
33
  const scrollingElement = await elementContext.getScrollingElement()
34
34
  if (scrollingElement && (await scrollingElement.contains(element))) {
35
- await scrollingElement.scrollTo(await element.getRegion())
35
+ const scrollingLocation = utils.geometry.location(await scrollingElement.getRegion())
36
+ const elementLocation = utils.geometry.location(await element.getRegion())
37
+ await scrollingElement.scrollTo(utils.geometry.offsetNegative(elementLocation, scrollingLocation))
36
38
  }
37
39
  }
38
40
 
package/src/image.js CHANGED
@@ -228,10 +228,11 @@ async function toPng(image) {
228
228
  })
229
229
  }
230
230
 
231
- async function toFile(image, path) {
231
+ async function toFile(image, filepath) {
232
232
  const buffer = await toPng(image)
233
233
  return new Promise((resolve, reject) => {
234
- fs.writeFile(path, buffer, err => (err ? reject(err) : resolve()))
234
+ fs.mkdirSync(path.dirname(filepath), {recursive: true})
235
+ fs.writeFile(filepath, buffer, err => (err ? reject(err) : resolve()))
235
236
  })
236
237
  }
237
238
 
@@ -167,7 +167,7 @@ function makeTakeNativeScreenshot({driver, stabilization = {}, debug, logger}) {
167
167
  image.crop({
168
168
  top: driver.statusBarHeight,
169
169
  bottom: driver.orientation === 'landscape' ? 0 : driver.navigationBarHeight,
170
- left: driver.platformVersion > 7 ? driver.navigationBarHeight : 0,
170
+ left: driver.platformVersion >= 8 ? driver.navigationBarHeight : 0,
171
171
  right: driver.platformVersion < 8 ? driver.navigationBarHeight : 0,
172
172
  })
173
173
  } else {