@applitools/driver
Advanced tools
Comparing version 1.5.2 to 1.5.3
@@ -6,2 +6,10 @@ # Change Log | ||
## 1.5.3 - 2022/3/12 | ||
- when handling shadowRoot, send the element containing the doc frage and the root itself to element constructor | ||
- change the sensible default value for touchPadding when running on Android to 20 (from 24) | ||
- add error logging in element.ts when unable to complete a getAttribute lookup | ||
- updated to @applitools/snippets@2.2.1 (from 2.2.0) | ||
- updated to @applitools/types@1.2.1 (from 1.2.0) | ||
## 1.5.2 - 2022/3/7 | ||
@@ -240,2 +248,2 @@ | ||
- Provide a framework-agnostic way to work with webdriver/cdp drivers | ||
- Provide a framework-agnostic way to work with webdriver/cdp drivers |
@@ -217,6 +217,7 @@ "use strict"; | ||
let root = null; | ||
let element = null; | ||
let currentSelector = elementSelector; | ||
while (specUtils.isCommonSelector(this._spec, currentSelector) && | ||
specUtils.isSelector(this._spec, currentSelector.shadow)) { | ||
const element = await this._spec.findElement(this.target, specUtils.transformSelector(this._spec, currentSelector, this.driver), root); | ||
element = await this._spec.findElement(this.target, specUtils.transformSelector(this._spec, currentSelector, this.driver), root); | ||
if (!element) | ||
@@ -231,3 +232,3 @@ return null; | ||
context, | ||
shadow: root ? new element_1.Element({ spec: this._spec, context, element: root, logger: this._logger }) : null, | ||
shadow: root ? new element_1.Element({ spec: this._spec, context, element, logger: this._logger, root }) : null, | ||
selector: currentSelector, | ||
@@ -234,0 +235,0 @@ }; |
@@ -49,5 +49,9 @@ "use strict"; | ||
if (this._spec.isElement(options.element)) { | ||
this._target = (_c = (_b = (_a = this._spec).transformElement) === null || _b === void 0 ? void 0 : _b.call(_a, options.element)) !== null && _c !== void 0 ? _c : options.element; | ||
let elementToUse = options.element; | ||
if (options.root) { | ||
elementToUse = options.root; | ||
} | ||
this._target = (_c = (_b = (_a = this._spec).transformElement) === null || _b === void 0 ? void 0 : _b.call(_a, elementToUse)) !== null && _c !== void 0 ? _c : elementToUse; | ||
// Some frameworks contains information about the selector inside an element | ||
this._selector = (_d = options.selector) !== null && _d !== void 0 ? _d : (_f = (_e = this._spec).extractSelector) === null || _f === void 0 ? void 0 : _f.call(_e, options.element); | ||
this._selector = (_d = options.selector) !== null && _d !== void 0 ? _d : (_f = (_e = this._spec).extractSelector) === null || _f === void 0 ? void 0 : _f.call(_e, elementToUse); | ||
this._index = options.index; | ||
@@ -155,3 +159,4 @@ } | ||
}) | ||
.catch(() => { | ||
.catch(err => { | ||
this._logger.log(`Unable to get the attribute 'contentSize' when looking up touchPadding due to the following error:`, `'${err.message}'`); | ||
return this._spec.getElementRegion(this.driver.target, this.target); | ||
@@ -167,2 +172,3 @@ }), { touchPadding } = _d, contentRegion = __rest(_d, ["touchPadding"]); | ||
this._touchPadding = touchPadding !== null && touchPadding !== void 0 ? touchPadding : this._touchPadding; | ||
this._logger.log('touchPadding', this._touchPadding); | ||
if (this.driver.isAndroid) { | ||
@@ -234,4 +240,7 @@ this._state.contentSize = utils.geometry.scale(this._state.contentSize, 1 / this.driver.pixelRatio); | ||
.then(JSON.parse) | ||
.catch(() => null); | ||
this._touchPadding = (_a = data === null || data === void 0 ? void 0 : data.touchPadding) !== null && _a !== void 0 ? _a : 24; | ||
.catch(err => { | ||
this._logger.log(`Unable to get the attribute 'contentSize' when looking up touchPadding due to the following error:`, `'${err.message}'`); | ||
}); | ||
this._touchPadding = (_a = data === null || data === void 0 ? void 0 : data.touchPadding) !== null && _a !== void 0 ? _a : 20; | ||
this._logger.log('touchPadding', this._touchPadding); | ||
} | ||
@@ -238,0 +247,0 @@ } |
{ | ||
"name": "@applitools/driver", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "Applitools universal framework wrapper", | ||
@@ -76,4 +76,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@applitools/snippets": "2.2.0", | ||
"@applitools/types": "1.2.0", | ||
"@applitools/snippets": "2.2.1", | ||
"@applitools/types": "1.2.1", | ||
"@applitools/utils": "1.2.13" | ||
@@ -80,0 +80,0 @@ }, |
@@ -25,2 +25,3 @@ import type * as types from '@applitools/types'; | ||
logger?: any; | ||
root?: TElement; | ||
}); | ||
@@ -27,0 +28,0 @@ get target(): TElement; |
import type * as types from '@applitools/types'; | ||
export declare function isCommonSelector<TSelector>(spec: Pick<types.SpecDriver<unknown, unknown, unknown, TSelector>, 'isSelector'>, selector: any): selector is types.CommonSelector<TSelector>; | ||
declare type CommonSelector<TSelector = never> = { | ||
selector: TSelector | string; | ||
type?: string; | ||
shadow?: CommonSelector<TSelector> | TSelector | string; | ||
frame?: CommonSelector<TSelector> | TSelector | string; | ||
}; | ||
export declare function isCommonSelector<TSelector>(spec: Pick<types.SpecDriver<unknown, unknown, unknown, TSelector>, 'isSelector'>, selector: any): selector is CommonSelector<TSelector>; | ||
export declare function isSelector<TSelector>(spec: Pick<types.SpecDriver<unknown, unknown, unknown, TSelector>, 'isSelector'>, selector: any): selector is types.Selector<TSelector>; | ||
@@ -14,1 +20,2 @@ export declare function transformSelector<TSelector>(spec: Pick<types.SpecDriver<unknown, unknown, unknown, TSelector>, 'isSelector' | 'transformSelector'>, selector: types.Selector<TSelector>, environment?: { | ||
}; | ||
export {}; |
194537
2914
+ Added@applitools/snippets@2.2.1(transitive)
+ Added@applitools/types@1.2.1(transitive)
- Removed@applitools/snippets@2.2.0(transitive)
- Removed@applitools/types@1.2.0(transitive)
Updated@applitools/snippets@2.2.1
Updated@applitools/types@1.2.1