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

@applitools/driver

Package Overview
Dependencies
Maintainers
30
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.8.2 to 1.8.3

8

dist/context.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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) {

@@ -244,2 +248,3 @@ if (k2 === undefined) k2 = k;

}
this._logger.log('Finding element by selector: ', elementOrSelector);
const root = await this.root(elementOrSelector);

@@ -267,2 +272,3 @@ if (!root)

}
this._logger.log('Finding elements by selector: ', elementOrSelector);
const root = await this.root(elementOrSelector);

@@ -269,0 +275,0 @@ if (!root)

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

75

dist/driver.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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) {

@@ -23,2 +27,3 @@ if (k2 === undefined) k2 = k;

exports.Driver = void 0;
const logger_1 = require("@applitools/logger");
const utils = __importStar(require("@applitools/utils"));

@@ -35,11 +40,10 @@ const specUtils = __importStar(require("./spec-utils"));

constructor(options) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
if (options.driver instanceof Driver)
return options.driver;
this._customConfig = (_a = options.customConfig) !== null && _a !== void 0 ? _a : {};
this._spec = options.spec;
this._customConfig = options.customConfig || {};
if (options.logger)
this._logger = options.logger;
this._logger = (_c = (_b = options.logger) === null || _b === void 0 ? void 0 : _b.extend({ label: 'driver' })) !== null && _c !== void 0 ? _c : (0, logger_1.makeLogger)({ label: 'driver' });
if (this._spec.isDriver(options.driver)) {
this._target = (_c = (_b = (_a = this._spec).transformDriver) === null || _b === void 0 ? void 0 : _b.call(_a, options.driver)) !== null && _c !== void 0 ? _c : options.driver;
this._target = (_f = (_e = (_d = this._spec).transformDriver) === null || _e === void 0 ? void 0 : _e.call(_d, options.driver)) !== null && _f !== void 0 ? _f : options.driver;
}

@@ -51,3 +55,3 @@ else {

spec: this._spec,
context: (_f = (_e = (_d = this._spec).extractContext) === null || _e === void 0 ? void 0 : _e.call(_d, this._target)) !== null && _f !== void 0 ? _f : this._target,
context: (_j = (_h = (_g = this._spec).extractContext) === null || _h === void 0 ? void 0 : _h.call(_g, this._target)) !== null && _j !== void 0 ? _j : this._target,
driver: this,

@@ -147,6 +151,6 @@ logger: this._logger,

var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
var _w, _x, _y, _z, _0, _1, _2, _3;
var _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
this._logger.log('Driver capabilities', capabilities);
const capabilitiesInfo = capabilities ? capabilities_1.parseCapabilities(capabilities, this._customConfig) : undefined;
const capabilitiesInfo = capabilities ? (0, capabilities_1.parseCapabilities)(capabilities, this._customConfig) : undefined;
const driverInfo = await ((_d = (_c = this._spec).getDriverInfo) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));

@@ -159,3 +163,3 @@ this._driverInfo = Object.assign(Object.assign({}, capabilitiesInfo), driverInfo);

if (this._driverInfo.userAgent) {
const userAgentInfo = user_agent_1.parseUserAgent(this._driverInfo.userAgent);
const userAgentInfo = (0, user_agent_1.parseUserAgent)(this._driverInfo.userAgent);
this._driverInfo.browserName = (_h = userAgentInfo.browserName) !== null && _h !== void 0 ? _h : this._driverInfo.browserName;

@@ -176,18 +180,26 @@ this._driverInfo.browserVersion = (_j = userAgentInfo.browserVersion) !== null && _j !== void 0 ? _j : this._driverInfo.browserVersion;

else {
const barsHeight = await ((_s = (_r = this._spec).getBarsSize) === null || _s === void 0 ? void 0 : _s.call(_r, this.target).catch(() => undefined));
const displaySize = await this.getDisplaySize();
const orientation = await this.getOrientation();
// calculate status and navigation bars sizes
if (barsHeight) {
const orientation = await this.getOrientation();
// when status bar is overlapping content on android it returns status bar height equal to viewport height
if (this.isAndroid && barsHeight.statusBarHeight / this.pixelRatio < displaySize.height) {
this._driverInfo.statusBarHeight = Math.max((_t = this._driverInfo.statusBarHeight) !== null && _t !== void 0 ? _t : 0, barsHeight.statusBarHeight);
if (this.isAndroid) {
// bar sizes could be extracted only on android
const barsSize = await ((_s = (_r = this._spec).getBarsSize) === null || _s === void 0 ? void 0 : _s.call(_r, this.target).catch(() => undefined));
if (barsSize) {
this._logger.log('Driver bars size', barsSize);
// navigation bar height is replaced with the width in landscape orientation on android (due to the bug in appium)
if (orientation === 'landscape')
barsSize.navigationBarHeight = barsSize.navigationBarWidth;
// when status bar is overlapping content on android it returns status bar height equal to viewport height
if (barsSize.statusBarHeight / this.pixelRatio < displaySize.height) {
this._driverInfo.statusBarHeight = Math.max((_t = this._driverInfo.statusBarHeight) !== null && _t !== void 0 ? _t : 0, barsSize.statusBarHeight);
}
// when navigation bar is invisible on android it returns navigation bar height equal to viewport height
if (barsSize.navigationBarHeight / this.pixelRatio < displaySize.height) {
this._driverInfo.navigationBarHeight = Math.max((_u = this._driverInfo.navigationBarHeight) !== null && _u !== void 0 ? _u : 0, barsSize.navigationBarHeight);
}
// bar heights have to be scaled on android
(_3 = this._driverInfo).statusBarHeight && (_3.statusBarHeight = this._driverInfo.statusBarHeight / this.pixelRatio);
(_4 = this._driverInfo).navigationBarHeight && (_4.navigationBarHeight = this._driverInfo.navigationBarHeight / this.pixelRatio);
}
// android witches the width and height only for the navigationBar in landscape mode.
this._driverInfo.navigationBarHeight = Math.max((_u = this._driverInfo.navigationBarHeight) !== null && _u !== void 0 ? _u : 0, orientation === 'landscape' ? barsHeight.navigationBarWidth : barsHeight.navigationBarHeight);
}
if (this.isAndroid) {
this._driverInfo.statusBarHeight /= this.pixelRatio;
this._driverInfo.navigationBarHeight /= this.pixelRatio;
}
// calculate viewport size

@@ -197,3 +209,3 @@ if (!this._driverInfo.viewportSize) {

width: displaySize.width,
height: displaySize.height - this._driverInfo.statusBarHeight,
height: displaySize.height - this.statusBarHeight,
};

@@ -224,3 +236,3 @@ }

if (this.isMobile) {
(_v = (_3 = this._driverInfo).orientation) !== null && _v !== void 0 ? _v : (_3.orientation = await this.getOrientation().catch(() => undefined));
(_v = (_5 = this._driverInfo).orientation) !== null && _v !== void 0 ? _v : (_5.orientation = await this.getOrientation().catch(() => undefined));
}

@@ -434,5 +446,7 @@ this._logger.log('Combined driver info', this._driverInfo);

if ((_a = this._driverInfo) === null || _a === void 0 ? void 0 : _a.viewportSize) {
this._logger.log('Extracting viewport size from native driver using cached value');
size = this._driverInfo.viewportSize;
}
else {
this._logger.log('Extracting viewport size from native driver');
size = await this.getDisplaySize();

@@ -445,3 +459,5 @@ if (size.height > size.width) {

}
size.height -= this.statusBarHeight;
}
this._logger.log(`Rounding viewport size using`, this._customConfig.useCeilForViewportSize ? 'ceil' : 'round');
if (this._customConfig.useCeilForViewportSize) {

@@ -453,3 +469,2 @@ size = utils.geometry.ceil(size);

}
this._logger.log(`Extracting viewport size from native driver using '${this._customConfig.useCeilForViewportSize ? 'ceil' : 'round'}' method`);
}

@@ -506,3 +521,5 @@ else if (this._spec.getViewportSize) {

const size = await this._spec.getWindowSize(this.target);
return this.isAndroid ? utils.geometry.scale(size, 1 / this.pixelRatio) : size;
const normalizedSize = this.isAndroid ? utils.geometry.scale(size, 1 / this.pixelRatio) : size;
this._logger.log('Extracted and normalized display size:', normalizedSize);
return normalizedSize;
}

@@ -512,3 +529,3 @@ async getOrientation() {

return;
const orientation = this._spec.getOrientation(this.target);
const orientation = await this._spec.getOrientation(this.target);
this._logger.log('Extracted device orientation:', orientation);

@@ -520,4 +537,4 @@ return orientation;

return;
this._logger.log('Set device orientation:', orientation);
await this._spec.setOrientation(this.target, orientation);
this._logger.log('set device orientation:', orientation);
}

@@ -546,3 +563,3 @@ async getCookies() {

return null;
const url = this._spec.getUrl(this.target);
const url = await this._spec.getUrl(this.target);
this._logger.log('Extracted url:', url);

@@ -549,0 +566,0 @@ return url;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

{
"name": "@applitools/driver",
"version": "1.8.2",
"version": "1.8.3",
"description": "Applitools universal framework wrapper",

@@ -76,2 +76,3 @@ "keywords": [

"dependencies": {
"@applitools/logger": "1.1.4",
"@applitools/snippets": "2.2.3",

@@ -82,17 +83,17 @@ "@applitools/types": "1.4.2",

"devDependencies": {
"@applitools/bongo": "^2.0.3",
"@applitools/bongo": "^2.1.0",
"@types/mocha": "^9.1.1",
"@types/node": "^16.3.3",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"eslint": "^7.9.0",
"eslint-config-prettier": "^8.3.0",
"@types/node": "^17.0.31",
"@typescript-eslint/eslint-plugin": "^5.22.0",
"@typescript-eslint/parser": "^5.22.0",
"eslint": "^8.14.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-mocha-no-only": "^1.1.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-prettier": "^4.0.0",
"husky": "^4.3.7",
"mocha": "^9.0.3",
"prettier": "^2.3.2",
"ts-node": "^10.1.0",
"typescript": "^4.3.5"
"mocha": "^10.0.0",
"prettier": "^2.6.2",
"ts-node": "^10.7.0",
"typescript": "^4.6.4"
},

@@ -99,0 +100,0 @@ "engines": {

import type * as types from '@applitools/types';
import type { Driver } from './driver';
import { type Logger } from '@applitools/logger';
import { type Driver } from './driver';
import { Element } from './element';

@@ -35,3 +36,3 @@ export declare type ContextReference<TDriver, TContext, TElement, TSelector> = Context<TDriver, TContext, TElement, TSelector> | Element<TDriver, TContext, TElement, TSelector> | TElement | types.Selector<TSelector> | string | number;

scrollingElement?: Element<TDriver, TContext, TElement, TSelector>;
logger?: any;
logger?: Logger;
});

@@ -38,0 +39,0 @@ get target(): TContext;

/// <reference types="node" />
import type * as types from '@applitools/types';
import { type Logger } from '@applitools/logger';
import { Context, ContextReference } from './context';

@@ -19,3 +20,3 @@ import { Element } from './element';

driver: Driver<TDriver, TContext, TElement, TSelector> | TDriver;
logger?: any;
logger?: Logger;
customConfig?: types.CustomDriverConfig;

@@ -66,3 +67,3 @@ });

getOrientation(): Promise<'portrait' | 'landscape'>;
setOrientation(orientation: types.ScreenOrientation): Promise<void>;
setOrientation(orientation: 'portrait' | 'landscape'): Promise<void>;
getCookies(): Promise<types.Cookie[]>;

@@ -69,0 +70,0 @@ getTitle(): Promise<string>;

import type * as types from '@applitools/types';
import type { Context } from './context';
import { type Logger } from '@applitools/logger';
import { type Context } from './context';
export declare type ElementState = {

@@ -24,3 +25,3 @@ contentSize?: types.Size;

index?: number;
logger?: any;
logger?: Logger;
root?: TElement;

@@ -27,0 +28,0 @@ });

import type * as types from '@applitools/types';
import { type Logger } from '@applitools/logger';
import type { Driver } from './driver';

@@ -8,3 +9,3 @@ import type { Element } from './element';

driver: Driver<TDriver, TContext, TElement, TSelector>;
logger: any;
logger: Logger;
}): Promise<HelperAndroid<TDriver, TContext, TElement, TSelector> | null>;

@@ -11,0 +12,0 @@ private readonly _spec;

import type * as types from '@applitools/types';
import { type Logger } from '@applitools/logger';
import type { Driver } from './driver';

@@ -8,3 +9,3 @@ import type { Element } from './element';

driver: Driver<TDriver, TContext, TElement, TSelector>;
logger: any;
logger: Logger;
}): Promise<HelperIOS<TDriver, TContext, TElement, TSelector> | null>;

@@ -19,5 +20,5 @@ private readonly _driver;

spec: types.SpecDriver<TDriver, TContext, TElement, TSelector>;
logger?: any;
logger?: Logger;
});
getContentSize(_element: Element<TDriver, TContext, TElement, TSelector>): Promise<types.Size>;
}
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