@applitools/driver 1.9.20 → 1.9.23
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/context.js +8 -8
- package/dist/driver.js +19 -17
- package/dist/fake/mock-driver.js +1 -1
- package/dist/fake/spec-driver.js +5 -1
- package/package.json +3 -3
- package/types/context.d.ts +1 -1
package/dist/context.js
CHANGED
|
@@ -258,16 +258,13 @@ class Context {
|
|
|
258
258
|
throw new TypeError('Cannot find element using argument of unknown type!');
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
async elements(
|
|
262
|
-
if (this._spec
|
|
263
|
-
return [new element_1.Element({ spec: this._spec, context: this, element: elementOrSelector, logger: this._logger })];
|
|
264
|
-
}
|
|
265
|
-
else if (specUtils.isSelector(this._spec, elementOrSelector)) {
|
|
261
|
+
async elements(selectorOrElement) {
|
|
262
|
+
if (specUtils.isSelector(this._spec, selectorOrElement)) {
|
|
266
263
|
if (this.isRef) {
|
|
267
|
-
return [new element_1.Element({ spec: this._spec, context: this, selector:
|
|
264
|
+
return [new element_1.Element({ spec: this._spec, context: this, selector: selectorOrElement, logger: this._logger })];
|
|
268
265
|
}
|
|
269
|
-
this._logger.log('Finding elements by selector: ',
|
|
270
|
-
const root = await this.root(
|
|
266
|
+
this._logger.log('Finding elements by selector: ', selectorOrElement);
|
|
267
|
+
const root = await this.root(selectorOrElement);
|
|
271
268
|
if (!root)
|
|
272
269
|
return [];
|
|
273
270
|
const elements = await this._spec.findElements(root.context.target, specUtils.transformSelector(this._spec, root.selector, this.driver), root.shadow && (await root.shadow.getShadowRoot()));
|
|
@@ -283,6 +280,9 @@ class Context {
|
|
|
283
280
|
});
|
|
284
281
|
});
|
|
285
282
|
}
|
|
283
|
+
else if (this._spec.isElement(selectorOrElement)) {
|
|
284
|
+
return [new element_1.Element({ spec: this._spec, context: this, element: selectorOrElement, logger: this._logger })];
|
|
285
|
+
}
|
|
286
286
|
else {
|
|
287
287
|
throw new TypeError('Cannot find elements using argument of unknown type!');
|
|
288
288
|
}
|
package/dist/driver.js
CHANGED
|
@@ -144,8 +144,8 @@ 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;
|
|
148
|
-
var
|
|
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 _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
|
|
149
149
|
const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
|
|
150
150
|
this._logger.log('Driver capabilities', capabilities);
|
|
151
151
|
const capabilitiesInfo = capabilities ? (0, capabilities_1.parseCapabilities)(capabilities, this._customConfig) : undefined;
|
|
@@ -156,29 +156,29 @@ class Driver {
|
|
|
156
156
|
(_e = (await this.getOrientation().catch(() => undefined))) !== null && _e !== void 0 ? _e : this._driverInfo.orientation;
|
|
157
157
|
}
|
|
158
158
|
if (this.isWeb) {
|
|
159
|
-
(_f = (
|
|
160
|
-
(_g = (
|
|
161
|
-
(_h = (
|
|
159
|
+
(_f = (_4 = this._driverInfo).pixelRatio) !== null && _f !== void 0 ? _f : (_4.pixelRatio = await this.execute(snippets.getPixelRatio));
|
|
160
|
+
(_g = (_5 = this._driverInfo).viewportScale) !== null && _g !== void 0 ? _g : (_5.viewportScale = await this.execute(snippets.getViewportScale));
|
|
161
|
+
(_h = (_6 = this._driverInfo).userAgent) !== null && _h !== void 0 ? _h : (_6.userAgent = await this.execute(snippets.getUserAgent));
|
|
162
162
|
if (this._driverInfo.userAgent) {
|
|
163
163
|
const userAgentInfo = (0, user_agent_1.parseUserAgent)(this._driverInfo.userAgent);
|
|
164
164
|
this._driverInfo.browserName = (_j = userAgentInfo.browserName) !== null && _j !== void 0 ? _j : this._driverInfo.browserName;
|
|
165
165
|
this._driverInfo.browserVersion = (_k = userAgentInfo.browserVersion) !== null && _k !== void 0 ? _k : this._driverInfo.browserVersion;
|
|
166
166
|
if (this._driverInfo.isMobile) {
|
|
167
|
-
(_l = (
|
|
168
|
-
(_m = (
|
|
167
|
+
(_l = (_7 = this._driverInfo).platformName) !== null && _l !== void 0 ? _l : (_7.platformName = userAgentInfo.platformName);
|
|
168
|
+
(_m = (_8 = this._driverInfo).platformVersion) !== null && _m !== void 0 ? _m : (_8.platformVersion = userAgentInfo.platformVersion);
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
171
171
|
this._driverInfo.platformName = (_o = userAgentInfo.platformName) !== null && _o !== void 0 ? _o : this._driverInfo.platformName;
|
|
172
172
|
this._driverInfo.platformVersion = (_p = userAgentInfo.platformVersion) !== null && _p !== void 0 ? _p : this._driverInfo.platformVersion;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
(_q = (
|
|
176
|
-
(_r = (
|
|
175
|
+
(_q = (_9 = this._driverInfo).features) !== null && _q !== void 0 ? _q : (_9.features = {});
|
|
176
|
+
(_r = (_10 = this._driverInfo.features).allCookies) !== null && _r !== void 0 ? _r : (_10.allCookies = /chrome/i.test(this._driverInfo.browserName) && !this._driverInfo.isMobile);
|
|
177
177
|
}
|
|
178
178
|
else {
|
|
179
179
|
// this value always excludes the height of the navigation bar, and sometimes it also excludes the height of the status bar
|
|
180
180
|
let windowSize = await this._spec.getWindowSize(this.target);
|
|
181
|
-
(_s = (
|
|
181
|
+
(_s = (_11 = this._driverInfo).displaySize) !== null && _s !== void 0 ? _s : (_11.displaySize = windowSize);
|
|
182
182
|
if (((_t = this.orientation) === null || _t === void 0 ? void 0 : _t.startsWith('landscape')) &&
|
|
183
183
|
this._driverInfo.displaySize.height > this._driverInfo.displaySize.width) {
|
|
184
184
|
this._driverInfo.displaySize = {
|
|
@@ -215,17 +215,17 @@ class Driver {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
// bar sizes have to be scaled on android
|
|
218
|
-
(
|
|
219
|
-
(
|
|
218
|
+
(_12 = this._driverInfo).statusBarSize && (_12.statusBarSize = this._driverInfo.statusBarSize / this.pixelRatio);
|
|
219
|
+
(_13 = this._driverInfo).navigationBarSize && (_13.navigationBarSize = this._driverInfo.navigationBarSize / this.pixelRatio);
|
|
220
220
|
windowSize = utils.geometry.scale(windowSize, 1 / this.pixelRatio);
|
|
221
|
-
(
|
|
221
|
+
(_14 = this._driverInfo).displaySize && (_14.displaySize = utils.geometry.scale(this._driverInfo.displaySize, 1 / this.pixelRatio));
|
|
222
222
|
}
|
|
223
223
|
if (this.isIOS) {
|
|
224
224
|
if ((_0 = this.orientation) === null || _0 === void 0 ? void 0 : _0.startsWith('landscape'))
|
|
225
225
|
this._driverInfo.statusBarSize = 0;
|
|
226
226
|
}
|
|
227
227
|
// calculate viewport location
|
|
228
|
-
(_1 = (
|
|
228
|
+
(_1 = (_15 = this._driverInfo).viewportLocation) !== null && _1 !== void 0 ? _1 : (_15.viewportLocation = {
|
|
229
229
|
x: this.orientation === 'landscape' ? this.navigationBarSize : 0,
|
|
230
230
|
y: this.statusBarSize,
|
|
231
231
|
});
|
|
@@ -256,9 +256,11 @@ class Driver {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
// init helper lib
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
if (!((_3 = this._customConfig) === null || _3 === void 0 ? void 0 : _3.disableHelper)) {
|
|
260
|
+
this._helper = this.isIOS
|
|
261
|
+
? await helper_ios_1.HelperIOS.make({ spec: this._spec, driver: this, logger: this._logger })
|
|
262
|
+
: await helper_android_1.HelperAndroid.make({ spec: this._spec, driver: this, logger: this._logger });
|
|
263
|
+
}
|
|
262
264
|
}
|
|
263
265
|
this._logger.log('Combined driver info', this._driverInfo);
|
|
264
266
|
return this;
|
package/dist/fake/mock-driver.js
CHANGED
|
@@ -273,7 +273,7 @@ class MockDriver {
|
|
|
273
273
|
: null;
|
|
274
274
|
}
|
|
275
275
|
async findElements(selector, rootElement) {
|
|
276
|
-
const elements = this._elements.get(selector);
|
|
276
|
+
const elements = this._elements.get(typeof selector === 'string' ? selector : selector.id);
|
|
277
277
|
return elements
|
|
278
278
|
? elements.filter(element => element.parentContextId === this._contextId &&
|
|
279
279
|
element.parentRootId === ((rootElement || {}).shadowRootId || null))
|
package/dist/fake/spec-driver.js
CHANGED
|
@@ -30,11 +30,15 @@ function isDriver(driver) {
|
|
|
30
30
|
}
|
|
31
31
|
exports.isDriver = isDriver;
|
|
32
32
|
function isElement(element) {
|
|
33
|
+
if ((element === null || element === void 0 ? void 0 : element.notting) === true)
|
|
34
|
+
return false;
|
|
33
35
|
return utils.types.has(element, 'id');
|
|
34
36
|
}
|
|
35
37
|
exports.isElement = isElement;
|
|
36
38
|
function isSelector(selector) {
|
|
37
|
-
|
|
39
|
+
if ((selector === null || selector === void 0 ? void 0 : selector.notting) === true)
|
|
40
|
+
return false;
|
|
41
|
+
return (utils.types.isString(selector) || utils.types.has(selector, ['using', 'value']) || (selector === null || selector === void 0 ? void 0 : selector.forceSelector) === true);
|
|
38
42
|
}
|
|
39
43
|
exports.isSelector = isSelector;
|
|
40
44
|
function transformSelector(selector) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.23",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -78,9 +78,9 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@applitools/logger": "1.1.
|
|
81
|
+
"@applitools/logger": "1.1.16",
|
|
82
82
|
"@applitools/snippets": "2.4.5",
|
|
83
|
-
"@applitools/types": "1.5.
|
|
83
|
+
"@applitools/types": "1.5.9",
|
|
84
84
|
"@applitools/utils": "1.3.10"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
package/types/context.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare class Context<TDriver, TContext, TElement, TSelector> {
|
|
|
54
54
|
selector: types.Selector<TSelector>;
|
|
55
55
|
}>;
|
|
56
56
|
element(elementOrSelector: TElement | types.Selector<TSelector>): Promise<Element<TDriver, TContext, TElement, TSelector>>;
|
|
57
|
-
elements(
|
|
57
|
+
elements(selectorOrElement: types.Selector<TSelector> | TElement): Promise<Element<TDriver, TContext, TElement, TSelector>[]>;
|
|
58
58
|
waitFor(selector: types.Selector<TSelector>, options?: types.WaitOptions): Promise<Element<TDriver, TContext, TElement, TSelector>>;
|
|
59
59
|
execute(script: ((args: any) => any) | string, arg?: any): Promise<any>;
|
|
60
60
|
getContextElement(): Promise<Element<TDriver, TContext, TElement, TSelector>>;
|