@applitools/driver 1.7.1 → 1.7.2
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/README.md +2 -2
- package/dist/driver.js +10 -2
- package/package.json +2 -2
- package/types/driver.d.ts +1 -0
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ The API and abstractions of the interface provides an extra functionality which
|
|
|
46
46
|
- [spec.type(context, element, value)](#spectypecontext-element-value)
|
|
47
47
|
- [spec.visit(driver, url)](#specvisitdriver-url)
|
|
48
48
|
- [spec.getOrientation(driver)](#specgetorientationdriver)
|
|
49
|
-
- [spec.
|
|
49
|
+
- [spec.getBarsSize(driver)](#specgetbarsSizedriver)
|
|
50
50
|
- [spec.getElementRegion(driver, element)](#specgetelementregiondriver-element)
|
|
51
51
|
- [spec.getElementAttribute(driver, element, attribute)](#specgetelementattributedriver-element-attribute)
|
|
52
52
|
- [spec.getElementText(driver, element)](#specgetelementtextdriver-element)
|
|
@@ -433,7 +433,7 @@ This command is optional.
|
|
|
433
433
|
### spec.getOrientation(driver)
|
|
434
434
|
TBD
|
|
435
435
|
|
|
436
|
-
### spec.
|
|
436
|
+
### spec.getBarsSize(driver)
|
|
437
437
|
TBD
|
|
438
438
|
|
|
439
439
|
### spec.getElementRegion(driver, element)
|
package/dist/driver.js
CHANGED
|
@@ -168,15 +168,17 @@ class Driver {
|
|
|
168
168
|
(_q = (_2 = this._driverInfo.features).allCookies) !== null && _q !== void 0 ? _q : (_2.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
171
|
-
const barsHeight = await ((_s = (_r = this._spec).
|
|
171
|
+
const barsHeight = await ((_s = (_r = this._spec).getBarsSize) === null || _s === void 0 ? void 0 : _s.call(_r, this.target).catch(() => undefined));
|
|
172
172
|
const displaySize = await this.getDisplaySize();
|
|
173
173
|
// calculate status and navigation bars sizes
|
|
174
174
|
if (barsHeight) {
|
|
175
|
+
const orientation = await this.getOrientation();
|
|
175
176
|
// when status bar is overlapping content on android it returns status bar height equal to viewport height
|
|
176
177
|
if (this.isAndroid && barsHeight.statusBarHeight / this.pixelRatio < displaySize.height) {
|
|
177
178
|
this._driverInfo.statusBarHeight = Math.max((_t = this._driverInfo.statusBarHeight) !== null && _t !== void 0 ? _t : 0, barsHeight.statusBarHeight);
|
|
178
179
|
}
|
|
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);
|
|
180
182
|
}
|
|
181
183
|
if (this.isAndroid) {
|
|
182
184
|
this._driverInfo.statusBarHeight /= this.pixelRatio;
|
|
@@ -499,6 +501,12 @@ class Driver {
|
|
|
499
501
|
this._logger.log('Extracted device orientation:', orientation);
|
|
500
502
|
return orientation;
|
|
501
503
|
}
|
|
504
|
+
async setOrientation(orientation) {
|
|
505
|
+
if (this.isWeb && !this.isMobile)
|
|
506
|
+
return;
|
|
507
|
+
await this._spec.setOrientation(this.target, orientation);
|
|
508
|
+
this._logger.log('set device orientation:', orientation);
|
|
509
|
+
}
|
|
502
510
|
async getCookies() {
|
|
503
511
|
var _a, _b, _c;
|
|
504
512
|
if (this.isNative || !this.features.allCookies)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@applitools/snippets": "2.2.3",
|
|
77
|
-
"@applitools/types": "1.3.
|
|
77
|
+
"@applitools/types": "1.3.2",
|
|
78
78
|
"@applitools/utils": "1.2.14"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
package/types/driver.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export declare class Driver<TDriver, TContext, TElement, TSelector> {
|
|
|
62
62
|
setViewportSize(size: types.Size): Promise<void>;
|
|
63
63
|
getDisplaySize(): Promise<types.Size>;
|
|
64
64
|
getOrientation(): Promise<'portrait' | 'landscape'>;
|
|
65
|
+
setOrientation(orientation: types.ScreenOrientation): Promise<void>;
|
|
65
66
|
getCookies(): Promise<types.Cookie[]>;
|
|
66
67
|
getTitle(): Promise<string>;
|
|
67
68
|
getUrl(): Promise<string>;
|