@applitools/driver 1.9.14 → 1.9.17
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/driver.js +35 -30
- package/dist/element.js +56 -45
- package/dist/fake/spec-driver.js +1 -2
- package/dist/helper-android.js +4 -28
- package/dist/helper-ios.js +11 -10
- package/package.json +2 -1
- package/types/helper-android.d.ts +1 -1
- package/types/helper-ios.d.ts +1 -1
package/dist/driver.js
CHANGED
|
@@ -144,8 +144,8 @@ class Driver {
|
|
|
144
144
|
this._currentContext = context;
|
|
145
145
|
}
|
|
146
146
|
async init() {
|
|
147
|
-
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;
|
|
148
|
-
var
|
|
147
|
+
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;
|
|
148
|
+
var _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
|
|
149
149
|
const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
|
|
150
150
|
this._logger.log('Driver capabilities', capabilities);
|
|
151
151
|
const capabilitiesInfo = capabilities ? (0, capabilities_1.parseCapabilities)(capabilities, this._customConfig) : undefined;
|
|
@@ -156,39 +156,46 @@ class Driver {
|
|
|
156
156
|
(_e = (await this.getOrientation().catch(() => undefined))) !== null && _e !== void 0 ? _e : this._driverInfo.orientation;
|
|
157
157
|
}
|
|
158
158
|
if (this.isWeb) {
|
|
159
|
-
(_f = (
|
|
160
|
-
(_g = (
|
|
161
|
-
(_h = (
|
|
159
|
+
(_f = (_3 = this._driverInfo).pixelRatio) !== null && _f !== void 0 ? _f : (_3.pixelRatio = await this.execute(snippets.getPixelRatio));
|
|
160
|
+
(_g = (_4 = this._driverInfo).viewportScale) !== null && _g !== void 0 ? _g : (_4.viewportScale = await this.execute(snippets.getViewportScale));
|
|
161
|
+
(_h = (_5 = this._driverInfo).userAgent) !== null && _h !== void 0 ? _h : (_5.userAgent = await this.execute(snippets.getUserAgent));
|
|
162
162
|
if (this._driverInfo.userAgent) {
|
|
163
163
|
const userAgentInfo = (0, user_agent_1.parseUserAgent)(this._driverInfo.userAgent);
|
|
164
164
|
this._driverInfo.browserName = (_j = userAgentInfo.browserName) !== null && _j !== void 0 ? _j : this._driverInfo.browserName;
|
|
165
165
|
this._driverInfo.browserVersion = (_k = userAgentInfo.browserVersion) !== null && _k !== void 0 ? _k : this._driverInfo.browserVersion;
|
|
166
166
|
if (this._driverInfo.isMobile) {
|
|
167
|
-
(_l = (
|
|
168
|
-
(_m = (
|
|
167
|
+
(_l = (_6 = this._driverInfo).platformName) !== null && _l !== void 0 ? _l : (_6.platformName = userAgentInfo.platformName);
|
|
168
|
+
(_m = (_7 = this._driverInfo).platformVersion) !== null && _m !== void 0 ? _m : (_7.platformVersion = userAgentInfo.platformVersion);
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
171
171
|
this._driverInfo.platformName = (_o = userAgentInfo.platformName) !== null && _o !== void 0 ? _o : this._driverInfo.platformName;
|
|
172
172
|
this._driverInfo.platformVersion = (_p = userAgentInfo.platformVersion) !== null && _p !== void 0 ? _p : this._driverInfo.platformVersion;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
(_q = (
|
|
176
|
-
(_r = (
|
|
175
|
+
(_q = (_8 = this._driverInfo).features) !== null && _q !== void 0 ? _q : (_8.features = {});
|
|
176
|
+
(_r = (_9 = this._driverInfo.features).allCookies) !== null && _r !== void 0 ? _r : (_9.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
|
|
177
177
|
}
|
|
178
178
|
else {
|
|
179
179
|
// this value always excludes the height of the navigation bar, and sometimes it also excludes the height of the status bar
|
|
180
180
|
let windowSize = await this._spec.getWindowSize(this.target);
|
|
181
|
-
(_s = (
|
|
181
|
+
(_s = (_10 = this._driverInfo).displaySize) !== null && _s !== void 0 ? _s : (_10.displaySize = windowSize);
|
|
182
|
+
if (((_t = this.orientation) === null || _t === void 0 ? void 0 : _t.startsWith('landscape')) &&
|
|
183
|
+
this._driverInfo.displaySize.height > this._driverInfo.displaySize.width) {
|
|
184
|
+
this._driverInfo.displaySize = {
|
|
185
|
+
width: this._driverInfo.displaySize.height,
|
|
186
|
+
height: this._driverInfo.displaySize.width,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
182
189
|
if (this.isAndroid) {
|
|
183
190
|
// bar sizes could be extracted only on android
|
|
184
|
-
const systemBars = await ((
|
|
191
|
+
const systemBars = await ((_v = (_u = this._spec).getSystemBars) === null || _v === void 0 ? void 0 : _v.call(_u, this.target).catch(() => null));
|
|
185
192
|
const { statusBar, navigationBar } = systemBars !== null && systemBars !== void 0 ? systemBars : {};
|
|
186
193
|
if (statusBar === null || statusBar === void 0 ? void 0 : statusBar.visible) {
|
|
187
194
|
this._logger.log('Driver status bar', statusBar);
|
|
188
195
|
const statusBarSize = statusBar.height;
|
|
189
196
|
// when status bar is overlapping content on android it returns status bar height equal to display height
|
|
190
197
|
if (statusBarSize < this._driverInfo.displaySize.height) {
|
|
191
|
-
this._driverInfo.statusBarSize = Math.max((
|
|
198
|
+
this._driverInfo.statusBarSize = Math.max((_w = this._driverInfo.statusBarSize) !== null && _w !== void 0 ? _w : 0, statusBarSize);
|
|
192
199
|
}
|
|
193
200
|
}
|
|
194
201
|
if (navigationBar === null || navigationBar === void 0 ? void 0 : navigationBar.visible) {
|
|
@@ -197,40 +204,38 @@ class Driver {
|
|
|
197
204
|
if (navigationBar.x > 0)
|
|
198
205
|
this._driverInfo.orientation = 'landscape-secondary';
|
|
199
206
|
// navigation bar size could be its height or width depending on screen orientation
|
|
200
|
-
const navigationBarSize = navigationBar[((
|
|
207
|
+
const navigationBarSize = navigationBar[((_x = this.orientation) === null || _x === void 0 ? void 0 : _x.startsWith('landscape')) ? 'width' : 'height'];
|
|
201
208
|
// when navigation bar is invisible on android it returns navigation bar size equal to display size
|
|
202
209
|
if (navigationBarSize <
|
|
203
|
-
this._driverInfo.displaySize[((
|
|
204
|
-
this._driverInfo.navigationBarSize = Math.max((
|
|
210
|
+
this._driverInfo.displaySize[((_y = this.orientation) === null || _y === void 0 ? void 0 : _y.startsWith('landscape')) ? 'width' : 'height']) {
|
|
211
|
+
this._driverInfo.navigationBarSize = Math.max((_z = this._driverInfo.navigationBarSize) !== null && _z !== void 0 ? _z : 0, navigationBarSize);
|
|
205
212
|
}
|
|
206
213
|
else {
|
|
207
214
|
this._driverInfo.navigationBarSize = 0;
|
|
208
215
|
}
|
|
209
216
|
}
|
|
210
217
|
// bar sizes have to be scaled on android
|
|
211
|
-
(
|
|
212
|
-
(
|
|
218
|
+
(_11 = this._driverInfo).statusBarSize && (_11.statusBarSize = this._driverInfo.statusBarSize / this.pixelRatio);
|
|
219
|
+
(_12 = this._driverInfo).navigationBarSize && (_12.navigationBarSize = this._driverInfo.navigationBarSize / this.pixelRatio);
|
|
213
220
|
windowSize = utils.geometry.scale(windowSize, 1 / this.pixelRatio);
|
|
214
|
-
(
|
|
221
|
+
(_13 = this._driverInfo).displaySize && (_13.displaySize = utils.geometry.scale(this._driverInfo.displaySize, 1 / this.pixelRatio));
|
|
222
|
+
}
|
|
223
|
+
if (this.isIOS) {
|
|
224
|
+
if ((_0 = this.orientation) === null || _0 === void 0 ? void 0 : _0.startsWith('landscape'))
|
|
225
|
+
this._driverInfo.statusBarSize = 0;
|
|
215
226
|
}
|
|
216
227
|
// calculate viewport location
|
|
217
|
-
(
|
|
228
|
+
(_1 = (_14 = this._driverInfo).viewportLocation) !== null && _1 !== void 0 ? _1 : (_14.viewportLocation = {
|
|
218
229
|
x: this.orientation === 'landscape' ? this.navigationBarSize : 0,
|
|
219
230
|
y: this.statusBarSize,
|
|
220
231
|
});
|
|
221
232
|
// calculate viewport size
|
|
222
233
|
if (!this._driverInfo.viewportSize) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
this._driverInfo.viewportSize = {
|
|
231
|
-
width: this._driverInfo.displaySize.width,
|
|
232
|
-
height: this._driverInfo.displaySize.height - this.statusBarSize - this.navigationBarSize,
|
|
233
|
-
};
|
|
234
|
+
this._driverInfo.viewportSize = { ...this._driverInfo.displaySize };
|
|
235
|
+
this._driverInfo.viewportSize.height -= this.statusBarSize;
|
|
236
|
+
if (this.isAndroid) {
|
|
237
|
+
this._driverInfo.viewportSize[((_2 = this.orientation) === null || _2 === void 0 ? void 0 : _2.startsWith('landscape')) ? 'width' : 'height'] -=
|
|
238
|
+
this.navigationBarSize;
|
|
234
239
|
}
|
|
235
240
|
}
|
|
236
241
|
// calculate safe area
|
package/dist/element.js
CHANGED
|
@@ -105,28 +105,33 @@ class Element {
|
|
|
105
105
|
if (await this.equals(innerElement))
|
|
106
106
|
return false;
|
|
107
107
|
// if the inner element region is contained in this element region, then it then could be assumed that the inner element is contained in this element
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
:
|
|
108
|
+
let contentRegion = await ((_b = this.driver.helper) === null || _b === void 0 ? void 0 : _b.getContentRegion(this));
|
|
109
|
+
if (!contentRegion || !this.driver.isAndroid) {
|
|
110
|
+
const nativeContentRegion = await this.getAttribute('contentSize')
|
|
111
|
+
.then(data => {
|
|
112
|
+
const contentSize = JSON.parse(data);
|
|
113
|
+
return {
|
|
114
|
+
x: contentSize.left,
|
|
115
|
+
y: contentSize.top,
|
|
116
|
+
width: contentSize.width,
|
|
117
|
+
height: this.driver.isIOS
|
|
118
|
+
? Math.max(contentSize.height, contentSize.scrollableOffset)
|
|
119
|
+
: contentSize.height + contentSize.scrollableOffset,
|
|
120
|
+
};
|
|
121
|
+
})
|
|
122
|
+
.catch(err => {
|
|
123
|
+
this._logger.warn(`Unable to get the attribute 'contentSize' due to the following error: '${err.message}'`);
|
|
124
|
+
return this._spec.getElementRegion(this.driver.target, this.target);
|
|
125
|
+
});
|
|
126
|
+
contentRegion = {
|
|
127
|
+
x: nativeContentRegion.x,
|
|
128
|
+
y: nativeContentRegion.y,
|
|
129
|
+
width: Math.max((_c = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.width) !== null && _c !== void 0 ? _c : 0, nativeContentRegion.width),
|
|
130
|
+
height: Math.max((_d = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.height) !== null && _d !== void 0 ? _d : 0, nativeContentRegion.height),
|
|
118
131
|
};
|
|
119
|
-
}
|
|
120
|
-
.catch(() => this._spec.getElementRegion(this.driver.target, this.target));
|
|
121
|
-
const contentSize = await ((_b = this.driver.helper) === null || _b === void 0 ? void 0 : _b.getContentSize(this));
|
|
122
|
-
const region = {
|
|
123
|
-
x: contentRegion.x,
|
|
124
|
-
y: contentRegion.y,
|
|
125
|
-
width: Math.max((_c = contentSize === null || contentSize === void 0 ? void 0 : contentSize.width) !== null && _c !== void 0 ? _c : 0, contentRegion.width),
|
|
126
|
-
height: Math.max((_d = contentSize === null || contentSize === void 0 ? void 0 : contentSize.height) !== null && _d !== void 0 ? _d : 0, contentRegion.height),
|
|
127
|
-
};
|
|
132
|
+
}
|
|
128
133
|
const innerRegion = await this._spec.getElementRegion(this.driver.target, innerElement);
|
|
129
|
-
const contains = utils.geometry.contains(
|
|
134
|
+
const contains = utils.geometry.contains(contentRegion, innerRegion);
|
|
130
135
|
(_e = (_f = this._state).containedElements) !== null && _e !== void 0 ? _e : (_f.containedElements = new Map());
|
|
131
136
|
this._state.containedElements.set(innerElement, contains);
|
|
132
137
|
return contains;
|
|
@@ -194,29 +199,35 @@ class Element {
|
|
|
194
199
|
else {
|
|
195
200
|
this._logger.log('Extracting content size of native element with selector', this.selector);
|
|
196
201
|
try {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
: contentSize.
|
|
202
|
+
let contentRegion = await ((_a = this.driver.helper) === null || _a === void 0 ? void 0 : _a.getContentRegion(this));
|
|
203
|
+
this._logger.log('Extracted native content region using helper library', contentRegion);
|
|
204
|
+
// on android extraction of this argument will perform non-deterministic touch action, so it is better to avoid it
|
|
205
|
+
if (!contentRegion || !this.driver.isAndroid) {
|
|
206
|
+
const attrContentRegion = await this.getAttribute('contentSize')
|
|
207
|
+
.then(data => {
|
|
208
|
+
const contentSize = JSON.parse(data);
|
|
209
|
+
return {
|
|
210
|
+
x: contentSize.left,
|
|
211
|
+
y: contentSize.top,
|
|
212
|
+
width: contentSize.width,
|
|
213
|
+
height: this.driver.isIOS
|
|
214
|
+
? Math.max(contentSize.height, contentSize.scrollableOffset)
|
|
215
|
+
: contentSize.height + contentSize.scrollableOffset,
|
|
216
|
+
};
|
|
217
|
+
})
|
|
218
|
+
.catch(err => {
|
|
219
|
+
this._logger.warn(`Unable to get the attribute 'contentSize' due to the following error: '${err.message}'`);
|
|
220
|
+
return this._spec.getElementRegion(this.driver.target, this.target);
|
|
221
|
+
});
|
|
222
|
+
this._logger.log('Extracted native content region using attribute', attrContentRegion);
|
|
223
|
+
contentRegion = {
|
|
224
|
+
x: attrContentRegion.x,
|
|
225
|
+
y: attrContentRegion.y,
|
|
226
|
+
width: Math.max((_b = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.width) !== null && _b !== void 0 ? _b : 0, attrContentRegion.width),
|
|
227
|
+
height: Math.max((_c = contentRegion === null || contentRegion === void 0 ? void 0 : contentRegion.height) !== null && _c !== void 0 ? _c : 0, attrContentRegion.height),
|
|
207
228
|
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
this._logger.warn(`Unable to get the attribute 'contentSize' due to the following error: '${err.message}'`);
|
|
211
|
-
return this._spec.getElementRegion(this.driver.target, this.target);
|
|
212
|
-
});
|
|
213
|
-
this._logger.log('Extracted native content size attribute', contentRegion);
|
|
214
|
-
const contentSize = await ((_a = this.driver.helper) === null || _a === void 0 ? void 0 : _a.getContentSize(this));
|
|
215
|
-
this._logger.log('Extracted native content size with helper library', contentSize);
|
|
216
|
-
this._state.contentSize = {
|
|
217
|
-
width: Math.max((_b = contentSize === null || contentSize === void 0 ? void 0 : contentSize.width) !== null && _b !== void 0 ? _b : 0, contentRegion.width),
|
|
218
|
-
height: Math.max((_c = contentSize === null || contentSize === void 0 ? void 0 : contentSize.height) !== null && _c !== void 0 ? _c : 0, contentRegion.height),
|
|
219
|
-
};
|
|
229
|
+
}
|
|
230
|
+
this._state.contentSize = utils.geometry.size(contentRegion);
|
|
220
231
|
if (this.driver.isAndroid) {
|
|
221
232
|
this._state.contentSize = utils.geometry.scale(this._state.contentSize, 1 / this.driver.pixelRatio);
|
|
222
233
|
}
|
|
@@ -293,15 +304,15 @@ class Element {
|
|
|
293
304
|
this._state.touchPadding = 10;
|
|
294
305
|
else if (this.driver.isAndroid) {
|
|
295
306
|
if (((_a = this.driver.helper) === null || _a === void 0 ? void 0 : _a.name) === 'android') {
|
|
296
|
-
this._state.touchPadding = await ((_b = this.driver.helper) === null || _b === void 0 ? void 0 : _b.getTouchPadding());
|
|
307
|
+
this._state.touchPadding = (await ((_b = this.driver.helper) === null || _b === void 0 ? void 0 : _b.getTouchPadding())) || 20;
|
|
297
308
|
}
|
|
298
|
-
|
|
309
|
+
else {
|
|
299
310
|
const touchPadding = await this.getAttribute('contentSize')
|
|
300
311
|
.then(data => JSON.parse(data).touchPadding)
|
|
301
312
|
.catch(err => {
|
|
302
313
|
this._logger.warn(`Unable to get the attribute 'contentSize' when looking up 'touchPadding' due to the following error: '${err.message}'`);
|
|
303
314
|
});
|
|
304
|
-
this._state.touchPadding = touchPadding
|
|
315
|
+
this._state.touchPadding = touchPadding || 20;
|
|
305
316
|
}
|
|
306
317
|
this._logger.log('Touch padding set:', this._state.touchPadding);
|
|
307
318
|
}
|
package/dist/fake/spec-driver.js
CHANGED
|
@@ -100,8 +100,7 @@ async function getDriverInfo(driver) {
|
|
|
100
100
|
}
|
|
101
101
|
exports.getDriverInfo = getDriverInfo;
|
|
102
102
|
async function getWindowSize(driver) {
|
|
103
|
-
|
|
104
|
-
return rect;
|
|
103
|
+
return utils.geometry.size(await driver.getWindowRect());
|
|
105
104
|
}
|
|
106
105
|
exports.getWindowSize = getWindowSize;
|
|
107
106
|
async function setWindowSize(driver, size) {
|
package/dist/helper-android.js
CHANGED
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.HelperAndroid = void 0;
|
|
27
|
-
const utils = __importStar(require("@applitools/utils"));
|
|
28
4
|
class HelperAndroid {
|
|
29
5
|
constructor(options) {
|
|
30
6
|
this._spec = options.spec;
|
|
@@ -55,7 +31,7 @@ class HelperAndroid {
|
|
|
55
31
|
return null;
|
|
56
32
|
return resourceId.split('/')[1];
|
|
57
33
|
}
|
|
58
|
-
async
|
|
34
|
+
async getContentRegion(element) {
|
|
59
35
|
let contentHeightString;
|
|
60
36
|
if (this._legacy) {
|
|
61
37
|
await this._input.click();
|
|
@@ -75,9 +51,9 @@ class HelperAndroid {
|
|
|
75
51
|
}
|
|
76
52
|
const region = await this._spec.getElementRegion(this._input.driver.target, element.target);
|
|
77
53
|
const contentHeight = Number(contentHeightString);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
54
|
+
return !Number.isNaN(contentHeight) && contentHeight >= region.height
|
|
55
|
+
? { x: region.x, y: region.y, width: region.width, height: contentHeight }
|
|
56
|
+
: null;
|
|
81
57
|
}
|
|
82
58
|
async getRegion(element) {
|
|
83
59
|
if (this._legacy)
|
package/dist/helper-ios.js
CHANGED
|
@@ -14,8 +14,9 @@ class HelperIOS {
|
|
|
14
14
|
const element = await driver.element({ type: 'name', selector: 'applitools_grab_scrollable_data_button' });
|
|
15
15
|
return element ? new HelperIOS({ driver, element, spec, logger }) : null;
|
|
16
16
|
}
|
|
17
|
-
async
|
|
17
|
+
async getContentRegion(element) {
|
|
18
18
|
await this._element.click();
|
|
19
|
+
const region = await this._spec.getElementRegion(this._driver.target, element.target);
|
|
19
20
|
const sizeLabel = await this._driver.element({ type: 'name', selector: 'applitools_content_size_label' });
|
|
20
21
|
const sizeString = await (sizeLabel === null || sizeLabel === void 0 ? void 0 : sizeLabel.getText());
|
|
21
22
|
if (!sizeString)
|
|
@@ -26,15 +27,15 @@ class HelperIOS {
|
|
|
26
27
|
return null;
|
|
27
28
|
const paddingLabel = await this._driver.element({ type: 'name', selector: 'applitools_content_offset_label' });
|
|
28
29
|
const paddingString = await (paddingLabel === null || paddingLabel === void 0 ? void 0 : paddingLabel.getText());
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return contentSize;
|
|
30
|
+
if (paddingString) {
|
|
31
|
+
const [, x, y] = paddingString.match(/\{(-?\d+(?:\.\d+)?),\s?(-?\d+(?:\.\d+)?)\}/);
|
|
32
|
+
const contentOffset = { x: Number(x), y: Number(y) };
|
|
33
|
+
if (!Number.isNaN(contentOffset.x))
|
|
34
|
+
contentSize.width -= contentOffset.x;
|
|
35
|
+
if (!Number.isNaN(contentOffset.y))
|
|
36
|
+
contentSize.height -= contentOffset.y;
|
|
37
|
+
}
|
|
38
|
+
return contentSize.height >= region.height ? { x: region.x, y: region.y, ...contentSize } : null;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
exports.HelperIOS = HelperIOS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.17",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@applitools/bongo": "^2.1.6",
|
|
88
|
+
"@applitools/scripts": "^1.1.0",
|
|
88
89
|
"@types/mocha": "^9.1.1",
|
|
89
90
|
"@types/node": "^17.0.31",
|
|
90
91
|
"@typescript-eslint/eslint-plugin": "^5.22.0",
|
|
@@ -22,7 +22,7 @@ export declare class HelperAndroid<TDriver, TContext, TElement, TSelector> {
|
|
|
22
22
|
logger?: any;
|
|
23
23
|
});
|
|
24
24
|
_getElementId(element: Element<TDriver, TContext, TElement, TSelector>): Promise<string>;
|
|
25
|
-
|
|
25
|
+
getContentRegion(element: Element<TDriver, TContext, TElement, TSelector>): Promise<types.Region>;
|
|
26
26
|
getRegion(element: Element<TDriver, TContext, TElement, TSelector>): Promise<types.Region>;
|
|
27
27
|
scrollToTop(element: Element<TDriver, TContext, TElement, TSelector>): Promise<void>;
|
|
28
28
|
scrollBy(element: Element<TDriver, TContext, TElement, TSelector>, offset: types.Location): Promise<void>;
|
package/types/helper-ios.d.ts
CHANGED
|
@@ -19,5 +19,5 @@ export declare class HelperIOS<TDriver, TContext, TElement, TSelector> {
|
|
|
19
19
|
spec: types.SpecDriver<TDriver, TContext, TElement, TSelector>;
|
|
20
20
|
logger?: Logger;
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
getContentRegion(element: Element<TDriver, TContext, TElement, TSelector>): Promise<types.Region>;
|
|
23
23
|
}
|