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

@applitools/driver

Package Overview
Dependencies
Maintainers
51
Versions
216
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.16.0 to 1.16.1

9

CHANGELOG.md
# Changelog
## [1.16.1](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.16.0...js/driver@1.16.1) (2023-12-19)
### Bug Fixes
* fixed bug with screenshot not being properly scaled on ios devices with appium 2 ([#2092](https://github.com/applitools/eyes.sdk.javascript1/issues/2092)) ([26678bf](https://github.com/applitools/eyes.sdk.javascript1/commit/26678bfe254def506ea82e6a645519d6567fb3fd))
* fixed extraction of the driver server url ([ddc6449](https://github.com/applitools/eyes.sdk.javascript1/commit/ddc6449fc72166ab26c99e9ba7bb83c05fd591d6))
* fixed infinite loop that may appear during attribute extraction ([#2102](https://github.com/applitools/eyes.sdk.javascript1/issues/2102)) ([6bef680](https://github.com/applitools/eyes.sdk.javascript1/commit/6bef680fbd2d5c26a46cf2a4f00bd083d1d02109))
## [1.16.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.15.3...js/driver@1.16.0) (2023-12-18)

@@ -4,0 +13,0 @@

49

dist/driver.js

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

async getViewport() {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
var _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
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;
var _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
if (!this._viewport) {

@@ -304,7 +304,6 @@ const environment = await this.getEnvironment();

this._viewport = { ...capabilitiesViewport, ...this._viewport };
(_a = (_y = this._viewport).pixelRatio) !== null && _a !== void 0 ? _a : (_y.pixelRatio = 1);
// this value always excludes the height of the navigation bar, and sometimes it also excludes the height of the status bar
let windowSize = await this._spec.getWindowSize(this.target);
(_b = (_z = this._viewport).displaySize) !== null && _b !== void 0 ? _b : (_z.displaySize = windowSize);
if (((_c = this._viewport.orientation) === null || _c === void 0 ? void 0 : _c.startsWith('landscape')) &&
(_a = (_1 = this._viewport).displaySize) !== null && _a !== void 0 ? _a : (_1.displaySize = windowSize);
if (((_b = this._viewport.orientation) === null || _b === void 0 ? void 0 : _b.startsWith('landscape')) &&
this._viewport.displaySize.height > this._viewport.displaySize.width) {

@@ -314,3 +313,3 @@ this._viewport.displaySize = utils.geometry.rotate(this._viewport.displaySize, 90);

if (environment.isAndroid) {
// bar sizes could be extracted only on android
(_c = (_2 = this._viewport).pixelRatio) !== null && _c !== void 0 ? _c : (_2.pixelRatio = 1);
const { statusBar, navigationBar } = (_f = (await ((_e = (_d = this._spec).getSystemBars) === null || _e === void 0 ? void 0 : _e.call(_d, this.target).catch(() => undefined)))) !== null && _f !== void 0 ? _f : {};

@@ -342,16 +341,22 @@ if (statusBar === null || statusBar === void 0 ? void 0 : statusBar.visible) {

// bar sizes have to be scaled on android
(_0 = this._viewport).statusBarSize && (_0.statusBarSize = this._viewport.statusBarSize / this._viewport.pixelRatio);
(_1 = this._viewport).navigationBarSize && (_1.navigationBarSize = this._viewport.navigationBarSize / this._viewport.pixelRatio);
(_3 = this._viewport).statusBarSize && (_3.statusBarSize = this._viewport.statusBarSize / this._viewport.pixelRatio);
(_4 = this._viewport).navigationBarSize && (_4.navigationBarSize = this._viewport.navigationBarSize / this._viewport.pixelRatio);
windowSize = utils.geometry.scale(windowSize, 1 / this._viewport.pixelRatio);
(_2 = this._viewport).displaySize && (_2.displaySize = utils.geometry.scale(this._viewport.displaySize, 1 / this._viewport.pixelRatio));
(_l = (_3 = this._viewport).navigationBarSize) !== null && _l !== void 0 ? _l : (_3.navigationBarSize = 0);
(_5 = this._viewport).displaySize && (_5.displaySize = utils.geometry.scale(this._viewport.displaySize, 1 / this._viewport.pixelRatio));
(_l = (_6 = this._viewport).navigationBarSize) !== null && _l !== void 0 ? _l : (_6.navigationBarSize = 0);
}
else if (environment.isIOS) {
if ((_m = this._viewport.orientation) === null || _m === void 0 ? void 0 : _m.startsWith('landscape'))
if (!this._viewport.pixelRatio || !this._viewport.statusBarSize) {
const screen = await this.execute('mobile:deviceScreenInfo');
this._viewport.pixelRatio = (_m = screen.scale) !== null && _m !== void 0 ? _m : 0;
this._viewport.statusBarSize = (_o = screen.statusBarSize) === null || _o === void 0 ? void 0 : _o.height;
}
if ((_p = this._viewport.orientation) === null || _p === void 0 ? void 0 : _p.startsWith('landscape'))
this._viewport.statusBarSize = 0;
}
(_o = (_4 = this._viewport).statusBarSize) !== null && _o !== void 0 ? _o : (_4.statusBarSize = 0);
(_q = (_7 = this._viewport).pixelRatio) !== null && _q !== void 0 ? _q : (_7.pixelRatio = 1);
(_r = (_8 = this._viewport).statusBarSize) !== null && _r !== void 0 ? _r : (_8.statusBarSize = 0);
// calculate viewport location
(_p = (_5 = this._viewport).viewportLocation) !== null && _p !== void 0 ? _p : (_5.viewportLocation = {
x: this._viewport.orientation === 'landscape' ? (_q = this._viewport.navigationBarSize) !== null && _q !== void 0 ? _q : 0 : 0,
(_s = (_9 = this._viewport).viewportLocation) !== null && _s !== void 0 ? _s : (_9.viewportLocation = {
x: this._viewport.orientation === 'landscape' ? (_t = this._viewport.navigationBarSize) !== null && _t !== void 0 ? _t : 0 : 0,
y: this._viewport.statusBarSize,

@@ -364,3 +369,3 @@ });

if (environment.isAndroid) {
this._viewport.viewportSize[((_r = this._viewport.orientation) === null || _r === void 0 ? void 0 : _r.startsWith('landscape')) ? 'width' : 'height'] -=
this._viewport.viewportSize[((_u = this._viewport.orientation) === null || _u === void 0 ? void 0 : _u.startsWith('landscape')) ? 'width' : 'height'] -=
this._viewport.navigationBarSize;

@@ -395,9 +400,9 @@ }

const browserViewport = await this.execute(snippets.getViewport);
(_s = (_6 = this._viewport).viewportSize) !== null && _s !== void 0 ? _s : (_6.viewportSize = browserViewport.viewportSize);
(_t = (_7 = this._viewport).pixelRatio) !== null && _t !== void 0 ? _t : (_7.pixelRatio = browserViewport.pixelRatio);
(_u = (_8 = this._viewport).viewportScale) !== null && _u !== void 0 ? _u : (_8.viewportScale = browserViewport.viewportScale);
(_v = (_9 = this._viewport).orientation) !== null && _v !== void 0 ? _v : (_9.orientation = browserViewport.orientation);
(_v = (_10 = this._viewport).viewportSize) !== null && _v !== void 0 ? _v : (_10.viewportSize = browserViewport.viewportSize);
(_w = (_11 = this._viewport).pixelRatio) !== null && _w !== void 0 ? _w : (_11.pixelRatio = browserViewport.pixelRatio);
(_x = (_12 = this._viewport).viewportScale) !== null && _x !== void 0 ? _x : (_12.viewportScale = browserViewport.viewportScale);
(_y = (_13 = this._viewport).orientation) !== null && _y !== void 0 ? _y : (_13.orientation = browserViewport.orientation);
}
(_w = (_10 = this._viewport).pixelRatio) !== null && _w !== void 0 ? _w : (_10.pixelRatio = 1);
(_x = (_11 = this._viewport).viewportScale) !== null && _x !== void 0 ? _x : (_11.viewportScale = 1);
(_z = (_14 = this._viewport).pixelRatio) !== null && _z !== void 0 ? _z : (_14.pixelRatio = 1);
(_0 = (_15 = this._viewport).viewportScale) !== null && _0 !== void 0 ? _0 : (_15.viewportScale = 1);
this._logger.log('Extracted viewport', this._viewport);

@@ -427,3 +432,3 @@ }

const driverInfo = await this.getDriverInfo();
return (_a = driverInfo.remoteHostname) !== null && _a !== void 0 ? _a : null;
return (_a = driverInfo.driverServerUrl) !== null && _a !== void 0 ? _a : null;
}

@@ -430,0 +435,0 @@ async getHelper() {

@@ -192,10 +192,10 @@ "use strict";

try {
const size = JSON.parse(await this.getAttribute('contentSize'));
const { left, top, width, height, scrollableOffset } = JSON.parse(await this.getAttribute('contentSize'));
if ([left, top, width, height, scrollableOffset].some(value => !utils.types.isNumber(value)))
throw new Error('Invalid contentSize');
attrContentRegion = {
x: size.left,
y: size.top,
width: size.width,
height: environment.isIOS
? Math.max(size.height, size.scrollableOffset)
: size.height + size.scrollableOffset,
x: left,
y: top,
width: width,
height: environment.isIOS ? Math.max(height, scrollableOffset) : height + scrollableOffset,
};

@@ -372,5 +372,4 @@ }

async getAttribute(name) {
var _a;
// we assumes that attributes are not changed during the session
if ((_a = this._state.attributes) === null || _a === void 0 ? void 0 : _a[name]) {
if (utils.types.has(this._state.attributes, name)) {
if (this._state.attributes[name] instanceof Error)

@@ -377,0 +376,0 @@ throw this._state.attributes[name];

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.getCurrentWorld = exports.visit = exports.getTitle = exports.getUrl = exports.getOrientation = exports.setWindowSize = exports.getWindowSize = exports.getDriverInfo = exports.takeScreenshot = exports.childContext = exports.parentContext = exports.mainContext = exports.getElementText = exports.findElements = exports.findElement = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.extractSelector = exports.toSimpleCommonSelector = exports.toSelector = exports.isSelector = exports.isElement = exports.isDriver = void 0;
exports.performAction = exports.getElementAttribute = exports.getElementRegion = exports.getCurrentWorld = exports.visit = exports.getTitle = exports.getUrl = exports.getOrientation = exports.setWindowSize = exports.getWindowSize = exports.getDriverInfo = exports.takeScreenshot = exports.childContext = exports.parentContext = exports.mainContext = exports.getElementText = exports.findElements = exports.findElement = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.extractSelector = exports.toSimpleCommonSelector = exports.toSelector = exports.isSelector = exports.isElement = exports.isDriver = void 0;
const utils = __importStar(require("@applitools/utils"));

@@ -145,1 +145,13 @@ function isDriver(driver) {

exports.getCurrentWorld = getCurrentWorld;
async function getElementRegion(_driver, element) {
return element.region;
}
exports.getElementRegion = getElementRegion;
async function getElementAttribute(_driver, element, attr) {
return element.attrs[attr];
}
exports.getElementAttribute = getElementAttribute;
async function performAction(_driver, _steps) {
return;
}
exports.performAction = performAction;

@@ -21,3 +21,8 @@ "use strict";

var _a, _b;
await this._element.click();
const { x, y } = await this._spec.getElementRegion(this._driver.target, this._element.target);
await this._spec.performAction(this._driver.target, [
{ action: 'press', x, y },
{ action: 'wait', ms: 300 },
{ action: 'release' },
]);
const sizeLabel = await this._driver.element({ type: 'name', selector: 'applitools_content_size_label' });

@@ -24,0 +29,0 @@ const sizeString = await (sizeLabel === null || sizeLabel === void 0 ? void 0 : sizeLabel.getText());

{
"name": "@applitools/driver",
"version": "1.16.0",
"version": "1.16.1",
"description": "Applitools universal framework wrapper",

@@ -5,0 +5,0 @@ "keywords": [

@@ -1,2 +0,2 @@

import type { Size } from '@applitools/utils';
import type { Region, Size } from '@applitools/utils';
import type { DriverInfo } from '../types';

@@ -39,2 +39,5 @@ export type Driver = any;

export declare function getCurrentWorld(driver: Driver): Promise<any>;
export declare function getElementRegion(_driver: Driver, element: Element): Promise<Region>;
export declare function getElementAttribute(_driver: Driver, element: Element, attr: string): Promise<string>;
export declare function performAction(_driver: Driver, _steps: any[]): Promise<void>;
export {};

@@ -71,3 +71,3 @@ import type { Location, Size, Region } from '@applitools/utils';

sessionId?: string;
remoteHostname?: string;
driverServerUrl?: string;
userAgent?: UserAgent | null;

@@ -74,0 +74,0 @@ capabilities?: Capabilities | null;

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