@applitools/driver 1.8.0 → 1.8.3
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/capabilities.js +15 -8
- package/dist/context.js +7 -1
- package/dist/debug/index.js +5 -1
- package/dist/driver.js +48 -31
- package/dist/element.js +7 -3
- package/dist/fake/index.js +5 -1
- package/dist/fake/spec-driver.js +5 -1
- package/dist/index.js +5 -1
- package/dist/spec-utils.js +5 -1
- package/dist/user-agent.js +5 -1
- package/package.json +16 -15
- package/types/context.d.ts +3 -2
- package/types/driver.d.ts +4 -3
- package/types/element.d.ts +4 -3
- package/types/helper-android.d.ts +2 -1
- package/types/helper-ios.d.ts +3 -2
package/dist/capabilities.js
CHANGED
|
@@ -2,28 +2,35 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseCapabilities = void 0;
|
|
4
4
|
function parseCapabilities(capabilities, customConfig) {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6
6
|
if (capabilities.capabilities)
|
|
7
7
|
capabilities = capabilities.capabilities;
|
|
8
|
-
if (
|
|
9
|
-
|
|
8
|
+
if (!(customConfig === null || customConfig === void 0 ? void 0 : customConfig.keepPlatformNameAsIs)) {
|
|
9
|
+
// We use `startsWith` for just a theorerical reason. It's not based on any concrete case that we knew of at the time of writing this code.
|
|
10
|
+
if ((_a = capabilities.platformName) === null || _a === void 0 ? void 0 : _a.startsWith('android')) {
|
|
11
|
+
capabilities.platformName = capabilities.platformName.charAt(0).toUpperCase() + capabilities.platformName.slice(1);
|
|
12
|
+
}
|
|
13
|
+
// We use `startsWith` for just a theorerical reason. It's not based on any concrete case that we knew of at the time of writing this code.
|
|
14
|
+
if ((_b = capabilities.platformName) === null || _b === void 0 ? void 0 : _b.startsWith('ios')) {
|
|
15
|
+
capabilities.platformName = 'iOS' + capabilities.platformName.slice(3);
|
|
16
|
+
}
|
|
10
17
|
}
|
|
11
18
|
const info = {
|
|
12
19
|
browserName: !capabilities.app && !capabilities.bundleId
|
|
13
|
-
? ((
|
|
20
|
+
? ((_c = capabilities.browserName) !== null && _c !== void 0 ? _c : (_d = capabilities.desired) === null || _d === void 0 ? void 0 : _d.browserName) || undefined
|
|
14
21
|
: undefined,
|
|
15
|
-
browserVersion: ((
|
|
16
|
-
platformName: ((
|
|
22
|
+
browserVersion: ((_e = capabilities.browserVersion) !== null && _e !== void 0 ? _e : capabilities.version) || undefined,
|
|
23
|
+
platformName: ((_g = (_f = capabilities.platformName) !== null && _f !== void 0 ? _f : capabilities.platform) !== null && _g !== void 0 ? _g : (_h = capabilities.desired) === null || _h === void 0 ? void 0 : _h.platformName) || undefined,
|
|
17
24
|
platformVersion: capabilities.platformVersion || undefined,
|
|
18
25
|
isW3C: isW3C(capabilities),
|
|
19
26
|
isMobile: isMobile(capabilities),
|
|
20
27
|
};
|
|
21
28
|
if (info.isMobile) {
|
|
22
|
-
info.deviceName = ((
|
|
29
|
+
info.deviceName = ((_k = (_j = capabilities.desired) === null || _j === void 0 ? void 0 : _j.deviceName) !== null && _k !== void 0 ? _k : capabilities.deviceName) || undefined;
|
|
23
30
|
info.isNative = info.isMobile && !info.browserName;
|
|
24
31
|
info.isIOS = isIOS(capabilities);
|
|
25
32
|
info.isAndroid = isAndroid(capabilities);
|
|
26
|
-
info.orientation = (
|
|
33
|
+
info.orientation = (_m = ((_l = capabilities.deviceOrientation) !== null && _l !== void 0 ? _l : capabilities.orientation)) === null || _m === void 0 ? void 0 : _m.toLowerCase();
|
|
27
34
|
}
|
|
28
35
|
if (info.isNative) {
|
|
29
36
|
info.pixelRatio = capabilities.pixelRatio;
|
package/dist/context.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -241,6 +245,7 @@ class Context {
|
|
|
241
245
|
if (this.isRef) {
|
|
242
246
|
return new element_1.Element({ spec: this._spec, context: this, selector: elementOrSelector, logger: this._logger });
|
|
243
247
|
}
|
|
248
|
+
this._logger.log('Finding element by selector: ', elementOrSelector);
|
|
244
249
|
const root = await this.root(elementOrSelector);
|
|
245
250
|
if (!root)
|
|
246
251
|
return null;
|
|
@@ -263,6 +268,7 @@ class Context {
|
|
|
263
268
|
if (this.isRef) {
|
|
264
269
|
return [new element_1.Element({ spec: this._spec, context: this, selector: elementOrSelector, logger: this._logger })];
|
|
265
270
|
}
|
|
271
|
+
this._logger.log('Finding elements by selector: ', elementOrSelector);
|
|
266
272
|
const root = await this.root(elementOrSelector);
|
|
267
273
|
if (!root)
|
|
268
274
|
return [];
|
package/dist/debug/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/driver.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -20,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
24
|
};
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
26
|
exports.Driver = void 0;
|
|
27
|
+
const logger_1 = require("@applitools/logger");
|
|
23
28
|
const utils = __importStar(require("@applitools/utils"));
|
|
24
29
|
const specUtils = __importStar(require("./spec-utils"));
|
|
25
30
|
const context_1 = require("./context");
|
|
@@ -31,22 +36,21 @@ const snippets = require('@applitools/snippets');
|
|
|
31
36
|
// eslint-disable-next-line
|
|
32
37
|
class Driver {
|
|
33
38
|
constructor(options) {
|
|
34
|
-
var _a, _b, _c, _d, _e, _f;
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
35
40
|
if (options.driver instanceof Driver)
|
|
36
41
|
return options.driver;
|
|
42
|
+
this._customConfig = (_a = options.customConfig) !== null && _a !== void 0 ? _a : {};
|
|
37
43
|
this._spec = options.spec;
|
|
38
|
-
this.
|
|
39
|
-
if (options.logger)
|
|
40
|
-
this._logger = options.logger;
|
|
44
|
+
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' });
|
|
41
45
|
if (this._spec.isDriver(options.driver)) {
|
|
42
|
-
this._target = (
|
|
46
|
+
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;
|
|
43
47
|
}
|
|
44
48
|
else {
|
|
45
49
|
throw new TypeError('Driver constructor called with argument of unknown type!');
|
|
46
50
|
}
|
|
47
51
|
this._mainContext = new context_1.Context({
|
|
48
52
|
spec: this._spec,
|
|
49
|
-
context: (
|
|
53
|
+
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,
|
|
50
54
|
driver: this,
|
|
51
55
|
logger: this._logger,
|
|
52
56
|
});
|
|
@@ -141,10 +145,10 @@ class Driver {
|
|
|
141
145
|
}
|
|
142
146
|
async init() {
|
|
143
147
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
144
|
-
var _w, _x, _y, _z, _0, _1, _2, _3;
|
|
148
|
+
var _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
145
149
|
const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
|
|
146
150
|
this._logger.log('Driver capabilities', capabilities);
|
|
147
|
-
const capabilitiesInfo = capabilities ? capabilities_1.parseCapabilities(capabilities, this._customConfig) : undefined;
|
|
151
|
+
const capabilitiesInfo = capabilities ? (0, capabilities_1.parseCapabilities)(capabilities, this._customConfig) : undefined;
|
|
148
152
|
const driverInfo = await ((_d = (_c = this._spec).getDriverInfo) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));
|
|
149
153
|
this._driverInfo = Object.assign(Object.assign({}, capabilitiesInfo), driverInfo);
|
|
150
154
|
if (this.isWeb) {
|
|
@@ -152,7 +156,7 @@ class Driver {
|
|
|
152
156
|
(_f = (_x = this._driverInfo).viewportScale) !== null && _f !== void 0 ? _f : (_x.viewportScale = await this.execute(snippets.getViewportScale));
|
|
153
157
|
(_g = (_y = this._driverInfo).userAgent) !== null && _g !== void 0 ? _g : (_y.userAgent = await this.execute(snippets.getUserAgent));
|
|
154
158
|
if (this._driverInfo.userAgent) {
|
|
155
|
-
const userAgentInfo = user_agent_1.parseUserAgent(this._driverInfo.userAgent);
|
|
159
|
+
const userAgentInfo = (0, user_agent_1.parseUserAgent)(this._driverInfo.userAgent);
|
|
156
160
|
this._driverInfo.browserName = (_h = userAgentInfo.browserName) !== null && _h !== void 0 ? _h : this._driverInfo.browserName;
|
|
157
161
|
this._driverInfo.browserVersion = (_j = userAgentInfo.browserVersion) !== null && _j !== void 0 ? _j : this._driverInfo.browserVersion;
|
|
158
162
|
if (this._driverInfo.isMobile) {
|
|
@@ -168,27 +172,35 @@ class Driver {
|
|
|
168
172
|
(_q = (_2 = this._driverInfo.features).allCookies) !== null && _q !== void 0 ? _q : (_2.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
|
|
169
173
|
}
|
|
170
174
|
else {
|
|
171
|
-
const barsHeight = await ((_s = (_r = this._spec).getBarsSize) === null || _s === void 0 ? void 0 : _s.call(_r, this.target).catch(() => undefined));
|
|
172
175
|
const displaySize = await this.getDisplaySize();
|
|
176
|
+
const orientation = await this.getOrientation();
|
|
173
177
|
// calculate status and navigation bars sizes
|
|
174
|
-
if (barsHeight) {
|
|
175
|
-
const orientation = await this.getOrientation();
|
|
176
|
-
// when status bar is overlapping content on android it returns status bar height equal to viewport height
|
|
177
|
-
if (this.isAndroid && barsHeight.statusBarHeight / this.pixelRatio < displaySize.height) {
|
|
178
|
-
this._driverInfo.statusBarHeight = Math.max((_t = this._driverInfo.statusBarHeight) !== null && _t !== void 0 ? _t : 0, barsHeight.statusBarHeight);
|
|
179
|
-
}
|
|
180
|
-
// android witches the width and height only for the navigationBar in landscape mode.
|
|
181
|
-
this._driverInfo.navigationBarHeight = Math.max((_u = this._driverInfo.navigationBarHeight) !== null && _u !== void 0 ? _u : 0, orientation === 'landscape' ? barsHeight.navigationBarWidth : barsHeight.navigationBarHeight);
|
|
182
|
-
}
|
|
183
178
|
if (this.isAndroid) {
|
|
184
|
-
|
|
185
|
-
this.
|
|
179
|
+
// bar sizes could be extracted only on android
|
|
180
|
+
const barsSize = await ((_s = (_r = this._spec).getBarsSize) === null || _s === void 0 ? void 0 : _s.call(_r, this.target).catch(() => undefined));
|
|
181
|
+
if (barsSize) {
|
|
182
|
+
this._logger.log('Driver bars size', barsSize);
|
|
183
|
+
// navigation bar height is replaced with the width in landscape orientation on android (due to the bug in appium)
|
|
184
|
+
if (orientation === 'landscape')
|
|
185
|
+
barsSize.navigationBarHeight = barsSize.navigationBarWidth;
|
|
186
|
+
// when status bar is overlapping content on android it returns status bar height equal to viewport height
|
|
187
|
+
if (barsSize.statusBarHeight / this.pixelRatio < displaySize.height) {
|
|
188
|
+
this._driverInfo.statusBarHeight = Math.max((_t = this._driverInfo.statusBarHeight) !== null && _t !== void 0 ? _t : 0, barsSize.statusBarHeight);
|
|
189
|
+
}
|
|
190
|
+
// when navigation bar is invisible on android it returns navigation bar height equal to viewport height
|
|
191
|
+
if (barsSize.navigationBarHeight / this.pixelRatio < displaySize.height) {
|
|
192
|
+
this._driverInfo.navigationBarHeight = Math.max((_u = this._driverInfo.navigationBarHeight) !== null && _u !== void 0 ? _u : 0, barsSize.navigationBarHeight);
|
|
193
|
+
}
|
|
194
|
+
// bar heights have to be scaled on android
|
|
195
|
+
(_3 = this._driverInfo).statusBarHeight && (_3.statusBarHeight = this._driverInfo.statusBarHeight / this.pixelRatio);
|
|
196
|
+
(_4 = this._driverInfo).navigationBarHeight && (_4.navigationBarHeight = this._driverInfo.navigationBarHeight / this.pixelRatio);
|
|
197
|
+
}
|
|
186
198
|
}
|
|
187
199
|
// calculate viewport size
|
|
188
200
|
if (!this._driverInfo.viewportSize) {
|
|
189
201
|
this._driverInfo.viewportSize = {
|
|
190
202
|
width: displaySize.width,
|
|
191
|
-
height: displaySize.height - this.
|
|
203
|
+
height: displaySize.height - this.statusBarHeight,
|
|
192
204
|
};
|
|
193
205
|
}
|
|
194
206
|
// calculate safe area
|
|
@@ -214,7 +226,7 @@ class Driver {
|
|
|
214
226
|
: await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this, logger: this._logger });
|
|
215
227
|
}
|
|
216
228
|
if (this.isMobile) {
|
|
217
|
-
(_v = (
|
|
229
|
+
(_v = (_5 = this._driverInfo).orientation) !== null && _v !== void 0 ? _v : (_5.orientation = await this.getOrientation().catch(() => undefined));
|
|
218
230
|
}
|
|
219
231
|
this._logger.log('Combined driver info', this._driverInfo);
|
|
220
232
|
return this;
|
|
@@ -381,11 +393,11 @@ class Driver {
|
|
|
381
393
|
}
|
|
382
394
|
return this.currentContext;
|
|
383
395
|
}
|
|
384
|
-
async normalizeRegion(region
|
|
396
|
+
async normalizeRegion(region) {
|
|
385
397
|
if (this.isWeb || !utils.types.has(this._driverInfo, ['viewportSize', 'statusBarHeight']))
|
|
386
398
|
return region;
|
|
387
399
|
const scaledRegion = this.isAndroid ? utils.geometry.scale(region, 1 / this.pixelRatio) : region;
|
|
388
|
-
const safeRegion = this.isIOS &&
|
|
400
|
+
const safeRegion = this.isIOS && utils.geometry.isIntersected(scaledRegion, this._driverInfo.safeArea)
|
|
389
401
|
? utils.geometry.intersect(scaledRegion, this._driverInfo.safeArea)
|
|
390
402
|
: scaledRegion;
|
|
391
403
|
const offsetRegion = utils.geometry.offsetNegative(safeRegion, {
|
|
@@ -423,9 +435,11 @@ class Driver {
|
|
|
423
435
|
let size;
|
|
424
436
|
if (this.isNative) {
|
|
425
437
|
if ((_a = this._driverInfo) === null || _a === void 0 ? void 0 : _a.viewportSize) {
|
|
438
|
+
this._logger.log('Extracting viewport size from native driver using cached value');
|
|
426
439
|
size = this._driverInfo.viewportSize;
|
|
427
440
|
}
|
|
428
441
|
else {
|
|
442
|
+
this._logger.log('Extracting viewport size from native driver');
|
|
429
443
|
size = await this.getDisplaySize();
|
|
430
444
|
if (size.height > size.width) {
|
|
431
445
|
const orientation = await this.getOrientation();
|
|
@@ -433,14 +447,15 @@ class Driver {
|
|
|
433
447
|
size = { width: size.height, height: size.width };
|
|
434
448
|
}
|
|
435
449
|
}
|
|
450
|
+
size.height -= this.statusBarHeight;
|
|
436
451
|
}
|
|
452
|
+
this._logger.log(`Rounding viewport size using`, this._customConfig.useCeilForViewportSize ? 'ceil' : 'round');
|
|
437
453
|
if (this._customConfig.useCeilForViewportSize) {
|
|
438
454
|
size = utils.geometry.ceil(size);
|
|
439
455
|
}
|
|
440
456
|
else {
|
|
441
457
|
size = utils.geometry.round(size);
|
|
442
458
|
}
|
|
443
|
-
this._logger.log(`Extracting viewport size from native driver using '${this._customConfig.useCeilForViewportSize ? 'ceil' : 'round'}' method`);
|
|
444
459
|
}
|
|
445
460
|
else if (this._spec.getViewportSize) {
|
|
446
461
|
this._logger.log('Extracting viewport size from web driver using spec method');
|
|
@@ -492,20 +507,22 @@ class Driver {
|
|
|
492
507
|
if (this.isWeb && !this.isMobile)
|
|
493
508
|
return;
|
|
494
509
|
const size = await this._spec.getWindowSize(this.target);
|
|
495
|
-
|
|
510
|
+
const normalizedSize = this.isAndroid ? utils.geometry.scale(size, 1 / this.pixelRatio) : size;
|
|
511
|
+
this._logger.log('Extracted and normalized display size:', normalizedSize);
|
|
512
|
+
return normalizedSize;
|
|
496
513
|
}
|
|
497
514
|
async getOrientation() {
|
|
498
515
|
if (this.isWeb && !this.isMobile)
|
|
499
516
|
return;
|
|
500
|
-
const orientation = this._spec.getOrientation(this.target);
|
|
517
|
+
const orientation = await this._spec.getOrientation(this.target);
|
|
501
518
|
this._logger.log('Extracted device orientation:', orientation);
|
|
502
519
|
return orientation;
|
|
503
520
|
}
|
|
504
521
|
async setOrientation(orientation) {
|
|
505
522
|
if (this.isWeb && !this.isMobile)
|
|
506
523
|
return;
|
|
524
|
+
this._logger.log('Set device orientation:', orientation);
|
|
507
525
|
await this._spec.setOrientation(this.target, orientation);
|
|
508
|
-
this._logger.log('set device orientation:', orientation);
|
|
509
526
|
}
|
|
510
527
|
async getCookies() {
|
|
511
528
|
var _a, _b, _c;
|
|
@@ -529,7 +546,7 @@ class Driver {
|
|
|
529
546
|
async getUrl() {
|
|
530
547
|
if (this.isNative)
|
|
531
548
|
return null;
|
|
532
|
-
const url = this._spec.getUrl(this.target);
|
|
549
|
+
const url = await this._spec.getUrl(this.target);
|
|
533
550
|
this._logger.log('Extracted url:', url);
|
|
534
551
|
return url;
|
|
535
552
|
}
|
package/dist/element.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -106,7 +110,7 @@ class Element {
|
|
|
106
110
|
return this;
|
|
107
111
|
}
|
|
108
112
|
}
|
|
109
|
-
async getRegion(
|
|
113
|
+
async getRegion() {
|
|
110
114
|
const region = await this.withRefresh(async () => {
|
|
111
115
|
if (this.driver.isWeb) {
|
|
112
116
|
this._logger.log('Extracting region of web element with selector', this.selector);
|
|
@@ -116,7 +120,7 @@ class Element {
|
|
|
116
120
|
this._logger.log('Extracting region of native element with selector', this.selector);
|
|
117
121
|
const region = await this._spec.getElementRegion(this.driver.target, this.target);
|
|
118
122
|
this._logger.log('Extracted native region', region);
|
|
119
|
-
return this.driver.normalizeRegion(region
|
|
123
|
+
return this.driver.normalizeRegion(region);
|
|
120
124
|
}
|
|
121
125
|
});
|
|
122
126
|
this._logger.log('Extracted region', region);
|
package/dist/fake/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/fake/spec-driver.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/spec-utils.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/user-agent.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -73,26 +73,27 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
+
"@applitools/logger": "1.1.4",
|
|
76
77
|
"@applitools/snippets": "2.2.3",
|
|
77
|
-
"@applitools/types": "1.4.
|
|
78
|
-
"@applitools/utils": "1.
|
|
78
|
+
"@applitools/types": "1.4.2",
|
|
79
|
+
"@applitools/utils": "1.3.0"
|
|
79
80
|
},
|
|
80
81
|
"devDependencies": {
|
|
81
|
-
"@applitools/bongo": "^2.0
|
|
82
|
-
"@types/mocha": "^9.
|
|
83
|
-
"@types/node": "^
|
|
84
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
85
|
-
"@typescript-eslint/parser": "^
|
|
86
|
-
"eslint": "^
|
|
87
|
-
"eslint-config-prettier": "^8.
|
|
82
|
+
"@applitools/bongo": "^2.1.0",
|
|
83
|
+
"@types/mocha": "^9.1.1",
|
|
84
|
+
"@types/node": "^17.0.31",
|
|
85
|
+
"@typescript-eslint/eslint-plugin": "^5.22.0",
|
|
86
|
+
"@typescript-eslint/parser": "^5.22.0",
|
|
87
|
+
"eslint": "^8.14.0",
|
|
88
|
+
"eslint-config-prettier": "^8.5.0",
|
|
88
89
|
"eslint-plugin-mocha-no-only": "^1.1.1",
|
|
89
90
|
"eslint-plugin-node": "^11.1.0",
|
|
90
|
-
"eslint-plugin-prettier": "^
|
|
91
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
91
92
|
"husky": "^4.3.7",
|
|
92
|
-
"mocha": "^
|
|
93
|
-
"prettier": "^2.
|
|
94
|
-
"ts-node": "^10.
|
|
95
|
-
"typescript": "^4.
|
|
93
|
+
"mocha": "^10.0.0",
|
|
94
|
+
"prettier": "^2.6.2",
|
|
95
|
+
"ts-node": "^10.7.0",
|
|
96
|
+
"typescript": "^4.6.4"
|
|
96
97
|
},
|
|
97
98
|
"engines": {
|
|
98
99
|
"node": ">= 8.9.0"
|
package/types/context.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as types from '@applitools/types';
|
|
2
|
-
import type
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
import { type Driver } from './driver';
|
|
3
4
|
import { Element } from './element';
|
|
4
5
|
export declare type ContextReference<TDriver, TContext, TElement, TSelector> = Context<TDriver, TContext, TElement, TSelector> | Element<TDriver, TContext, TElement, TSelector> | TElement | types.Selector<TSelector> | string | number;
|
|
5
6
|
export declare type ContextPlain<TDriver, TContext, TElement, TSelector> = ContextReference<TDriver, TContext, TElement, TSelector> | {
|
|
@@ -32,7 +33,7 @@ export declare class Context<TDriver, TContext, TElement, TSelector> {
|
|
|
32
33
|
reference?: ContextReference<TDriver, TContext, TElement, TSelector>;
|
|
33
34
|
element?: Element<TDriver, TContext, TElement, TSelector>;
|
|
34
35
|
scrollingElement?: Element<TDriver, TContext, TElement, TSelector>;
|
|
35
|
-
logger?:
|
|
36
|
+
logger?: Logger;
|
|
36
37
|
});
|
|
37
38
|
get target(): TContext;
|
|
38
39
|
get driver(): Driver<TDriver, TContext, TElement, TSelector>;
|
package/types/driver.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type * as types from '@applitools/types';
|
|
3
|
+
import { type Logger } from '@applitools/logger';
|
|
3
4
|
import { Context, ContextReference } from './context';
|
|
4
5
|
import { Element } from './element';
|
|
5
6
|
import { HelperIOS } from './helper-ios';
|
|
@@ -16,7 +17,7 @@ export declare class Driver<TDriver, TContext, TElement, TSelector> {
|
|
|
16
17
|
constructor(options: {
|
|
17
18
|
spec: types.SpecDriver<TDriver, TContext, TElement, TSelector>;
|
|
18
19
|
driver: Driver<TDriver, TContext, TElement, TSelector> | TDriver;
|
|
19
|
-
logger?:
|
|
20
|
+
logger?: Logger;
|
|
20
21
|
customConfig?: types.CustomDriverConfig;
|
|
21
22
|
});
|
|
22
23
|
get target(): TDriver;
|
|
@@ -52,7 +53,7 @@ export declare class Driver<TDriver, TContext, TElement, TSelector> {
|
|
|
52
53
|
switchToMainContext(): Promise<Context<TDriver, TContext, TElement, TSelector>>;
|
|
53
54
|
switchToParentContext(elevation?: number): Promise<Context<TDriver, TContext, TElement, TSelector>>;
|
|
54
55
|
switchToChildContext(...references: ContextReference<TDriver, TContext, TElement, TSelector>[]): Promise<Context<TDriver, TContext, TElement, TSelector>>;
|
|
55
|
-
normalizeRegion(region: types.Region
|
|
56
|
+
normalizeRegion(region: types.Region): Promise<types.Region>;
|
|
56
57
|
getRegionInViewport(context: Context<TDriver, TContext, TElement, TSelector>, region: types.Region): Promise<types.Region>;
|
|
57
58
|
element(selector: types.Selector<TSelector>): Promise<Element<TDriver, TContext, TElement, TSelector>>;
|
|
58
59
|
elements(selector: types.Selector<TSelector>): Promise<Element<TDriver, TContext, TElement, TSelector>[]>;
|
|
@@ -62,7 +63,7 @@ export declare class Driver<TDriver, TContext, TElement, TSelector> {
|
|
|
62
63
|
setViewportSize(size: types.Size): Promise<void>;
|
|
63
64
|
getDisplaySize(): Promise<types.Size>;
|
|
64
65
|
getOrientation(): Promise<'portrait' | 'landscape'>;
|
|
65
|
-
setOrientation(orientation:
|
|
66
|
+
setOrientation(orientation: 'portrait' | 'landscape'): Promise<void>;
|
|
66
67
|
getCookies(): Promise<types.Cookie[]>;
|
|
67
68
|
getTitle(): Promise<string>;
|
|
68
69
|
getUrl(): Promise<string>;
|
package/types/element.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as types from '@applitools/types';
|
|
2
|
-
import type
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
3
|
+
import { type Context } from './context';
|
|
3
4
|
export declare type ElementState = {
|
|
4
5
|
contentSize?: types.Size;
|
|
5
6
|
scrollOffset?: types.Location;
|
|
@@ -21,7 +22,7 @@ export declare class Element<TDriver, TContext, TElement, TSelector> {
|
|
|
21
22
|
context?: Context<TDriver, TContext, TElement, TSelector>;
|
|
22
23
|
selector?: types.Selector<TSelector>;
|
|
23
24
|
index?: number;
|
|
24
|
-
logger?:
|
|
25
|
+
logger?: Logger;
|
|
25
26
|
root?: TElement;
|
|
26
27
|
});
|
|
27
28
|
get target(): TElement;
|
|
@@ -31,7 +32,7 @@ export declare class Element<TDriver, TContext, TElement, TSelector> {
|
|
|
31
32
|
get isRef(): boolean;
|
|
32
33
|
equals(element: Element<TDriver, TContext, TElement, TSelector> | TElement): Promise<boolean>;
|
|
33
34
|
init(context: Context<TDriver, TContext, TElement, TSelector>): Promise<this>;
|
|
34
|
-
getRegion(
|
|
35
|
+
getRegion(): Promise<types.Region>;
|
|
35
36
|
getClientRegion(): Promise<types.Region>;
|
|
36
37
|
getContentSize(): Promise<types.Size>;
|
|
37
38
|
isScrollable(): Promise<boolean>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type * as types from '@applitools/types';
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
2
3
|
import type { Driver } from './driver';
|
|
3
4
|
import type { Element } from './element';
|
|
4
5
|
export declare class HelperAndroid<TDriver, TContext, TElement, TSelector> {
|
|
5
6
|
static make<TDriver, TContext, TElement, TSelector>(options: {
|
|
6
7
|
spec: types.SpecDriver<TDriver, TContext, TElement, TSelector>;
|
|
7
8
|
driver: Driver<TDriver, TContext, TElement, TSelector>;
|
|
8
|
-
logger:
|
|
9
|
+
logger: Logger;
|
|
9
10
|
}): Promise<HelperAndroid<TDriver, TContext, TElement, TSelector> | null>;
|
|
10
11
|
private readonly _spec;
|
|
11
12
|
private readonly _element;
|
package/types/helper-ios.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type * as types from '@applitools/types';
|
|
2
|
+
import { type Logger } from '@applitools/logger';
|
|
2
3
|
import type { Driver } from './driver';
|
|
3
4
|
import type { Element } from './element';
|
|
4
5
|
export declare class HelperIOS<TDriver, TContext, TElement, TSelector> {
|
|
5
6
|
static make<TDriver, TContext, TElement, TSelector>(options: {
|
|
6
7
|
spec: types.SpecDriver<TDriver, TContext, TElement, TSelector>;
|
|
7
8
|
driver: Driver<TDriver, TContext, TElement, TSelector>;
|
|
8
|
-
logger:
|
|
9
|
+
logger: Logger;
|
|
9
10
|
}): Promise<HelperIOS<TDriver, TContext, TElement, TSelector> | null>;
|
|
10
11
|
private readonly _driver;
|
|
11
12
|
private readonly _element;
|
|
@@ -15,7 +16,7 @@ export declare class HelperIOS<TDriver, TContext, TElement, TSelector> {
|
|
|
15
16
|
driver: Driver<TDriver, TContext, TElement, TSelector>;
|
|
16
17
|
element: Element<TDriver, TContext, TElement, TSelector>;
|
|
17
18
|
spec: types.SpecDriver<TDriver, TContext, TElement, TSelector>;
|
|
18
|
-
logger?:
|
|
19
|
+
logger?: Logger;
|
|
19
20
|
});
|
|
20
21
|
getContentSize(_element: Element<TDriver, TContext, TElement, TSelector>): Promise<types.Size>;
|
|
21
22
|
}
|