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

@applitools/driver

Package Overview
Dependencies
Maintainers
34
Versions
219
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.29 to 1.11.30

97

dist/driver.js

@@ -67,5 +67,2 @@ "use strict";

}
get helper() {
return this._helper;
}
get features() {

@@ -183,4 +180,4 @@ var _a;

async init() {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22;
var _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18;
var _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33;
// NOTE: this is here because saucelabs does not provide right capabilities for the first call

@@ -193,3 +190,3 @@ await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));

this._driverInfo = { ...capabilitiesInfo, ...driverInfo };
(_g = (_23 = this._driverInfo).remoteHostname) !== null && _g !== void 0 ? _g : (_23.remoteHostname = (_k = (_j = (_h = this._spec).extractHostName) === null || _j === void 0 ? void 0 : _j.call(_h, this.target)) !== null && _k !== void 0 ? _k : undefined);
(_g = (_19 = this._driverInfo).remoteHostname) !== null && _g !== void 0 ? _g : (_19.remoteHostname = (_k = (_j = (_h = this._spec).extractHostName) === null || _j === void 0 ? void 0 : _j.call(_h, this.target)) !== null && _k !== void 0 ? _k : undefined);
if (this.isMobile) {

@@ -203,16 +200,12 @@ this._driverInfo.orientation =

const browserInfo = await this.currentContext.executePoll(snippets.getBrowserInfo);
(_m = (_24 = this._driverInfo).userAgent) !== null && _m !== void 0 ? _m : (_24.userAgent = browserInfo.userAgent);
(_o = (_25 = this._driverInfo).pixelRatio) !== null && _o !== void 0 ? _o : (_25.pixelRatio = browserInfo.pixelRatio);
(_p = (_26 = this._driverInfo).viewportScale) !== null && _p !== void 0 ? _p : (_26.viewportScale = browserInfo.viewportScale);
if (browserInfo.userAgentData) {
(_q = (_27 = this._driverInfo).isMobile) !== null && _q !== void 0 ? _q : (_27.isMobile = this._driverInfo.isMobile);
(_r = (_28 = this._driverInfo).isChromium) !== null && _r !== void 0 ? _r : (_28.isChromium = this._driverInfo.isChromium);
if (this.isChromium) {
if (this.isWindows && Number.parseInt(this.browserVersion) >= 107) {
this._driverInfo.platformVersion = (_s = browserInfo.platformVersion) !== null && _s !== void 0 ? _s : this._driverInfo.platformVersion;
}
else if (this.isMac && Number.parseInt(this.browserVersion) >= 90) {
this._driverInfo.platformVersion = (_t = browserInfo.platformVersion) !== null && _t !== void 0 ? _t : this._driverInfo.platformVersion;
}
(_m = (_20 = this._driverInfo).userAgent) !== null && _m !== void 0 ? _m : (_20.userAgent = browserInfo.userAgent);
(_o = (_21 = this._driverInfo).pixelRatio) !== null && _o !== void 0 ? _o : (_21.pixelRatio = browserInfo.pixelRatio);
(_p = (_22 = this._driverInfo).viewportScale) !== null && _p !== void 0 ? _p : (_22.viewportScale = browserInfo.viewportScale);
if (browserInfo.userAgentData && this.isChromium) {
if (this.isWindows && Number.parseInt(this.browserVersion) >= 107) {
this._driverInfo.platformVersion = (_q = browserInfo.platformVersion) !== null && _q !== void 0 ? _q : this._driverInfo.platformVersion;
}
else if (this.isMac && Number.parseInt(this.browserVersion) >= 90) {
this._driverInfo.platformVersion = (_r = browserInfo.platformVersion) !== null && _r !== void 0 ? _r : this._driverInfo.platformVersion;
}
}

@@ -223,16 +216,16 @@ if (this._driverInfo.userAgent) {

this._driverInfo.browserName =
(_v = (_u = userAgentInfo.browserName) !== null && _u !== void 0 ? _u : userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.browserName) !== null && _v !== void 0 ? _v : this._driverInfo.browserName;
(_t = (_s = userAgentInfo.browserName) !== null && _s !== void 0 ? _s : userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.browserName) !== null && _t !== void 0 ? _t : this._driverInfo.browserName;
this._driverInfo.browserVersion =
(_x = (_w = userAgentInfo.browserVersion) !== null && _w !== void 0 ? _w : userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.browserVersion) !== null && _x !== void 0 ? _x : this._driverInfo.browserVersion;
(_y = (_29 = this._driverInfo).isMobile) !== null && _y !== void 0 ? _y : (_29.isMobile = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.isMobile);
(_z = (_30 = this._driverInfo).isChromium) !== null && _z !== void 0 ? _z : (_30.isChromium = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.isChromium);
(_v = (_u = userAgentInfo.browserVersion) !== null && _u !== void 0 ? _u : userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.browserVersion) !== null && _v !== void 0 ? _v : this._driverInfo.browserVersion;
(_w = (_23 = this._driverInfo).isMobile) !== null && _w !== void 0 ? _w : (_23.isMobile = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.isMobile);
(_x = (_24 = this._driverInfo).isChromium) !== null && _x !== void 0 ? _x : (_24.isChromium = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.isChromium);
if (this._driverInfo.isMobile) {
(_0 = (_31 = this._driverInfo).platformName) !== null && _0 !== void 0 ? _0 : (_31.platformName = (_1 = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.platformName) !== null && _1 !== void 0 ? _1 : userAgentInfo.platformName);
(_2 = (_32 = this._driverInfo).platformVersion) !== null && _2 !== void 0 ? _2 : (_32.platformVersion = (_3 = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.platformVersion) !== null && _3 !== void 0 ? _3 : userAgentInfo.platformVersion);
(_y = (_25 = this._driverInfo).platformName) !== null && _y !== void 0 ? _y : (_25.platformName = (_z = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.platformName) !== null && _z !== void 0 ? _z : userAgentInfo.platformName);
(_0 = (_26 = this._driverInfo).platformVersion) !== null && _0 !== void 0 ? _0 : (_26.platformVersion = (_1 = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.platformVersion) !== null && _1 !== void 0 ? _1 : userAgentInfo.platformVersion);
}
else {
this._driverInfo.platformName =
(_5 = (_4 = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.platformName) !== null && _4 !== void 0 ? _4 : userAgentInfo.platformName) !== null && _5 !== void 0 ? _5 : this._driverInfo.platformName;
(_3 = (_2 = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.platformName) !== null && _2 !== void 0 ? _2 : userAgentInfo.platformName) !== null && _3 !== void 0 ? _3 : this._driverInfo.platformName;
this._driverInfo.platformVersion =
(_7 = (_6 = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.platformVersion) !== null && _6 !== void 0 ? _6 : userAgentInfo.platformVersion) !== null && _7 !== void 0 ? _7 : this._driverInfo.platformVersion;
(_5 = (_4 = userAgentDataInfo === null || userAgentDataInfo === void 0 ? void 0 : userAgentDataInfo.platformVersion) !== null && _4 !== void 0 ? _4 : userAgentInfo.platformVersion) !== null && _5 !== void 0 ? _5 : this._driverInfo.platformVersion;
}

@@ -244,4 +237,4 @@ }

}
(_8 = (_33 = this._driverInfo).features) !== null && _8 !== void 0 ? _8 : (_33.features = {});
(_9 = (_34 = this._driverInfo.features).allCookies) !== null && _9 !== void 0 ? _9 : (_34.allCookies = this._driverInfo.isChrome ||
(_6 = (_27 = this._driverInfo).features) !== null && _6 !== void 0 ? _6 : (_27.features = {});
(_7 = (_28 = this._driverInfo.features).allCookies) !== null && _7 !== void 0 ? _7 : (_28.allCookies = this._driverInfo.isChrome ||
(!!this._driverInfo.browserName && /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile));

@@ -252,4 +245,4 @@ }

let windowSize = await this._spec.getWindowSize(this.target);
(_10 = (_35 = this._driverInfo).displaySize) !== null && _10 !== void 0 ? _10 : (_35.displaySize = windowSize);
if (((_11 = this.orientation) === null || _11 === void 0 ? void 0 : _11.startsWith('landscape')) &&
(_8 = (_29 = this._driverInfo).displaySize) !== null && _8 !== void 0 ? _8 : (_29.displaySize = windowSize);
if (((_9 = this.orientation) === null || _9 === void 0 ? void 0 : _9.startsWith('landscape')) &&
this._driverInfo.displaySize.height > this._driverInfo.displaySize.width) {

@@ -263,3 +256,3 @@ this._driverInfo.displaySize = {

// bar sizes could be extracted only on android
const systemBars = await ((_13 = (_12 = this._spec).getSystemBars) === null || _13 === void 0 ? void 0 : _13.call(_12, this.target).catch(() => null));
const systemBars = await ((_11 = (_10 = this._spec).getSystemBars) === null || _11 === void 0 ? void 0 : _11.call(_10, this.target).catch(() => null));
const { statusBar, navigationBar } = systemBars !== null && systemBars !== void 0 ? systemBars : {};

@@ -271,3 +264,3 @@ if (statusBar === null || statusBar === void 0 ? void 0 : statusBar.visible) {

if (statusBarSize < this._driverInfo.displaySize.height) {
this._driverInfo.statusBarSize = Math.max((_14 = this._driverInfo.statusBarSize) !== null && _14 !== void 0 ? _14 : 0, statusBarSize);
this._driverInfo.statusBarSize = Math.max((_12 = this._driverInfo.statusBarSize) !== null && _12 !== void 0 ? _12 : 0, statusBarSize);
}

@@ -281,7 +274,7 @@ }

// navigation bar size could be its height or width depending on screen orientation
const navigationBarSize = navigationBar[((_15 = this.orientation) === null || _15 === void 0 ? void 0 : _15.startsWith('landscape')) ? 'width' : 'height'];
const navigationBarSize = navigationBar[((_13 = this.orientation) === null || _13 === void 0 ? void 0 : _13.startsWith('landscape')) ? 'width' : 'height'];
// when navigation bar is invisible on android it returns navigation bar size equal to display size
if (navigationBarSize <
this._driverInfo.displaySize[((_16 = this.orientation) === null || _16 === void 0 ? void 0 : _16.startsWith('landscape')) ? 'width' : 'height']) {
this._driverInfo.navigationBarSize = Math.max((_17 = this._driverInfo.navigationBarSize) !== null && _17 !== void 0 ? _17 : 0, navigationBarSize);
this._driverInfo.displaySize[((_14 = this.orientation) === null || _14 === void 0 ? void 0 : _14.startsWith('landscape')) ? 'width' : 'height']) {
this._driverInfo.navigationBarSize = Math.max((_15 = this._driverInfo.navigationBarSize) !== null && _15 !== void 0 ? _15 : 0, navigationBarSize);
}

@@ -293,13 +286,13 @@ else {

// bar sizes have to be scaled on android
(_36 = this._driverInfo).statusBarSize && (_36.statusBarSize = this._driverInfo.statusBarSize / this.pixelRatio);
(_37 = this._driverInfo).navigationBarSize && (_37.navigationBarSize = this._driverInfo.navigationBarSize / this.pixelRatio);
(_30 = this._driverInfo).statusBarSize && (_30.statusBarSize = this._driverInfo.statusBarSize / this.pixelRatio);
(_31 = this._driverInfo).navigationBarSize && (_31.navigationBarSize = this._driverInfo.navigationBarSize / this.pixelRatio);
windowSize = utils.geometry.scale(windowSize, 1 / this.pixelRatio);
(_38 = this._driverInfo).displaySize && (_38.displaySize = utils.geometry.scale(this._driverInfo.displaySize, 1 / this.pixelRatio));
(_32 = this._driverInfo).displaySize && (_32.displaySize = utils.geometry.scale(this._driverInfo.displaySize, 1 / this.pixelRatio));
}
if (this.isIOS) {
if ((_18 = this.orientation) === null || _18 === void 0 ? void 0 : _18.startsWith('landscape'))
if ((_16 = this.orientation) === null || _16 === void 0 ? void 0 : _16.startsWith('landscape'))
this._driverInfo.statusBarSize = 0;
}
// calculate viewport location
(_19 = (_39 = this._driverInfo).viewportLocation) !== null && _19 !== void 0 ? _19 : (_39.viewportLocation = {
(_17 = (_33 = this._driverInfo).viewportLocation) !== null && _17 !== void 0 ? _17 : (_33.viewportLocation = {
x: this.orientation === 'landscape' ? this.navigationBarSize : 0,

@@ -313,3 +306,3 @@ y: this.statusBarSize,

if (this.isAndroid) {
this._driverInfo.viewportSize[((_20 = this.orientation) === null || _20 === void 0 ? void 0 : _20.startsWith('landscape')) ? 'width' : 'height'] -=
this._driverInfo.viewportSize[((_18 = this.orientation) === null || _18 === void 0 ? void 0 : _18.startsWith('landscape')) ? 'width' : 'height'] -=
this.navigationBarSize;

@@ -341,10 +334,2 @@ }

}
// TODO: if user opts into NML, skip initializing the helpers
// init helper lib
if (!((_21 = this._customConfig) === null || _21 === void 0 ? void 0 : _21.disableHelper)) {
this._helper = this.isIOS
? await helper_ios_1.HelperIOS.make({ spec: this._spec, driver: this, logger: this._logger })
: await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this, logger: this._logger });
}
this._logger.log(`Helper set to ${(_22 = this._helper) === null || _22 === void 0 ? void 0 : _22.name}`);
}

@@ -354,2 +339,14 @@ this._logger.log('Combined driver info', this._driverInfo);

}
async getHelper() {
var _a, _b, _c;
if (this._helper === undefined) {
this._logger.log(`Extracting helper for ${this.isIOS ? 'ios' : 'android'}`);
this._helper = this.isIOS
? await helper_ios_1.HelperIOS.make({ spec: this._spec, driver: this, logger: this._logger })
: await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this, logger: this._logger });
this._logger.log(`Extracted helper of type ${(_a = this._helper) === null || _a === void 0 ? void 0 : _a.name}`);
}
this._logger.log(`Returning helper for of type ${(_c = (_b = this._helper) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : null}`);
return this._helper;
}
// begin world

@@ -356,0 +353,0 @@ //

@@ -176,7 +176,8 @@ "use strict";

async getContentRegion(options = {}) {
var _a, _b, _c;
var _a, _b;
if (!this.driver.isNative)
return null;
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));
const helper = await this.driver.getHelper();
let contentRegion = await (helper === null || helper === void 0 ? void 0 : helper.getContentRegion(this, options));
this._logger.log('Extracted content region using helper library', contentRegion);

@@ -228,4 +229,4 @@ if (!contentRegion || !this.driver.isAndroid) {

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),
width: Math.max((_a = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.width) !== null && _a !== void 0 ? _a : 0, attrContentRegion.width),
height: Math.max((_b = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.height) !== null && _b !== void 0 ? _b : 0, attrContentRegion.height),
};

