@applitools/driver 1.9.17 → 1.9.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/element.js +10 -4
- package/dist/helper-android.js +1 -1
- package/dist/spec-utils.js +7 -1
- package/package.json +3 -3
- package/types/spec-utils.d.ts +1 -0
package/dist/element.js
CHANGED
|
@@ -50,7 +50,10 @@ class Element {
|
|
|
50
50
|
else {
|
|
51
51
|
throw new TypeError('Element constructor called with argument of unknown type!');
|
|
52
52
|
}
|
|
53
|
-
if (this._selector
|
|
53
|
+
if (specUtils.isSimpleCommonSelector(this._selector)) {
|
|
54
|
+
this._commonSelector = this._selector;
|
|
55
|
+
}
|
|
56
|
+
else if (this._selector && this._spec.untransformSelector) {
|
|
54
57
|
this._commonSelector = this._spec.untransformSelector(this._spec.transformSelector(this._selector));
|
|
55
58
|
}
|
|
56
59
|
}
|
|
@@ -297,6 +300,7 @@ class Element {
|
|
|
297
300
|
}
|
|
298
301
|
async getTouchPadding() {
|
|
299
302
|
var _a, _b;
|
|
303
|
+
var _c;
|
|
300
304
|
if (this._state.touchPadding == null) {
|
|
301
305
|
if (this.driver.isWeb)
|
|
302
306
|
this._state.touchPadding = 0;
|
|
@@ -304,16 +308,18 @@ class Element {
|
|
|
304
308
|
this._state.touchPadding = 10;
|
|
305
309
|
else if (this.driver.isAndroid) {
|
|
306
310
|
if (((_a = this.driver.helper) === null || _a === void 0 ? void 0 : _a.name) === 'android') {
|
|
307
|
-
this._state.touchPadding =
|
|
311
|
+
this._state.touchPadding = await this.driver.helper.getTouchPadding();
|
|
312
|
+
this._logger.log('Touch padding extracted using helper library', this._state.touchPadding);
|
|
308
313
|
}
|
|
309
314
|
else {
|
|
310
|
-
|
|
315
|
+
this._state.touchPadding = await this.getAttribute('contentSize')
|
|
311
316
|
.then(data => JSON.parse(data).touchPadding)
|
|
312
317
|
.catch(err => {
|
|
313
318
|
this._logger.warn(`Unable to get the attribute 'contentSize' when looking up 'touchPadding' due to the following error: '${err.message}'`);
|
|
314
319
|
});
|
|
315
|
-
this.
|
|
320
|
+
this._logger.log('Touch padding extracted using attribute', this._state.touchPadding);
|
|
316
321
|
}
|
|
322
|
+
(_b = (_c = this._state).touchPadding) !== null && _b !== void 0 ? _b : (_c.touchPadding = 20);
|
|
317
323
|
this._logger.log('Touch padding set:', this._state.touchPadding);
|
|
318
324
|
}
|
|
319
325
|
}
|
package/dist/helper-android.js
CHANGED
|
@@ -111,7 +111,7 @@ class HelperAndroid {
|
|
|
111
111
|
const touchPaddingString = await this._input.getText();
|
|
112
112
|
await this._input.type('');
|
|
113
113
|
const touchPadding = Number(touchPaddingString);
|
|
114
|
-
if (Number.isNaN(touchPadding))
|
|
114
|
+
if (!touchPadding || Number.isNaN(touchPadding))
|
|
115
115
|
return null;
|
|
116
116
|
return touchPadding;
|
|
117
117
|
}
|
package/dist/spec-utils.js
CHANGED
|
@@ -23,8 +23,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.withFastCache = exports.splitSelector = exports.transformSelector = exports.isSelector = exports.isCommonSelector = void 0;
|
|
26
|
+
exports.withFastCache = exports.splitSelector = exports.transformSelector = exports.isSelector = exports.isCommonSelector = exports.isSimpleCommonSelector = void 0;
|
|
27
27
|
const utils = __importStar(require("@applitools/utils"));
|
|
28
|
+
function isSimpleCommonSelector(selector) {
|
|
29
|
+
return (utils.types.isPlainObject(selector) &&
|
|
30
|
+
utils.types.has(selector, 'selector') &&
|
|
31
|
+
utils.types.isString(selector.selector));
|
|
32
|
+
}
|
|
33
|
+
exports.isSimpleCommonSelector = isSimpleCommonSelector;
|
|
28
34
|
function isCommonSelector(spec, selector) {
|
|
29
35
|
return (utils.types.isPlainObject(selector) &&
|
|
30
36
|
utils.types.has(selector, 'selector') &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.18",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@applitools/logger": "1.1.15",
|
|
82
|
-
"@applitools/snippets": "2.4.
|
|
83
|
-
"@applitools/types": "1.5.
|
|
82
|
+
"@applitools/snippets": "2.4.5",
|
|
83
|
+
"@applitools/types": "1.5.7",
|
|
84
84
|
"@applitools/utils": "1.3.10"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
package/types/spec-utils.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ declare type CommonSelector<TSelector = never> = {
|
|
|
5
5
|
shadow?: CommonSelector<TSelector> | TSelector | string;
|
|
6
6
|
frame?: CommonSelector<TSelector> | TSelector | string;
|
|
7
7
|
};
|
|
8
|
+
export declare function isSimpleCommonSelector(selector: any): selector is CommonSelector;
|
|
8
9
|
export declare function isCommonSelector<TSelector>(spec: Pick<types.SpecDriver<unknown, unknown, unknown, TSelector>, 'isSelector'>, selector: any): selector is CommonSelector<TSelector>;
|
|
9
10
|
export declare function isSelector<TSelector>(spec: Pick<types.SpecDriver<unknown, unknown, unknown, TSelector>, 'isSelector'>, selector: any): selector is types.Selector<TSelector>;
|
|
10
11
|
export declare function transformSelector<TSelector>(spec: Pick<types.SpecDriver<unknown, unknown, unknown, TSelector>, 'isSelector' | 'transformSelector'>, selector: types.Selector<TSelector>, environment?: {
|