@applitools/driver 1.4.3 → 1.4.7
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 +17 -0
- package/dist/debug/check-spec-driver.js +33 -36
- package/dist/driver.js +17 -11
- package/dist/element.js +12 -2
- package/dist/fake/spec-driver.js +5 -1
- package/package.json +4 -4
- package/types/driver.d.ts +1 -0
- package/types/fake/spec-driver.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## 1.4.7 - 2021/12/22
|
|
7
|
+
|
|
8
|
+
- updated to @applitools/snippets@2.1.12 (from 2.1.11)
|
|
9
|
+
|
|
10
|
+
## 1.4.6 - 2021/12/22
|
|
11
|
+
|
|
12
|
+
- extract device orientation in `Driver`'s `init` and provide readonly access through the `orientation` getter of the `Driver`
|
|
13
|
+
- updated to @applitools/snippets@2.1.11 (from 2.1.10)
|
|
14
|
+
- updated to @applitools/types@1.0.23 (from 1.0.22)
|
|
15
|
+
- updated to @applitools/utils@1.2.5 (from 1.2.4)
|
|
16
|
+
|
|
17
|
+
## 1.4.5 - 2021/12/20
|
|
18
|
+
|
|
19
|
+
- improve native android app scrolling performance
|
|
20
|
+
- fix bug with `Buffer.from` and base64
|
|
21
|
+
- updated to @applitools/snippets@2.1.10 (from 2.1.9)
|
|
22
|
+
|
|
6
23
|
## 1.4.3 - 2021/12/17
|
|
7
24
|
|
|
8
25
|
- convert base64 result of `spec.takeScreenshot` to `Buffer` before return it from `Driver`'s `takeScreenshot` method
|
|
@@ -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;
|
|
138
|
+
var _t, _u, _v, _w, _x, _y, _z;
|
|
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 = (_t = this._driverInfo).pixelRatio) !== null && _e !== void 0 ? _e : (_t.pixelRatio = await this.execute(snippets.getPixelRatio));
|
|
146
|
+
(_f = (_u = this._driverInfo).userAgent) !== null && _f !== void 0 ? _f : (_u.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 = (_v = this._driverInfo).platformName) !== null && _j !== void 0 ? _j : (_v.platformName = userAgentInfo.platformName);
|
|
153
|
+
(_k = (_w = this._driverInfo).platformVersion) !== null && _k !== void 0 ? _k : (_w.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 = (_x = this._driverInfo).features) !== null && _o !== void 0 ? _o : (_x.features = {});
|
|
161
|
+
(_p = (_y = this._driverInfo.features).allCookies) !== null && _p !== void 0 ? _p : (_y.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));
|
|
@@ -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
|
+
(_s = (_z = this._driverInfo).orientation) !== null && _s !== void 0 ? _s : (_z.orientation = await this.getOrientation().catch(() => undefined));
|
|
209
|
+
}
|
|
204
210
|
this._logger.log('Combined driver info', this._driverInfo);
|
|
205
211
|
return this;
|
|
206
212
|
}
|
|
@@ -392,7 +398,7 @@ class Driver {
|
|
|
392
398
|
async takeScreenshot() {
|
|
393
399
|
const image = await this._spec.takeScreenshot(this.target);
|
|
394
400
|
if (utils.types.isString(image)) {
|
|
395
|
-
return Buffer.from(image.replace(/[\r\n]+/g, ''));
|
|
401
|
+
return Buffer.from(image.replace(/[\r\n]+/g, ''), 'base64');
|
|
396
402
|
}
|
|
397
403
|
return image;
|
|
398
404
|
}
|
|
@@ -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);
|
package/dist/element.js
CHANGED
|
@@ -289,6 +289,7 @@ class Element {
|
|
|
289
289
|
if (this.driver.isAndroid) {
|
|
290
290
|
remainingOffset = utils.geometry.scale(remainingOffset, this.driver.pixelRatio);
|
|
291
291
|
}
|
|
292
|
+
const actions = [];
|
|
292
293
|
const touchPadding = await this.getTouchPadding();
|
|
293
294
|
const xPadding = Math.max(Math.floor(effectiveRegion.width * 0.1), touchPadding);
|
|
294
295
|
const yTrack = Math.floor(effectiveRegion.y + effectiveRegion.height / 2); // center
|
|
@@ -299,7 +300,7 @@ class Element {
|
|
|
299
300
|
while (xRemaining > 0) {
|
|
300
301
|
const xRight = effectiveRegion.x + Math.min(xRemaining + xPadding, effectiveRegion.width - xPadding);
|
|
301
302
|
const [xStart, xEnd] = xDirection === 'right' ? [xRight, xLeft] : [xLeft, xRight];
|
|
302
|
-
|
|
303
|
+
actions.push([
|
|
303
304
|
{ action: 'press', y: yTrack, x: xStart },
|
|
304
305
|
{ action: 'wait', ms: 100 },
|
|
305
306
|
{ action: 'moveTo', y: yTrack, x: xStart + xGap },
|
|
@@ -320,7 +321,7 @@ class Element {
|
|
|
320
321
|
while (yRemaining > 0) {
|
|
321
322
|
const yTop = Math.max(yBottom - yRemaining, effectiveRegion.y + yPadding);
|
|
322
323
|
const [yStart, yEnd] = yDirection === 'down' ? [yBottom, yTop] : [yTop, yBottom];
|
|
323
|
-
|
|
324
|
+
actions.push([
|
|
324
325
|
{ action: 'press', x: xTrack, y: yStart },
|
|
325
326
|
{ action: 'wait', ms: 100 },
|
|
326
327
|
{ action: 'moveTo', x: xTrack, y: yStart + yGap },
|
|
@@ -332,6 +333,15 @@ class Element {
|
|
|
332
333
|
]);
|
|
333
334
|
yRemaining -= yBottom - yTop;
|
|
334
335
|
}
|
|
336
|
+
// ios actions should be executed one-by-one sequentially, otherwise the result isn't stable
|
|
337
|
+
if (this.driver.isIOS) {
|
|
338
|
+
for (const action of actions) {
|
|
339
|
+
await this._spec.performAction(this.driver.target, action);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
await this._spec.performAction(this.driver.target, [].concat(...actions));
|
|
344
|
+
}
|
|
335
345
|
const actualScrollableRegion = await this.getClientRegion();
|
|
336
346
|
this._state.scrollOffset = utils.geometry.offsetNegative(requiredOffset, {
|
|
337
347
|
x: scrollableRegion.x - actualScrollableRegion.x,
|
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.7",
|
|
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.12",
|
|
77
|
+
"@applitools/types": "1.0.23",
|
|
78
|
+
"@applitools/utils": "1.2.5"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@applitools/sdk-release-kit": "0.13.4",
|
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>;
|