@@ -317,4 +318,4 @@ }

async getTouchPadding() {
var _a, _b;
var _c;
var _a;
var _b;
if (this._state.touchPadding == null) {

@@ -326,4 +327,5 @@ if (this.driver.isWeb)

else if (this.driver.isAndroid) {
if (((_a = this.driver.helper) === null || _a === void 0 ? void 0 : _a.name) === 'android') {
this._state.touchPadding = await this.driver.helper.getTouchPadding();
const helper = await this.driver.getHelper();
if ((helper === null || helper === void 0 ? void 0 : helper.name) === 'android') {
this._state.touchPadding = await helper.getTouchPadding();
this._logger.log('Touch padding extracted using helper library', this._state.touchPadding);

@@ -339,3 +341,3 @@ }

}
(_b = (_c = this._state).touchPadding) !== null && _b !== void 0 ? _b : (_c.touchPadding = 20);
(_a = (_b = this._state).touchPadding) !== null && _a !== void 0 ? _a : (_b.touchPadding = 20);
this._logger.log('Touch padding set:', this._state.touchPadding);

@@ -406,3 +408,2 @@ }

return this.withRefresh(async () => {
var _a;
this._logger.log(`Scrolling to offset (${offset.x}, ${offset.y}) element with selector`, this.selector);

@@ -421,6 +422,9 @@ offset = utils.geometry.round({ x: Math.max(offset.x, 0), y: Math.max(offset.y, 0) });

return currentScrollOffset;
if (((_a = this.driver.helper) === null || _a === void 0 ? void 0 : _a.name) === 'android' && utils.geometry.equals(offset, { x: 0, y: 0 })) {
await this.driver.helper.scrollToTop(this);
this._state.scrollOffset = offset;
return this._state.scrollOffset;
if (utils.geometry.equals(offset, { x: 0, y: 0 }) && this.driver.isAndroid) {
const helper = await this.driver.getHelper();
if ((helper === null || helper === void 0 ? void 0 : helper.name) === 'android') {
await helper.scrollToTop(this);
this._state.scrollOffset = offset;
return this._state.scrollOffset;
}
}

@@ -427,0 +431,0 @@ const contentSize = await this.getContentSize();

{
"name": "@applitools/driver",
"version": "1.11.29",
"version": "1.11.30",
"description": "Applitools universal framework wrapper",

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

"devDependencies": {
"@applitools/bongo": "^2.2.2",
"@applitools/bongo": "^2.2.5",
"@types/mocha": "^9.1.1",

@@ -94,0 +94,0 @@ "@types/node": "12",

@@ -17,3 +17,2 @@ /// <reference types="node" />

useCeilForViewportSize?: boolean;
disableHelper?: boolean;
};

@@ -35,3 +34,2 @@ };

get mainContext(): Context<T>;
get helper(): HelperAndroid<T> | HelperIOS<T> | null | undefined;
get features(): {

@@ -71,2 +69,3 @@ shadowSelector?: boolean | undefined;

init(): Promise<this>;
getHelper(): Promise<HelperAndroid<T> | HelperIOS<T> | null>;
switchWorld(options?: {

@@ -116,5 +115,4 @@ id?: string;

useCeilForViewportSize?: boolean;
disableHelper?: boolean;
};
}): Promise<Driver<T>>;
export {};
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