@applitools/driver 1.4.5 → 1.4.9
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/capabilities.js +4 -2
- package/dist/debug/check-spec-driver.js +33 -36
- package/dist/driver.js +25 -13
- package/dist/fake/spec-driver.js +5 -1
- package/package.json +5 -5
- package/types/driver.d.ts +1 -0
- package/types/fake/spec-driver.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## 1.4.9 - 2022/1/12
|
|
7
|
+
|
|
8
|
+
- handle case with `spec.getCookies` throws an error when trying to get cookies of the browser
|
|
9
|
+
|
|
10
|
+
## 1.4.8 - 2022/1/5
|
|
11
|
+
|
|
12
|
+
- handle legacy appium capabilities
|
|
13
|
+
- updated to @applitools/utils@1.2.11 (from 1.2.5)
|
|
14
|
+
|
|
15
|
+
## 1.4.7 - 2021/12/22
|
|
16
|
+
|
|
17
|
+
- updated to @applitools/snippets@2.1.12 (from 2.1.11)
|
|
18
|
+
|
|
19
|
+
## 1.4.6 - 2021/12/22
|
|
20
|
+
|
|
21
|
+
- extract device orientation in `Driver`'s `init` and provide readonly access through the `orientation` getter of the `Driver`
|
|
22
|
+
- updated to @applitools/snippets@2.1.11 (from 2.1.10)
|
|
23
|
+
- updated to @applitools/types@1.0.23 (from 1.0.22)
|
|
24
|
+
- updated to @applitools/utils@1.2.5 (from 1.2.4)
|
|
25
|
+
|
|
6
26
|
## 1.4.5 - 2021/12/20
|
|
7
27
|
|
|
8
28
|
- improve native android app scrolling performance
|
package/dist/capabilities.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseCapabilities = void 0;
|
|
4
4
|
function parseCapabilities(capabilities) {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
5
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
6
|
+
if (capabilities.capabilities)
|
|
7
|
+
capabilities = capabilities.capabilities;
|
|
6
8
|
const info = {
|
|
7
9
|
browserName: !capabilities.app && !capabilities.bundleId
|
|
8
10
|
? ((_a = capabilities.browserName) !== null && _a !== void 0 ? _a : (_b = capabilities.desired) === null || _b === void 0 ? void 0 : _b.browserName) || undefined
|
|
@@ -18,11 +20,11 @@ function parseCapabilities(capabilities) {
|
|
|
18
20
|
info.isNative = info.isMobile && !info.browserName;
|
|
19
21
|
info.isIOS = isIOS(capabilities);
|
|
20
22
|
info.isAndroid = isAndroid(capabilities);
|
|
23
|
+
info.orientation = (_k = ((_j = capabilities.deviceOrientation) !== null && _j !== void 0 ? _j : capabilities.orientation)) === null || _k === void 0 ? void 0 : _k.toLowerCase();
|
|
21
24
|
}
|
|
22
25
|
if (info.isNative) {
|
|
23
26
|
info.pixelRatio = capabilities.pixelRatio;
|
|
24
27
|
info.statusBarHeight = capabilities.statBarHeight;
|
|
25
|
-
info.navigationBarHeight = 0;
|
|
26
28
|
}
|
|
27
29
|
return info;
|
|
28
30
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.checkSpecDriver = void 0;
|
|
7
|
-
const
|
|
4
|
+
const assert_1 = require("assert");
|
|
8
5
|
const snippets = require('@applitools/snippets');
|
|
9
6
|
async function checkSpecDriver(options) {
|
|
10
7
|
const { spec, driver } = options;
|
|
@@ -13,7 +10,7 @@ async function checkSpecDriver(options) {
|
|
|
13
10
|
'execute script with echo snippet': async () => {
|
|
14
11
|
const arg = [1, '23', false, { a: 4, b: [5] }, null];
|
|
15
12
|
const result = await spec.executeScript(context, 'return arguments[0]', arg);
|
|
16
|
-
|
|
13
|
+
assert_1.strict.deepEqual(result, arg, 'script returns an array of json data');
|
|
17
14
|
},
|
|
18
15
|
'execute script with functional script': async () => {
|
|
19
16
|
const arg = { a: 2, b: 1, c: 7 };
|
|
@@ -21,23 +18,23 @@ async function checkSpecDriver(options) {
|
|
|
21
18
|
return arg;
|
|
22
19
|
}
|
|
23
20
|
const result = await spec.executeScript(context, script, arg);
|
|
24
|
-
|
|
21
|
+
assert_1.strict.deepEqual(result, arg, 'script returns an array of json data from functional script');
|
|
25
22
|
},
|
|
26
23
|
'execute script with return value of dom element': async () => {
|
|
27
24
|
const element = await spec.executeScript(context, 'return document.documentElement');
|
|
28
25
|
const isHtmlElement = await spec.executeScript(context, 'return arguments[0] === document.documentElement', element);
|
|
29
|
-
|
|
26
|
+
assert_1.strict.ok(isHtmlElement, 'script returns an element and could be executed with an element');
|
|
30
27
|
},
|
|
31
28
|
'execute script with nested element references': async () => {
|
|
32
29
|
const elements = await spec.executeScript(context, 'return [{html: document.documentElement, body: document.body}]');
|
|
33
30
|
const isElements = await spec.executeScript(context, 'return arguments[0][0].html === document.documentElement && arguments[0][0].html === document.documentElement', elements);
|
|
34
|
-
|
|
31
|
+
assert_1.strict.ok(isElements, 'script returns elements inside nested structure and could be executed with a nested structure of elements');
|
|
35
32
|
},
|
|
36
33
|
'find element with string selector': async () => {
|
|
37
34
|
const selector = transformSelector('html>body>h1');
|
|
38
35
|
const element = await spec.findElement(context, selector);
|
|
39
36
|
const isWantedElement = await spec.executeScript(context, `return arguments[0] === document.querySelector("${selector}")`, element);
|
|
40
|
-
|
|
37
|
+
assert_1.strict.ok(isWantedElement, `returns element by string selector - "${selector}"`);
|
|
41
38
|
},
|
|
42
39
|
'find element with spec selector': async () => {
|
|
43
40
|
const cssSelector = transformSelector({ type: 'css', selector: 'html>body>h1' });
|
|
@@ -45,21 +42,21 @@ async function checkSpecDriver(options) {
|
|
|
45
42
|
const verificationScript = `return arguments[0] === document.querySelector('html>body>h1')`;
|
|
46
43
|
const cssElement = await spec.findElement(context, cssSelector);
|
|
47
44
|
const isCssElement = await spec.executeScript(context, verificationScript, cssElement);
|
|
48
|
-
|
|
45
|
+
assert_1.strict.ok(isCssElement, `returns element by spec selector - ${JSON.stringify(cssSelector)}`);
|
|
49
46
|
const xpathElement = await spec.findElement(context, xpathSelector);
|
|
50
47
|
const isXpathElement = await spec.executeScript(context, verificationScript, xpathElement);
|
|
51
|
-
|
|
48
|
+
assert_1.strict.ok(isXpathElement, `returns element by spec selector - ${JSON.stringify(xpathSelector)}`);
|
|
52
49
|
},
|
|
53
50
|
'find element with unresolvable selector': async () => {
|
|
54
51
|
const selector = transformSelector('unresolvable_selector');
|
|
55
52
|
const element = await spec.findElement(context, selector);
|
|
56
|
-
|
|
53
|
+
assert_1.strict.equal(element, null, `returns null by unresolvable selector - "${selector}"`);
|
|
57
54
|
},
|
|
58
55
|
'find elements with string selector': async () => {
|
|
59
56
|
const selector = transformSelector('html p');
|
|
60
57
|
const elements = await spec.findElements(context, selector);
|
|
61
58
|
const isExpectedElements = await spec.executeScript(context, `var expected = arguments[0]; return Array.prototype.every.call(document.querySelectorAll("${selector}"), function(element, index) { return element === expected[index] })`, elements);
|
|
62
|
-
|
|
59
|
+
assert_1.strict.ok(isExpectedElements, `returns elements by string selector - "${selector}"`);
|
|
63
60
|
},
|
|
64
61
|
'find elements with spec selector': async () => {
|
|
65
62
|
const cssSelector = transformSelector({ type: 'css', selector: 'html p' });
|
|
@@ -67,22 +64,22 @@ async function checkSpecDriver(options) {
|
|
|
67
64
|
const verificationScript = `var expected = arguments[0]; return Array.prototype.every.call(document.querySelectorAll('html p'), function(element, index) { return element === expected[index] })`;
|
|
68
65
|
const cssElements = await spec.findElements(context, cssSelector);
|
|
69
66
|
const isCssElements = await spec.executeScript(context, verificationScript, cssElements);
|
|
70
|
-
|
|
67
|
+
assert_1.strict.ok(isCssElements, `returns elements by spec selector - ${JSON.stringify(cssSelector)}`);
|
|
71
68
|
const xpathElements = await spec.findElements(context, xpathSelector);
|
|
72
69
|
const isXpathElements = await spec.executeScript(context, verificationScript, xpathElements);
|
|
73
|
-
|
|
70
|
+
assert_1.strict.ok(isXpathElements, `returns element by spec selector - ${JSON.stringify(xpathSelector)}`);
|
|
74
71
|
},
|
|
75
72
|
'find elements with unresolvable selector': async () => {
|
|
76
73
|
const selector = transformSelector('unresolvable_selector');
|
|
77
74
|
const element = await spec.findElements(context, selector);
|
|
78
|
-
|
|
75
|
+
assert_1.strict.deepEqual(element, [], `returns empty array by unresolvable selector - "${selector}"`);
|
|
79
76
|
},
|
|
80
77
|
'child context': async () => {
|
|
81
78
|
const element = await spec.findElement(context, transformSelector('[name="frame1"]'));
|
|
82
79
|
const childContext = await spec.childContext(context, element);
|
|
83
80
|
const inFrame = await spec.executeScript(childContext, 'return window.frameElement.name === "frame1"');
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
assert_1.strict.ok(inFrame, 'returns or switches to a child context');
|
|
82
|
+
assert_1.strict.ok(typeof spec.mainContext === 'function', 'spec.mainContext also needs to be implemented in order to test spec.childContext');
|
|
86
83
|
await spec.mainContext(context);
|
|
87
84
|
},
|
|
88
85
|
'is equal elements': async () => {
|
|
@@ -90,53 +87,53 @@ async function checkSpecDriver(options) {
|
|
|
90
87
|
return { skipped: true };
|
|
91
88
|
const htmlEl = await spec.findElement(context, transformSelector('html'));
|
|
92
89
|
const htmlEl2 = await spec.executeScript(context, 'return document.documentElement');
|
|
93
|
-
|
|
90
|
+
assert_1.strict.ok(await spec.isEqualElements(context, htmlEl, htmlEl2), 'elements should be equal');
|
|
94
91
|
const bodyEl = await spec.executeScript(context, 'return document.body');
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
assert_1.strict.ok(!(await spec.isEqualElements(context, htmlEl, bodyEl)), 'elements should not be equal');
|
|
93
|
+
assert_1.strict.ok(!(await spec.isEqualElements(context, htmlEl, undefined)), 'isEqualElements should return false if one of the arguments is falsy');
|
|
94
|
+
assert_1.strict.ok(!(await spec.isEqualElements(context, undefined, htmlEl)), 'isEqualElements should return false if one of the arguments is falsy');
|
|
98
95
|
},
|
|
99
96
|
'main context': async () => {
|
|
100
97
|
const mainDocument1 = await spec.findElement(context, transformSelector('html'));
|
|
101
98
|
const childContext1 = await spec.childContext(context, await spec.findElement(context, transformSelector('[name="frame1"]')));
|
|
102
99
|
const childContext2 = await spec.childContext(childContext1, await spec.findElement(childContext1, transformSelector('[name="frame1-1"]')));
|
|
103
100
|
const frameDocument = await spec.findElement(childContext2, transformSelector('html'));
|
|
104
|
-
|
|
101
|
+
assert_1.strict.ok(!(await isEqualElements(childContext2, mainDocument1, frameDocument)));
|
|
105
102
|
const mainContext = await spec.mainContext(childContext2);
|
|
106
103
|
const mainDocument2 = await spec.findElement(mainContext, transformSelector('html'));
|
|
107
|
-
|
|
104
|
+
assert_1.strict.ok(await isEqualElements(mainContext, mainDocument2, mainDocument1));
|
|
108
105
|
},
|
|
109
106
|
'parent context': async () => {
|
|
110
107
|
const parentContext1 = await spec.childContext(context, await spec.findElement(context, transformSelector('[name="frame1"]')));
|
|
111
108
|
const parentDocument1 = await spec.findElement(parentContext1, transformSelector('html'));
|
|
112
109
|
const frameContext = await spec.childContext(parentContext1, await spec.findElement(parentContext1, transformSelector('[name="frame1-1"]')));
|
|
113
110
|
const frameDocument = await spec.findElement(frameContext, transformSelector('html'));
|
|
114
|
-
|
|
111
|
+
assert_1.strict.ok(!(await isEqualElements(frameContext, parentDocument1, frameDocument)));
|
|
115
112
|
const parentContext2 = await spec.parentContext(frameContext);
|
|
116
113
|
const parentDocument2 = await spec.findElement(parentContext2, transformSelector('html'));
|
|
117
|
-
|
|
114
|
+
assert_1.strict.ok(await isEqualElements(parentContext2, parentDocument2, parentDocument1));
|
|
118
115
|
await spec.mainContext(context);
|
|
119
116
|
},
|
|
120
117
|
'get title': async () => {
|
|
121
118
|
const title = await spec.getTitle(driver);
|
|
122
|
-
|
|
119
|
+
assert_1.strict.equal(title, 'Cross SDK test', 'returns title of the current page');
|
|
123
120
|
},
|
|
124
121
|
'get url': async () => {
|
|
125
122
|
const url = await spec.getUrl(driver);
|
|
126
|
-
|
|
123
|
+
assert_1.strict.equal(url, 'https://applitools.github.io/demo/TestPages/FramesTestPage/', 'returns url of the current page');
|
|
127
124
|
},
|
|
128
125
|
'is driver': async () => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
assert_1.strict.ok(await spec.isDriver(driver), 'driver should be considered a driver :)');
|
|
127
|
+
assert_1.strict.ok(!(await spec.isDriver(undefined)), 'undefined should not be considered a driver');
|
|
128
|
+
assert_1.strict.ok(!(await spec.isDriver(3)), 'number should not be considered a driver');
|
|
129
|
+
assert_1.strict.ok(!(await spec.isDriver('str')), 'string should not be considered a driver');
|
|
133
130
|
},
|
|
134
131
|
'is element': async () => {
|
|
135
132
|
const el = await spec.findElement(context, transformSelector('html'));
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
assert_1.strict.ok(await spec.isElement(el), 'element should be considered an element :)');
|
|
134
|
+
assert_1.strict.ok(!(await spec.isElement(undefined)), 'undefined should not be considered an element');
|
|
135
|
+
assert_1.strict.ok(!(await spec.isElement(3)), 'number should not be considered an element');
|
|
136
|
+
assert_1.strict.ok(!(await spec.isElement('str')), 'str should not be considered an element');
|
|
140
137
|
},
|
|
141
138
|
// 'is selector': async () => {}, // hard to test this
|
|
142
139
|
// 'set window size': async () => {}, // hard to test this
|
package/dist/driver.js
CHANGED
|
@@ -92,6 +92,9 @@ class Driver {
|
|
|
92
92
|
var _a;
|
|
93
93
|
return (_a = this._driverInfo) === null || _a === void 0 ? void 0 : _a.userAgent;
|
|
94
94
|
}
|
|
95
|
+
get orientation() {
|
|
96
|
+
return this._driverInfo.orientation;
|
|
97
|
+
}
|
|
95
98
|
get pixelRatio() {
|
|
96
99
|
var _a;
|
|
97
100
|
return (_a = this._driverInfo.pixelRatio) !== null && _a !== void 0 ? _a : 1;
|
|
@@ -131,31 +134,31 @@ class Driver {
|
|
|
131
134
|
this._currentContext = context;
|
|
132
135
|
}
|
|
133
136
|
async init() {
|
|
134
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
135
|
-
var
|
|
137
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
138
|
+
var _v, _w, _x, _y, _z, _0, _1;
|
|
136
139
|
const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
|
|
137
140
|
this._logger.log('Driver capabilities', capabilities);
|
|
138
141
|
const capabilitiesInfo = capabilities ? capabilities_1.parseCapabilities(capabilities) : undefined;
|
|
139
142
|
const driverInfo = await ((_d = (_c = this._spec).getDriverInfo) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));
|
|
140
143
|
this._driverInfo = Object.assign(Object.assign({}, capabilitiesInfo), driverInfo);
|
|
141
144
|
if (this.isWeb) {
|
|
142
|
-
(_e = (
|
|
143
|
-
(_f = (
|
|
145
|
+
(_e = (_v = this._driverInfo).pixelRatio) !== null && _e !== void 0 ? _e : (_v.pixelRatio = await this.execute(snippets.getPixelRatio));
|
|
146
|
+
(_f = (_w = this._driverInfo).userAgent) !== null && _f !== void 0 ? _f : (_w.userAgent = await this.execute(snippets.getUserAgent));
|
|
144
147
|
if (this._driverInfo.userAgent) {
|
|
145
148
|
const userAgentInfo = user_agent_1.parseUserAgent(this._driverInfo.userAgent);
|
|
146
149
|
this._driverInfo.browserName = (_g = userAgentInfo.browserName) !== null && _g !== void 0 ? _g : this._driverInfo.browserName;
|
|
147
150
|
this._driverInfo.browserVersion = (_h = userAgentInfo.browserVersion) !== null && _h !== void 0 ? _h : this._driverInfo.browserVersion;
|
|
148
151
|
if (this._driverInfo.isMobile) {
|
|
149
|
-
(_j = (
|
|
150
|
-
(_k = (
|
|
152
|
+
(_j = (_x = this._driverInfo).platformName) !== null && _j !== void 0 ? _j : (_x.platformName = userAgentInfo.platformName);
|
|
153
|
+
(_k = (_y = this._driverInfo).platformVersion) !== null && _k !== void 0 ? _k : (_y.platformVersion = userAgentInfo.platformVersion);
|
|
151
154
|
}
|
|
152
155
|
else {
|
|
153
156
|
this._driverInfo.platformName = (_l = userAgentInfo.platformName) !== null && _l !== void 0 ? _l : this._driverInfo.platformName;
|
|
154
157
|
this._driverInfo.platformVersion = (_m = userAgentInfo.platformVersion) !== null && _m !== void 0 ? _m : this._driverInfo.platformVersion;
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
|
-
(_o = (
|
|
158
|
-
(_p = (
|
|
160
|
+
(_o = (_z = this._driverInfo).features) !== null && _o !== void 0 ? _o : (_z.features = {});
|
|
161
|
+
(_p = (_0 = this._driverInfo.features).allCookies) !== null && _p !== void 0 ? _p : (_0.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
|
|
159
162
|
}
|
|
160
163
|
else {
|
|
161
164
|
const barsHeight = await ((_r = (_q = this._spec).getBarsHeight) === null || _r === void 0 ? void 0 : _r.call(_q, this.target).catch(() => undefined));
|
|
@@ -164,9 +167,9 @@ class Driver {
|
|
|
164
167
|
if (barsHeight) {
|
|
165
168
|
// when status bar is overlapping content on android it returns status bar height equal to viewport height
|
|
166
169
|
if (this.isAndroid && barsHeight.statusBarHeight / this.pixelRatio < displaySize.height) {
|
|
167
|
-
this._driverInfo.statusBarHeight = Math.max(this._driverInfo.statusBarHeight, barsHeight.statusBarHeight);
|
|
170
|
+
this._driverInfo.statusBarHeight = Math.max((_s = this._driverInfo.statusBarHeight) !== null && _s !== void 0 ? _s : 0, barsHeight.statusBarHeight);
|
|
168
171
|
}
|
|
169
|
-
this._driverInfo.navigationBarHeight = Math.max(this._driverInfo.navigationBarHeight, barsHeight.navigationBarHeight);
|
|
172
|
+
this._driverInfo.navigationBarHeight = Math.max((_t = this._driverInfo.navigationBarHeight) !== null && _t !== void 0 ? _t : 0, barsHeight.navigationBarHeight);
|
|
170
173
|
}
|
|
171
174
|
if (this.isAndroid) {
|
|
172
175
|
this._driverInfo.statusBarHeight /= this.pixelRatio;
|
|
@@ -201,6 +204,9 @@ class Driver {
|
|
|
201
204
|
? await helper_ios_1.HelperIOS.make({ spec: this._spec, driver: this, logger: this._logger })
|
|
202
205
|
: await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this, logger: this._logger });
|
|
203
206
|
}
|
|
207
|
+
if (this.isMobile) {
|
|
208
|
+
(_u = (_1 = this._driverInfo).orientation) !== null && _u !== void 0 ? _u : (_1.orientation = await this.getOrientation().catch(() => undefined));
|
|
209
|
+
}
|
|
204
210
|
this._logger.log('Combined driver info', this._driverInfo);
|
|
205
211
|
return this;
|
|
206
212
|
}
|
|
@@ -462,13 +468,13 @@ class Driver {
|
|
|
462
468
|
throw new Error('Failed to set viewport size!');
|
|
463
469
|
}
|
|
464
470
|
async getDisplaySize() {
|
|
465
|
-
if (this.isWeb)
|
|
471
|
+
if (this.isWeb && !this.isMobile)
|
|
466
472
|
return;
|
|
467
473
|
const size = await this._spec.getWindowSize(this.target);
|
|
468
474
|
return this.isAndroid ? utils.geometry.scale(size, 1 / this.pixelRatio) : size;
|
|
469
475
|
}
|
|
470
476
|
async getOrientation() {
|
|
471
|
-
if (this.isWeb)
|
|
477
|
+
if (this.isWeb && !this.isMobile)
|
|
472
478
|
return;
|
|
473
479
|
const orientation = this._spec.getOrientation(this.target);
|
|
474
480
|
this._logger.log('Extracted device orientation:', orientation);
|
|
@@ -478,7 +484,13 @@ class Driver {
|
|
|
478
484
|
var _a, _b, _c;
|
|
479
485
|
if (this.isNative || !this.features.allCookies)
|
|
480
486
|
return [];
|
|
481
|
-
|
|
487
|
+
try {
|
|
488
|
+
return (_c = (await ((_b = (_a = this._spec).getCookies) === null || _b === void 0 ? void 0 : _b.call(_a, this.target)))) !== null && _c !== void 0 ? _c : [];
|
|
489
|
+
}
|
|
490
|
+
catch (error) {
|
|
491
|
+
this._driverInfo.features.allCookies = false;
|
|
492
|
+
throw error;
|
|
493
|
+
}
|
|
482
494
|
}
|
|
483
495
|
async getTitle() {
|
|
484
496
|
if (this.isNative)
|
package/dist/fake/spec-driver.js
CHANGED
|
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.visit = exports.getTitle = exports.getUrl = exports.setWindowSize = exports.getWindowSize = exports.getDriverInfo = exports.takeScreenshot = exports.childContext = exports.parentContext = exports.mainContext = exports.findElements = exports.findElement = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.transformSelector = exports.isSelector = exports.isElement = exports.isDriver = void 0;
|
|
22
|
+
exports.visit = exports.getTitle = exports.getUrl = exports.getOrientation = exports.setWindowSize = exports.getWindowSize = exports.getDriverInfo = exports.takeScreenshot = exports.childContext = exports.parentContext = exports.mainContext = exports.findElements = exports.findElement = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.transformSelector = exports.isSelector = exports.isElement = exports.isDriver = void 0;
|
|
23
23
|
const utils = __importStar(require("@applitools/utils"));
|
|
24
24
|
function isDriver(driver) {
|
|
25
25
|
return driver && driver.constructor.name === 'MockDriver';
|
|
@@ -86,6 +86,10 @@ async function setWindowSize(driver, size) {
|
|
|
86
86
|
await driver.setWindowRect(size);
|
|
87
87
|
}
|
|
88
88
|
exports.setWindowSize = setWindowSize;
|
|
89
|
+
async function getOrientation(_driver) {
|
|
90
|
+
return 'portrait';
|
|
91
|
+
}
|
|
92
|
+
exports.getOrientation = getOrientation;
|
|
89
93
|
async function getUrl(driver) {
|
|
90
94
|
if (this._isNative)
|
|
91
95
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -73,12 +73,12 @@
|
|
|
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.12",
|
|
77
|
+
"@applitools/types": "1.0.23",
|
|
78
|
+
"@applitools/utils": "1.2.11"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@applitools/sdk-release-kit": "0.13.
|
|
81
|
+
"@applitools/sdk-release-kit": "0.13.10",
|
|
82
82
|
"@types/mocha": "^9.0.0",
|
|
83
83
|
"@types/node": "^16.3.3",
|
|
84
84
|
"@typescript-eslint/eslint-plugin": "^4.28.3",
|
package/types/driver.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare class Driver<TDriver, TContext, TElement, TSelector> {
|
|
|
32
32
|
get browserName(): string;
|
|
33
33
|
get browserVersion(): string | number;
|
|
34
34
|
get userAgent(): string;
|
|
35
|
+
get orientation(): 'portrait' | 'landscape';
|
|
35
36
|
get pixelRatio(): number;
|
|
36
37
|
get statusBarHeight(): number;
|
|
37
38
|
get navigationBarHeight(): number;
|
|
@@ -24,6 +24,7 @@ export declare function takeScreenshot(driver: Driver): Promise<Buffer | string>
|
|
|
24
24
|
export declare function getDriverInfo(driver: Driver): Promise<DriverInfo>;
|
|
25
25
|
export declare function getWindowSize(driver: Driver): Promise<Size>;
|
|
26
26
|
export declare function setWindowSize(driver: Driver, size: Size): Promise<void>;
|
|
27
|
+
export declare function getOrientation(_driver: Driver): Promise<'portrait' | 'landscape'>;
|
|
27
28
|
export declare function getUrl(driver: Driver): Promise<string>;
|
|
28
29
|
export declare function getTitle(driver: Driver): Promise<string>;
|
|
29
30
|
export declare function visit(driver: Driver, url: string): Promise<void>;
|