@applitools/driver 1.9.29 → 1.9.31
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 +33 -30
- package/dist/helper-android.js +3 -0
- package/package.json +3 -3
package/dist/driver.js
CHANGED
|
@@ -144,45 +144,47 @@ 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, _1, _2, _3;
|
|
148
|
-
var
|
|
149
|
-
|
|
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, _3, _4, _5;
|
|
148
|
+
var _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17;
|
|
149
|
+
// NOTE: this is here because saucelabs does not provide right capabilities for the first call
|
|
150
|
+
await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
|
|
151
|
+
const capabilities = await ((_d = (_c = this._spec).getCapabilities) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));
|
|
150
152
|
this._logger.log('Driver capabilities', capabilities);
|
|
151
153
|
const capabilitiesInfo = capabilities ? (0, capabilities_1.parseCapabilities)(capabilities) : undefined;
|
|
152
|
-
const driverInfo = await ((
|
|
154
|
+
const driverInfo = await ((_f = (_e = this._spec).getDriverInfo) === null || _f === void 0 ? void 0 : _f.call(_e, this.target));
|
|
153
155
|
this._driverInfo = { ...capabilitiesInfo, ...driverInfo };
|
|
154
156
|
if (this.isMobile) {
|
|
155
157
|
this._driverInfo.orientation =
|
|
156
|
-
(
|
|
158
|
+
(_g = (await this.getOrientation().catch(() => undefined))) !== null && _g !== void 0 ? _g : this._driverInfo.orientation;
|
|
157
159
|
}
|
|
158
160
|
if (this.isWeb) {
|
|
159
|
-
(
|
|
160
|
-
(
|
|
161
|
-
(
|
|
161
|
+
(_h = (_6 = this._driverInfo).pixelRatio) !== null && _h !== void 0 ? _h : (_6.pixelRatio = await this.execute(snippets.getPixelRatio));
|
|
162
|
+
(_j = (_7 = this._driverInfo).viewportScale) !== null && _j !== void 0 ? _j : (_7.viewportScale = await this.execute(snippets.getViewportScale));
|
|
163
|
+
(_k = (_8 = this._driverInfo).userAgent) !== null && _k !== void 0 ? _k : (_8.userAgent = await this.execute(snippets.getUserAgent));
|
|
162
164
|
if (this._driverInfo.userAgent) {
|
|
163
165
|
const userAgentInfo = (0, user_agent_1.parseUserAgent)(this._driverInfo.userAgent);
|
|
164
|
-
this._driverInfo.browserName = (
|
|
165
|
-
this._driverInfo.browserVersion = (
|
|
166
|
+
this._driverInfo.browserName = (_l = userAgentInfo.browserName) !== null && _l !== void 0 ? _l : this._driverInfo.browserName;
|
|
167
|
+
this._driverInfo.browserVersion = (_m = userAgentInfo.browserVersion) !== null && _m !== void 0 ? _m : this._driverInfo.browserVersion;
|
|
166
168
|
if (this._driverInfo.isMobile) {
|
|
167
|
-
(
|
|
168
|
-
(
|
|
169
|
+
(_o = (_9 = this._driverInfo).platformName) !== null && _o !== void 0 ? _o : (_9.platformName = userAgentInfo.platformName);
|
|
170
|
+
(_p = (_10 = this._driverInfo).platformVersion) !== null && _p !== void 0 ? _p : (_10.platformVersion = userAgentInfo.platformVersion);
|
|
169
171
|
}
|
|
170
172
|
else {
|
|
171
|
-
this._driverInfo.platformName = (
|
|
172
|
-
this._driverInfo.platformVersion = (
|
|
173
|
+
this._driverInfo.platformName = (_q = userAgentInfo.platformName) !== null && _q !== void 0 ? _q : this._driverInfo.platformName;
|
|
174
|
+
this._driverInfo.platformVersion = (_r = userAgentInfo.platformVersion) !== null && _r !== void 0 ? _r : this._driverInfo.platformVersion;
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
177
|
if (!this._driverInfo.isMobile && (this.isAndroid || this.isIOS)) {
|
|
176
178
|
this._driverInfo.isMobile = true;
|
|
177
179
|
}
|
|
178
|
-
(
|
|
179
|
-
(
|
|
180
|
+
(_s = (_11 = this._driverInfo).features) !== null && _s !== void 0 ? _s : (_11.features = {});
|
|
181
|
+
(_t = (_12 = this._driverInfo.features).allCookies) !== null && _t !== void 0 ? _t : (_12.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
|
|
180
182
|
}
|
|
181
183
|
else {
|
|
182
184
|
// this value always excludes the height of the navigation bar, and sometimes it also excludes the height of the status bar
|
|
183
185
|
let windowSize = await this._spec.getWindowSize(this.target);
|
|
184
|
-
(
|
|
185
|
-
if (((
|
|
186
|
+
(_u = (_13 = this._driverInfo).displaySize) !== null && _u !== void 0 ? _u : (_13.displaySize = windowSize);
|
|
187
|
+
if (((_v = this.orientation) === null || _v === void 0 ? void 0 : _v.startsWith('landscape')) &&
|
|
186
188
|
this._driverInfo.displaySize.height > this._driverInfo.displaySize.width) {
|
|
187
189
|
this._driverInfo.displaySize = {
|
|
188
190
|
width: this._driverInfo.displaySize.height,
|
|
@@ -191,14 +193,14 @@ class Driver {
|
|
|
191
193
|
}
|
|
192
194
|
if (this.isAndroid) {
|
|
193
195
|
// bar sizes could be extracted only on android
|
|
194
|
-
const systemBars = await ((
|
|
196
|
+
const systemBars = await ((_x = (_w = this._spec).getSystemBars) === null || _x === void 0 ? void 0 : _x.call(_w, this.target).catch(() => null));
|
|
195
197
|
const { statusBar, navigationBar } = systemBars !== null && systemBars !== void 0 ? systemBars : {};
|
|
196
198
|
if (statusBar === null || statusBar === void 0 ? void 0 : statusBar.visible) {
|
|
197
199
|
this._logger.log('Driver status bar', statusBar);
|
|
198
200
|
const statusBarSize = statusBar.height;
|
|
199
201
|
// when status bar is overlapping content on android it returns status bar height equal to display height
|
|
200
202
|
if (statusBarSize < this._driverInfo.displaySize.height) {
|
|
201
|
-
this._driverInfo.statusBarSize = Math.max((
|
|
203
|
+
this._driverInfo.statusBarSize = Math.max((_y = this._driverInfo.statusBarSize) !== null && _y !== void 0 ? _y : 0, statusBarSize);
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
206
|
if (navigationBar === null || navigationBar === void 0 ? void 0 : navigationBar.visible) {
|
|
@@ -207,28 +209,28 @@ class Driver {
|
|
|
207
209
|
if (navigationBar.x > 0)
|
|
208
210
|
this._driverInfo.orientation = 'landscape-secondary';
|
|
209
211
|
// navigation bar size could be its height or width depending on screen orientation
|
|
210
|
-
const navigationBarSize = navigationBar[((
|
|
212
|
+
const navigationBarSize = navigationBar[((_z = this.orientation) === null || _z === void 0 ? void 0 : _z.startsWith('landscape')) ? 'width' : 'height'];
|
|
211
213
|
// when navigation bar is invisible on android it returns navigation bar size equal to display size
|
|
212
214
|
if (navigationBarSize <
|
|
213
|
-
this._driverInfo.displaySize[((
|
|
214
|
-
this._driverInfo.navigationBarSize = Math.max((
|
|
215
|
+
this._driverInfo.displaySize[((_0 = this.orientation) === null || _0 === void 0 ? void 0 : _0.startsWith('landscape')) ? 'width' : 'height']) {
|
|
216
|
+
this._driverInfo.navigationBarSize = Math.max((_1 = this._driverInfo.navigationBarSize) !== null && _1 !== void 0 ? _1 : 0, navigationBarSize);
|
|
215
217
|
}
|
|
216
218
|
else {
|
|
217
219
|
this._driverInfo.navigationBarSize = 0;
|
|
218
220
|
}
|
|
219
221
|
}
|
|
220
222
|
// bar sizes have to be scaled on android
|
|
221
|
-
(
|
|
222
|
-
(
|
|
223
|
+
(_14 = this._driverInfo).statusBarSize && (_14.statusBarSize = this._driverInfo.statusBarSize / this.pixelRatio);
|
|
224
|
+
(_15 = this._driverInfo).navigationBarSize && (_15.navigationBarSize = this._driverInfo.navigationBarSize / this.pixelRatio);
|
|
223
225
|
windowSize = utils.geometry.scale(windowSize, 1 / this.pixelRatio);
|
|
224
|
-
(
|
|
226
|
+
(_16 = this._driverInfo).displaySize && (_16.displaySize = utils.geometry.scale(this._driverInfo.displaySize, 1 / this.pixelRatio));
|
|
225
227
|
}
|
|
226
228
|
if (this.isIOS) {
|
|
227
|
-
if ((
|
|
229
|
+
if ((_2 = this.orientation) === null || _2 === void 0 ? void 0 : _2.startsWith('landscape'))
|
|
228
230
|
this._driverInfo.statusBarSize = 0;
|
|
229
231
|
}
|
|
230
232
|
// calculate viewport location
|
|
231
|
-
(
|
|
233
|
+
(_3 = (_17 = this._driverInfo).viewportLocation) !== null && _3 !== void 0 ? _3 : (_17.viewportLocation = {
|
|
232
234
|
x: this.orientation === 'landscape' ? this.navigationBarSize : 0,
|
|
233
235
|
y: this.statusBarSize,
|
|
234
236
|
});
|
|
@@ -237,7 +239,7 @@ class Driver {
|
|
|
237
239
|
this._driverInfo.viewportSize = { ...this._driverInfo.displaySize };
|
|
238
240
|
this._driverInfo.viewportSize.height -= this.statusBarSize;
|
|
239
241
|
if (this.isAndroid) {
|
|
240
|
-
this._driverInfo.viewportSize[((
|
|
242
|
+
this._driverInfo.viewportSize[((_4 = this.orientation) === null || _4 === void 0 ? void 0 : _4.startsWith('landscape')) ? 'width' : 'height'] -=
|
|
241
243
|
this.navigationBarSize;
|
|
242
244
|
}
|
|
243
245
|
}
|
|
@@ -260,7 +262,7 @@ class Driver {
|
|
|
260
262
|
}
|
|
261
263
|
// TODO: if user opts into NML, skip initializing the helpers
|
|
262
264
|
// init helper lib
|
|
263
|
-
if (!((
|
|
265
|
+
if (!((_5 = this._customConfig) === null || _5 === void 0 ? void 0 : _5.disableHelper)) {
|
|
264
266
|
this._helper = this.isIOS
|
|
265
267
|
? await helper_ios_1.HelperIOS.make({ spec: this._spec, driver: this, logger: this._logger })
|
|
266
268
|
: await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this, logger: this._logger });
|
|
@@ -624,6 +626,7 @@ class Driver {
|
|
|
624
626
|
exports.Driver = Driver;
|
|
625
627
|
async function makeDriver(options) {
|
|
626
628
|
const driver = new Driver(options);
|
|
629
|
+
await utils.general.sleep(5000);
|
|
627
630
|
await driver.init();
|
|
628
631
|
await driver.refreshContexts();
|
|
629
632
|
return driver;
|
package/dist/helper-android.js
CHANGED
|
@@ -75,6 +75,9 @@ class HelperAndroid {
|
|
|
75
75
|
return resourceId.split('/')[1];
|
|
76
76
|
}
|
|
77
77
|
async _command(command) {
|
|
78
|
+
// clean the input before passing value there could
|
|
79
|
+
// be a left over from previous async calls
|
|
80
|
+
await this._input.type('');
|
|
78
81
|
await this._input.type(command);
|
|
79
82
|
await this._input.click();
|
|
80
83
|
let text = await this._input.getText();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.31",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@applitools/logger": "1.1.
|
|
90
|
+
"@applitools/logger": "1.1.21",
|
|
91
91
|
"@applitools/snippets": "2.4.5",
|
|
92
|
-
"@applitools/types": "1.5.
|
|
92
|
+
"@applitools/types": "1.5.14",
|
|
93
93
|
"@applitools/utils": "1.3.12",
|
|
94
94
|
"semver": "7.3.7"
|
|
95
95
|
},
|