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
33
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.9.23 to 1.9.24

1

dist/driver.js

@@ -258,2 +258,3 @@ "use strict";

}
// TODO: if user opts into NML, skip initializing the helpers
// init helper lib

@@ -260,0 +261,0 @@ if (!((_3 = this._customConfig) === null || _3 === void 0 ? void 0 : _3.disableHelper)) {

4

dist/element.js

@@ -193,3 +193,3 @@ "use strict";

}
async getContentSize() {
async getContentSize(options = {}) {
if (this._state.contentSize)

@@ -206,3 +206,3 @@ return this._state.contentSize;

try {
let contentRegion = await ((_a = this.driver.helper) === null || _a === void 0 ? void 0 : _a.getContentRegion(this));
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);

@@ -209,0 +209,0 @@ // on android extraction of this argument will perform non-deterministic touch action, so it is better to avoid it

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HelperAndroid = void 0;
const utils = __importStar(require("@applitools/utils"));
const gte_1 = __importDefault(require("semver/functions/gte"));
class HelperAndroid {
constructor(options) {
this._supportAsync = false;
this._spec = options.spec;

@@ -12,4 +41,6 @@ this._input = options.input;

this.name = this._legacy ? 'android-legacy' : 'android';
this._supportAsync = options.supportAsync === true;
}
static async make(options) {
var _a;
const { spec, driver, logger } = options;

@@ -22,2 +53,7 @@ let legacy = false;

}
const versionElement = await driver.element({
type: 'xpath',
selector: '//*[@content-desc="EyesAppiumHelper_Version"]',
});
const version = (_a = (await (versionElement === null || versionElement === void 0 ? void 0 : versionElement.getText()))) !== null && _a !== void 0 ? _a : '0.0.0';
const action = !legacy

@@ -27,3 +63,10 @@ ? await driver.element({ type: 'xpath', selector: '//*[@content-desc="EyesAppiumHelper_Action"]' })

return input
? new HelperAndroid({ spec, input, action, legacy, logger })
? new HelperAndroid({
spec,
input,
action,
legacy,
logger,
supportAsync: (0, gte_1.default)(version, '1.8.0'),
})
: null;

@@ -45,6 +88,21 @@ }

}
// wait until the JAVA complete the async operation
const timeout = 5 * 60 * 1000;
const finishAt = Date.now() + timeout;
while (text === 'WAIT' && finishAt > Date.now()) {
await utils.general.sleep(1000);
text = await this._input.getText();
}
if (text === 'WAIT') {
this._logger.warn(`Helper library didn't provide a response for async command (${command}) during ${timeout}ms`);
text = null;
}
await this._input.type('');
return text;
}
async getContentRegion(element) {
async getContentRegion(element, options) {
var _a, _b, _c;
const elementId = await this._getElementId(element);
if (!elementId)
return null;
let contentHeightString;

@@ -55,13 +113,16 @@ if (this._legacy) {

}
else if (this._supportAsync && ((_a = options === null || options === void 0 ? void 0 : options.lazyLoad) === null || _a === void 0 ? void 0 : _a.waitingTime)) {
const result = await this._command(`offset_async;${elementId};0;0;0;${(_c = (_b = options === null || options === void 0 ? void 0 : options.lazyLoad) === null || _b === void 0 ? void 0 : _b.waitingTime) !== null && _c !== void 0 ? _c : 0}`);
contentHeightString = result.split(';')[0];
}
else {
const elementId = await this._getElementId(element);
if (!elementId)
return null;
contentHeightString = await this._command(`offset;${elementId};0;0;0`);
contentHeightString = await this._command(`'offset';${elementId};0;0;0;0`);
}
const contentHeight = Number(contentHeightString);
if (Number.isNaN(contentHeight))
return null;
const region = await this._spec.getElementRegion(this._input.driver.target, element.target);
const contentHeight = Number(contentHeightString);
return !Number.isNaN(contentHeight) && contentHeight >= region.height
? { x: region.x, y: region.y, width: region.width, height: contentHeight }
: null;
if (contentHeight < region.height)
return null;
return { x: region.x, y: region.y, width: region.width, height: contentHeight };
}

@@ -71,3 +132,3 @@ async getTouchPadding() {

return null;
const touchPaddingString = await this._command(`getTouchPadding;0;0;0;0`);
const touchPaddingString = await this._command(`getTouchPadding;0;0;0;0;0`);
const touchPadding = Number(touchPaddingString);

@@ -84,3 +145,3 @@ if (!touchPadding || Number.isNaN(touchPadding))

return null;
const regionString = await this._command(`getRect;${elementId};0;0`);
const regionString = await this._command(`getRect;${elementId};0;0;0`);
if (!regionString)

@@ -100,3 +161,3 @@ return null;

return null;
await this._command(`moveToTop;${elementId};0;-1`);
await this._command(`moveToTop;${elementId};0;-1;0`);
}

@@ -109,5 +170,5 @@ async scrollBy(element, offset) {

return null;
await this._command(`scroll;${elementId};${offset.y};0;0`);
await this._command(`scroll;${elementId};${offset.y};0;0;0`);
}
}
exports.HelperAndroid = HelperAndroid;
{
"name": "@applitools/driver",
"version": "1.9.23",
"version": "1.9.24",
"description": "Applitools universal framework wrapper",

@@ -84,3 +84,4 @@ "keywords": [

"@applitools/types": "1.5.9",
"@applitools/utils": "1.3.10"
"@applitools/utils": "1.3.10",
"semver": "7.3.7"
},

@@ -87,0 +88,0 @@ "devDependencies": {

@@ -42,3 +42,5 @@ import type * as types from '@applitools/types';

getClientRegion(): Promise<types.Region>;
getContentSize(): Promise<types.Size>;
getContentSize(options?: {
lazyLoad?: types.LazyLoadOptions;
}): Promise<types.Size>;
isPager(): Promise<boolean>;

@@ -45,0 +47,0 @@ isScrollable(): Promise<boolean>;

@@ -15,2 +15,3 @@ import type * as types from '@applitools/types';

private readonly _legacy;
private readonly _supportAsync;
private _logger;

@@ -24,6 +25,9 @@ readonly name: 'android' | 'android-legacy';

logger?: any;
supportAsync?: boolean;
});
private _getElementId;
private _command;
getContentRegion(element: Element<TDriver, TContext, TElement, TSelector>): Promise<types.Region>;
getContentRegion(element: Element<TDriver, TContext, TElement, TSelector>, options?: {
lazyLoad?: types.LazyLoadOptions;
}): Promise<types.Region>;
getTouchPadding(): Promise<number>;

@@ -30,0 +34,0 @@ getRegion(element: Element<TDriver, TContext, TElement, TSelector>): Promise<types.Region>;

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