New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@applitools/driver

Package Overview
Dependencies
Maintainers
34
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/driver - npm Package Compare versions

Comparing version 1.11.9 to 1.11.10

117

dist/element.js

@@ -99,4 +99,4 @@ "use strict";

const contains = await this.withRefresh(async () => {
var _a, _b, _c, _d, _e;
var _f;
var _a, _b;
var _c;
innerElement = innerElement instanceof Element ? innerElement.target : innerElement;

@@ -115,15 +115,6 @@ if (this.driver.isWeb) {

// if the inner element region is contained in this element region, then it then could be assumed that the inner element is contained in this element
let contentRegion = await ((_b = this.driver.helper) === null || _b === void 0 ? void 0 : _b.getContentRegion(this));
if (!contentRegion || !this.driver.isAndroid) {
const nativeContentRegion = await this.getContentSizeFromAttribute();
contentRegion = {
x: nativeContentRegion.x,
y: nativeContentRegion.y,
width: Math.max((_c = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.width) !== null && _c !== void 0 ? _c : 0, nativeContentRegion.width),
height: Math.max((_d = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.height) !== null && _d !== void 0 ? _d : 0, nativeContentRegion.height),
};
}
const contentRegion = await this.getContentRegion();
const innerRegion = await this._spec.getElementRegion(this.driver.target, innerElement);
const contains = utils.geometry.contains(contentRegion, innerRegion);
(_e = (_f = this._state).containedElements) !== null && _e !== void 0 ? _e : (_f.containedElements = new Map());
(_b = (_c = this._state).containedElements) !== null && _b !== void 0 ? _b : (_c.containedElements = new Map());
this._state.containedElements.set(innerElement, contains);

@@ -183,33 +174,62 @@ return contains;

}
async getContentSizeFromAttribute() {
try {
const data = await this.getAttribute('contentSize');
const contentSize = JSON.parse(data);
return {
x: contentSize.left,
y: contentSize.top,
width: contentSize.width,
height: this.driver.isIOS
? Math.max(contentSize.height, contentSize.scrollableOffset)
: contentSize.height + contentSize.scrollableOffset,
};
}
catch (err) {
this._logger.warn(`Unable to get the attribute 'contentSize' due to the following error: '${err.message}'`);
}
if (this.driver.isIOS) {
const type = await this.getAttribute('type');
if (type === 'XCUIElementTypeScrollView') {
const elementRegion = await this._spec.getElementRegion(this.driver.target, this.target);
const [childElement] = await this.driver.elements({
type: 'xpath',
selector: '//XCUIElementTypeScrollView[1]/*', // We cannot be sure that our element is the first one
});
const childElementRegion = await this._spec.getElementRegion(this.driver.target, childElement.target);
return {
...elementRegion,
height: childElementRegion.y + childElementRegion.height - elementRegion.y,
async getContentRegion(options = {}) {
var _a, _b, _c;
if (!this.driver.isNative)
return;
this._logger.log('Extracting content region of native element with selector', this.selector);
let contentRegion = await ((_a = this.driver.helper) === null || _a === void 0 ? void 0 : _a.getContentRegion(this, options));
this._logger.log('Extracted content region using helper library', contentRegion);
if (!contentRegion || !this.driver.isAndroid) {
let attrContentRegion;
try {
const size = JSON.parse(await this.getAttribute('contentSize'));
attrContentRegion = {
x: size.left,
y: size.top,
width: size.width,
height: this.driver.isIOS
? Math.max(size.height, size.scrollableOffset)
: size.height + size.scrollableOffset,
};
}
catch (err) {
this._logger.warn(`Unable to get the attribute 'contentSize' due to the following error: '${err.message}'`);
}
this._logger.log('Extracted content region using attribute', attrContentRegion);
// ios workaround
if (!attrContentRegion && this.driver.isIOS) {
try {
const type = await this.getAttribute('type');
if (type !== 'XCUIElementTypeScrollView') {
const [child] = await this.driver.elements({
type: 'xpath',
selector: '//XCUIElementTypeScrollView[1]/*', // We cannot be sure that our element is the first one
});
if (child) {
const region = await this._spec.getElementRegion(this.driver.target, this.target);
const childRegion = await this._spec.getElementRegion(this.driver.target, child.target);
attrContentRegion = {
...region,
height: childRegion.y + childRegion.height - region.y,
};
}
}
}
catch (err) {
this._logger.warn(`Unable to calculate content region using iOS workaround due to the following error: '${err.message}'`);
}
this._logger.log('Extracted content region using iOS workaround', attrContentRegion);
}
if (attrContentRegion) {
contentRegion = {
x: attrContentRegion.x,
y: attrContentRegion.y,
width: Math.max((_b = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.width) !== null && _b !== void 0 ? _b : 0, attrContentRegion.width),
height: Math.max((_c = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.height) !== null && _c !== void 0 ? _c : 0, attrContentRegion.height),
};
}
}
return contentRegion !== null && contentRegion !== void 0 ? contentRegion : (await this._spec.getElementRegion(this.driver.target, this.target));
}
async getContentSizeIOS() {
return this._spec.getElementRegion(this.driver.target, this.target);

@@ -221,3 +241,2 @@ }

const size = await this.withRefresh(async () => {
var _a, _b, _c;
if (this.driver.isWeb) {

@@ -230,15 +249,3 @@ this._logger.log('Extracting content size of web element with selector', this.selector);

try {
let contentRegion = await ((_a = this.driver.helper) === null || _a === void 0 ? void 0 : _a.getContentRegion(this, options));
this._logger.log('Extracted native content region using helper library', contentRegion);
// on android extraction of this argument will perform non-deterministic touch action, so it is better to avoid it
if (!contentRegion || !this.driver.isAndroid) {
const attrContentRegion = await this.getContentSizeFromAttribute();
this._logger.log('Extracted native content region using attribute', attrContentRegion);
contentRegion = {
x: attrContentRegion.x,
y: attrContentRegion.y,
width: Math.max((_b = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.width) !== null && _b !== void 0 ? _b : 0, attrContentRegion.width),
height: Math.max((_c = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.height) !== null && _c !== void 0 ? _c : 0, attrContentRegion.height),
};
}
const contentRegion = await this.getContentRegion(options);
this._state.contentSize = utils.geometry.size(contentRegion);

@@ -245,0 +252,0 @@ if (this.driver.isAndroid) {

{
"name": "@applitools/driver",
"version": "1.11.9",
"version": "1.11.10",
"description": "Applitools universal framework wrapper",

@@ -91,3 +91,3 @@ "keywords": [

"@applitools/logger": "1.1.30",
"@applitools/snippets": "2.4.8",
"@applitools/snippets": "2.4.9",
"@applitools/utils": "1.3.16",

@@ -94,0 +94,0 @@ "semver": "7.3.7"

@@ -44,8 +44,10 @@ import type { Location, Size, Region } from '@applitools/utils';

getClientRegion(): Promise<Region>;
getContentSizeFromAttribute(): Promise<{
x: any;
y: any;
width: any;
height: any;
}>;
getContentRegion(options?: {
lazyLoad?: {
scrollLength?: number;
waitingTime?: number;
maxAmountToScroll?: number;
};
}): Promise<Region>;
getContentSizeIOS(): Promise<Region>;
getContentSize(options?: {

@@ -52,0 +54,0 @@ lazyLoad?: {

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