Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@applitools/screenshoter

Package Overview
Dependencies
Maintainers
33
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/screenshoter - npm Package Compare versions

Comparing version 3.5.1 to 3.5.2

12

package.json
{
"name": "@applitools/screenshoter",
"version": "3.5.1",
"version": "3.5.2",
"description": "Applitools universal screenshoter for web and native applications",

@@ -75,6 +75,6 @@ "keywords": [

"dependencies": {
"@applitools/image": "1.0.1",
"@applitools/logger": "1.1.16",
"@applitools/image": "1.0.2",
"@applitools/logger": "1.1.20",
"@applitools/snippets": "2.4.5",
"@applitools/utils": "1.3.10",
"@applitools/utils": "1.3.12",
"jpeg-js": "0.4.4",

@@ -85,5 +85,5 @@ "png-async": "0.9.4"

"@applitools/bongo": "^2.2.0",
"@applitools/driver": "^1.9.25",
"@applitools/driver": "^1.9.28",
"@applitools/scripts": "^1.1.0",
"@applitools/spec-driver-webdriverio": "^1.2.19",
"@applitools/spec-driver-webdriverio": "^1.2.20",
"@applitools/test-utils": "^1.5.1",

@@ -90,0 +90,0 @@ "appium": "^1.22.3",

@@ -40,2 +40,3 @@ const utils = require('@applitools/utils')

}
let returnRegion, scrollingElement

@@ -45,19 +46,20 @@ if (fully) {

// if element is scrollable, then take screenshot of the full element content, otherwise take screenshot of full element
const region = isScrollable ? null : await element.getRegion()
const scrollingElement = isScrollable ? element : await elementContext.getScrollingElement()
returnRegion = isScrollable ? null : await element.getRegion()
scrollingElement = isScrollable ? element : await elementContext.getScrollingElement()
// css stitching could be applied only to root element of its context
scrollingMode = scrollingMode === 'css' && !(await scrollingElement.isRoot()) ? 'mixed+' : scrollingMode
return {
context: elementContext,
region,
scroller: makeScroller({element: scrollingElement, scrollingMode, logger}),
}
} else {
const scrollingElement = await context.getScrollingElement()
return {
context: elementContext,
region: await element.getRegion(),
scroller: makeScroller({element: scrollingElement, scrollingMode, logger}),
}
scrollingElement = await context.getScrollingElement()
returnRegion = await element.getRegion()
}
const scroller = makeScroller({element: scrollingElement, scrollingMode, logger})
if (returnRegion && !element.driver.isNative && !(await scrollingElement.isRoot())) {
const scrollerOffset = await scroller.getScrollOffset()
returnRegion = utils.geometry.offset(returnRegion, scrollerOffset)
}
return {
context: elementContext,
region: returnRegion,
scroller,
}
}

@@ -64,0 +66,0 @@ } else if (!context.isMain) {

@@ -67,53 +67,54 @@ const {makeLogger} = require('@applitools/logger')

try {
// TODO: identify spot in this function to call to takeScreenshot in the nml-client
// if running on native mobile and the user has enabled NML
if (!window && !driver.isNative) await scrollIntoViewport({...target, logger})
if (!window && !driver.isNative) await scrollIntoViewport({...target, logger})
if (fully && !target.region && target.scroller) await target.scroller.moveTo({x: 0, y: 0})
if (fully && !target.region && target.scroller) await target.scroller.moveTo({x: 0, y: 0})
const screenshot =
fully && target.scroller
? await takeStitchedScreenshot({
...target,
withStatusBar,
overlap,
framed,
wait,
stabilization,
debug,
logger,
lazyLoad,
})
: await takeSimpleScreenshot({...target, withStatusBar, wait, stabilization, debug, logger})
const screenshot =
fully && target.scroller
? await takeStitchedScreenshot({
...target,
withStatusBar,
overlap,
framed,
wait,
stabilization,
debug,
logger,
lazyLoad,
})
: await takeSimpleScreenshot({...target, withStatusBar, wait, stabilization, debug, logger})
screenshot.image.scale(driver.viewportScale)
screenshot.image.scale(driver.viewportScale)
const caltulatedRegions = await extractCoodinatesForSelectorsAndElements({regionsToCalculate, screenshot, context})
const calculatedRegions = await extractCoodinatesForSelectorsAndElements({regionsToCalculate, screenshot, context})
if (hooks && hooks.afterScreenshot) {
await hooks.afterScreenshot({driver, scroller: target.scroller, screenshot})
}
if (hooks && hooks.afterScreenshot) {
await hooks.afterScreenshot({driver, scroller: target.scroller, screenshot})
}
return {screenshot, caltulatedRegions}
} finally {
if (target.scroller) {
await target.scroller.restoreScrollbars()
await target.scroller.restoreState()
}
return {
...screenshot,
scrollingElement: target.scroller && target.scroller.element,
calculatedRegions,
async restoreState() {
if (target.scroller) {
await target.scroller.restoreScrollbars()
await target.scroller.restoreState()
}
// if there was active element and we have blurred it, then restore focus
if (activeElement) await context.focusElement(activeElement)
// if there was active element and we have blurred it, then restore focus
if (activeElement) await context.focusElement(activeElement)
// traverse from target context to the main context to restore scrollbars and context states
for (const prevContext of context.path.reverse()) {
const scrollingElement = await prevContext.getScrollingElement()
if (scrollingElement) {
if (driver.isWeb && hideScrollbars) await scrollingElement.restoreScrollbars()
await scrollingElement.restoreState()
// traverse from target context to the main context to restore scrollbars and context states
for (const prevContext of context.path.reverse()) {
const scrollingElement = await prevContext.getScrollingElement()
if (scrollingElement) {
if (driver.isWeb && hideScrollbars) await scrollingElement.restoreScrollbars()
await scrollingElement.restoreState()
}
}
}
// restore focus on original active context
await activeContext.focus()
// restore focus on original active context
await activeContext.focus()
},
}

@@ -120,0 +121,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc