@applitools/driver 1.4.11 → 1.4.15
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/CHANGELOG.md +20 -0
- package/dist/driver.js +23 -18
- package/dist/element.js +5 -2
- package/dist/helper-android.js +3 -3
- package/package.json +4 -4
- package/types/driver.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## 1.4.15 - 2022/2/15
|
|
7
|
+
|
|
8
|
+
- updated to @applitools/snippets@2.1.14 (from 2.1.13)
|
|
9
|
+
|
|
10
|
+
## 1.4.14 - 2022/2/15
|
|
11
|
+
|
|
12
|
+
- add `viewportScale` getter to `Driver` class
|
|
13
|
+
- updated to @applitools/snippets@2.1.13 (from 2.1.12)
|
|
14
|
+
- updated to @applitools/types@1.0.25 (from 1.0.24)
|
|
15
|
+
- updated to @applitools/utils@1.2.13 (from 1.2.12)
|
|
16
|
+
|
|
17
|
+
## 1.4.13 - 2022/2/10
|
|
18
|
+
|
|
19
|
+
- fix android helper
|
|
20
|
+
- updated to @applitools/utils@1.2.12 (from 1.2.11)
|
|
21
|
+
|
|
22
|
+
## 1.4.12 - 2022/2/8
|
|
23
|
+
|
|
24
|
+
- fix usage of `-ios class chain` selectors
|
|
25
|
+
|
|
6
26
|
## 1.4.11 - 2022/2/8
|
|
7
27
|
|
|
8
28
|
- use `-ios class chain` selectors instead of `class name` for iOS specific elements
|
package/dist/driver.js
CHANGED
|
@@ -99,6 +99,10 @@ class Driver {
|
|
|
99
99
|
var _a;
|
|
100
100
|
return (_a = this._driverInfo.pixelRatio) !== null && _a !== void 0 ? _a : 1;
|
|
101
101
|
}
|
|
102
|
+
get viewportScale() {
|
|
103
|
+
var _a;
|
|
104
|
+
return (_a = this._driverInfo.viewportScale) !== null && _a !== void 0 ? _a : 1;
|
|
105
|
+
}
|
|
102
106
|
get statusBarHeight() {
|
|
103
107
|
var _a;
|
|
104
108
|
return (_a = this._driverInfo.statusBarHeight) !== null && _a !== void 0 ? _a : (this.isNative ? 0 : undefined);
|
|
@@ -134,42 +138,43 @@ class Driver {
|
|
|
134
138
|
this._currentContext = context;
|
|
135
139
|
}
|
|
136
140
|
async init() {
|
|
137
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
138
|
-
var
|
|
141
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
142
|
+
var _w, _x, _y, _z, _0, _1, _2, _3;
|
|
139
143
|
const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
|
|
140
144
|
this._logger.log('Driver capabilities', capabilities);
|
|
141
145
|
const capabilitiesInfo = capabilities ? capabilities_1.parseCapabilities(capabilities) : undefined;
|
|
142
146
|
const driverInfo = await ((_d = (_c = this._spec).getDriverInfo) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));
|
|
143
147
|
this._driverInfo = Object.assign(Object.assign({}, capabilitiesInfo), driverInfo);
|
|
144
148
|
if (this.isWeb) {
|
|
145
|
-
(_e = (
|
|
146
|
-
(_f = (
|
|
149
|
+
(_e = (_w = this._driverInfo).pixelRatio) !== null && _e !== void 0 ? _e : (_w.pixelRatio = await this.execute(snippets.getPixelRatio));
|
|
150
|
+
(_f = (_x = this._driverInfo).viewportScale) !== null && _f !== void 0 ? _f : (_x.viewportScale = await this.execute(snippets.getViewportScale));
|
|
151
|
+
(_g = (_y = this._driverInfo).userAgent) !== null && _g !== void 0 ? _g : (_y.userAgent = await this.execute(snippets.getUserAgent));
|
|
147
152
|
if (this._driverInfo.userAgent) {
|
|
148
153
|
const userAgentInfo = user_agent_1.parseUserAgent(this._driverInfo.userAgent);
|
|
149
|
-
this._driverInfo.browserName = (
|
|
150
|
-
this._driverInfo.browserVersion = (
|
|
154
|
+
this._driverInfo.browserName = (_h = userAgentInfo.browserName) !== null && _h !== void 0 ? _h : this._driverInfo.browserName;
|
|
155
|
+
this._driverInfo.browserVersion = (_j = userAgentInfo.browserVersion) !== null && _j !== void 0 ? _j : this._driverInfo.browserVersion;
|
|
151
156
|
if (this._driverInfo.isMobile) {
|
|
152
|
-
(
|
|
153
|
-
(
|
|
157
|
+
(_k = (_z = this._driverInfo).platformName) !== null && _k !== void 0 ? _k : (_z.platformName = userAgentInfo.platformName);
|
|
158
|
+
(_l = (_0 = this._driverInfo).platformVersion) !== null && _l !== void 0 ? _l : (_0.platformVersion = userAgentInfo.platformVersion);
|
|
154
159
|
}
|
|
155
160
|
else {
|
|
156
|
-
this._driverInfo.platformName = (
|
|
157
|
-
this._driverInfo.platformVersion = (
|
|
161
|
+
this._driverInfo.platformName = (_m = userAgentInfo.platformName) !== null && _m !== void 0 ? _m : this._driverInfo.platformName;
|
|
162
|
+
this._driverInfo.platformVersion = (_o = userAgentInfo.platformVersion) !== null && _o !== void 0 ? _o : this._driverInfo.platformVersion;
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
|
-
(
|
|
161
|
-
(
|
|
165
|
+
(_p = (_1 = this._driverInfo).features) !== null && _p !== void 0 ? _p : (_1.features = {});
|
|
166
|
+
(_q = (_2 = this._driverInfo.features).allCookies) !== null && _q !== void 0 ? _q : (_2.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
|
|
162
167
|
}
|
|
163
168
|
else {
|
|
164
|
-
const barsHeight = await ((
|
|
169
|
+
const barsHeight = await ((_s = (_r = this._spec).getBarsHeight) === null || _s === void 0 ? void 0 : _s.call(_r, this.target).catch(() => undefined));
|
|
165
170
|
const displaySize = await this.getDisplaySize();
|
|
166
171
|
// calculate status and navigation bars sizes
|
|
167
172
|
if (barsHeight) {
|
|
168
173
|
// when status bar is overlapping content on android it returns status bar height equal to viewport height
|
|
169
174
|
if (this.isAndroid && barsHeight.statusBarHeight / this.pixelRatio < displaySize.height) {
|
|
170
|
-
this._driverInfo.statusBarHeight = Math.max((
|
|
175
|
+
this._driverInfo.statusBarHeight = Math.max((_t = this._driverInfo.statusBarHeight) !== null && _t !== void 0 ? _t : 0, barsHeight.statusBarHeight);
|
|
171
176
|
}
|
|
172
|
-
this._driverInfo.navigationBarHeight = Math.max((
|
|
177
|
+
this._driverInfo.navigationBarHeight = Math.max((_u = this._driverInfo.navigationBarHeight) !== null && _u !== void 0 ? _u : 0, barsHeight.navigationBarHeight);
|
|
173
178
|
}
|
|
174
179
|
if (this.isAndroid) {
|
|
175
180
|
this._driverInfo.statusBarHeight /= this.pixelRatio;
|
|
@@ -185,14 +190,14 @@ class Driver {
|
|
|
185
190
|
// calculate safe area
|
|
186
191
|
if (this.isIOS && !this._driverInfo.safeArea) {
|
|
187
192
|
this._driverInfo.safeArea = Object.assign({ x: 0, y: 0 }, displaySize);
|
|
188
|
-
const topElement = await this.element({ type: '-ios class chain', selector: 'XCUIElementTypeNavigationBar' });
|
|
193
|
+
const topElement = await this.element({ type: '-ios class chain', selector: '**/XCUIElementTypeNavigationBar' });
|
|
189
194
|
if (topElement) {
|
|
190
195
|
const topRegion = await this._spec.getElementRegion(this.target, topElement.target);
|
|
191
196
|
const topOffset = topRegion.y + topRegion.height;
|
|
192
197
|
this._driverInfo.safeArea.y = topOffset;
|
|
193
198
|
this._driverInfo.safeArea.height -= topOffset;
|
|
194
199
|
}
|
|
195
|
-
const bottomElement = await this.element({ type: '-ios class chain', selector: 'XCUIElementTypeTabBar' });
|
|
200
|
+
const bottomElement = await this.element({ type: '-ios class chain', selector: '**/XCUIElementTypeTabBar' });
|
|
196
201
|
if (bottomElement) {
|
|
197
202
|
const bottomRegion = await this._spec.getElementRegion(this.target, bottomElement.target);
|
|
198
203
|
const bottomOffset = bottomRegion.height;
|
|
@@ -205,7 +210,7 @@ class Driver {
|
|
|
205
210
|
: await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this, logger: this._logger });
|
|
206
211
|
}
|
|
207
212
|
if (this.isMobile) {
|
|
208
|
-
(
|
|
213
|
+
(_v = (_3 = this._driverInfo).orientation) !== null && _v !== void 0 ? _v : (_3.orientation = await this.getOrientation().catch(() => undefined));
|
|
209
214
|
}
|
|
210
215
|
this._logger.log('Combined driver info', this._driverInfo);
|
|
211
216
|
return this;
|
package/dist/element.js
CHANGED
|
@@ -220,14 +220,17 @@ class Element {
|
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
async getTouchPadding() {
|
|
223
|
+
var _a;
|
|
223
224
|
if (this._touchPadding == null) {
|
|
224
225
|
if (this.driver.isWeb)
|
|
225
226
|
this._touchPadding = 0;
|
|
226
227
|
else if (this.driver.isIOS)
|
|
227
228
|
this._touchPadding = 10;
|
|
228
229
|
else if (this.driver.isAndroid) {
|
|
229
|
-
const
|
|
230
|
-
|
|
230
|
+
const data = await this.getAttribute('contentSize')
|
|
231
|
+
.then(JSON.parse)
|
|
232
|
+
.catch(() => null);
|
|
233
|
+
this._touchPadding = (_a = data === null || data === void 0 ? void 0 : data.touchPadding) !== null && _a !== void 0 ? _a : 24;
|
|
231
234
|
}
|
|
232
235
|
}
|
|
233
236
|
return this._touchPadding;
|
package/dist/helper-android.js
CHANGED
|
@@ -12,8 +12,8 @@ class HelperAndroid {
|
|
|
12
12
|
const { spec, driver, logger } = options;
|
|
13
13
|
let legacy = false;
|
|
14
14
|
let element = await driver.element({
|
|
15
|
-
type: '
|
|
16
|
-
selector: '
|
|
15
|
+
type: 'xpath',
|
|
16
|
+
selector: '//*[@content-desc="EyesAppiumHelperEDT"]',
|
|
17
17
|
});
|
|
18
18
|
if (!element) {
|
|
19
19
|
legacy = true;
|
|
@@ -37,7 +37,7 @@ class HelperAndroid {
|
|
|
37
37
|
contentHeight = await this._element.getText();
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
const elementId = this._getElementId(element);
|
|
40
|
+
const elementId = await this._getElementId(element);
|
|
41
41
|
if (!elementId)
|
|
42
42
|
return null;
|
|
43
43
|
await this._element.type(`offset;${elementId};0;0;0`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.15",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@applitools/snippets": "2.1.
|
|
77
|
-
"@applitools/types": "1.0.
|
|
78
|
-
"@applitools/utils": "1.2.
|
|
76
|
+
"@applitools/snippets": "2.1.14",
|
|
77
|
+
"@applitools/types": "1.0.25",
|
|
78
|
+
"@applitools/utils": "1.2.13"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@applitools/sdk-release-kit": "0.13.11",
|
package/types/driver.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export declare class Driver<TDriver, TContext, TElement, TSelector> {
|
|
|
34
34
|
get userAgent(): string;
|
|
35
35
|
get orientation(): 'portrait' | 'landscape';
|
|
36
36
|
get pixelRatio(): number;
|
|
37
|
+
get viewportScale(): number;
|
|
37
38
|
get statusBarHeight(): number;
|
|
38
39
|
get navigationBarHeight(): number;
|
|
39
40
|
get isNative(): boolean;
|