@applitools/driver 1.7.2 → 1.8.0

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.
@@ -1,26 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseCapabilities = void 0;
4
- function parseCapabilities(capabilities) {
5
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
4
+ function parseCapabilities(capabilities, customConfig) {
5
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
6
6
  if (capabilities.capabilities)
7
7
  capabilities = capabilities.capabilities;
8
+ if (((_a = capabilities.platformName) === null || _a === void 0 ? void 0 : _a.startsWith('android')) && !(customConfig === null || customConfig === void 0 ? void 0 : customConfig.keepPlatformNameAsIs)) {
9
+ capabilities.platformName = capabilities.platformName.charAt(0).toUpperCase() + capabilities.platformName.slice(1);
10
+ }
8
11
  const info = {
9
12
  browserName: !capabilities.app && !capabilities.bundleId
10
- ? ((_a = capabilities.browserName) !== null && _a !== void 0 ? _a : (_b = capabilities.desired) === null || _b === void 0 ? void 0 : _b.browserName) || undefined
13
+ ? ((_b = capabilities.browserName) !== null && _b !== void 0 ? _b : (_c = capabilities.desired) === null || _c === void 0 ? void 0 : _c.browserName) || undefined
11
14
  : undefined,
12
- browserVersion: ((_c = capabilities.browserVersion) !== null && _c !== void 0 ? _c : capabilities.version) || undefined,
13
- platformName: ((_e = (_d = capabilities.platformName) !== null && _d !== void 0 ? _d : capabilities.platform) !== null && _e !== void 0 ? _e : (_f = capabilities.desired) === null || _f === void 0 ? void 0 : _f.platformName) || undefined,
15
+ browserVersion: ((_d = capabilities.browserVersion) !== null && _d !== void 0 ? _d : capabilities.version) || undefined,
16
+ platformName: ((_f = (_e = capabilities.platformName) !== null && _e !== void 0 ? _e : capabilities.platform) !== null && _f !== void 0 ? _f : (_g = capabilities.desired) === null || _g === void 0 ? void 0 : _g.platformName) || undefined,
14
17
  platformVersion: capabilities.platformVersion || undefined,
15
18
  isW3C: isW3C(capabilities),
16
19
  isMobile: isMobile(capabilities),
17
20
  };
18
21
  if (info.isMobile) {
19
- info.deviceName = ((_h = (_g = capabilities.desired) === null || _g === void 0 ? void 0 : _g.deviceName) !== null && _h !== void 0 ? _h : capabilities.deviceName) || undefined;
22
+ info.deviceName = ((_j = (_h = capabilities.desired) === null || _h === void 0 ? void 0 : _h.deviceName) !== null && _j !== void 0 ? _j : capabilities.deviceName) || undefined;
20
23
  info.isNative = info.isMobile && !info.browserName;
21
24
  info.isIOS = isIOS(capabilities);
22
25
  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();
26
+ info.orientation = (_l = ((_k = capabilities.deviceOrientation) !== null && _k !== void 0 ? _k : capabilities.orientation)) === null || _l === void 0 ? void 0 : _l.toLowerCase();
24
27
  }
25
28
  if (info.isNative) {
26
29
  info.pixelRatio = capabilities.pixelRatio;
package/dist/driver.js CHANGED
@@ -144,7 +144,7 @@ class Driver {
144
144
  var _w, _x, _y, _z, _0, _1, _2, _3;
145
145
  const capabilities = await ((_b = (_a = this._spec).getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a, this.target));
146
146
  this._logger.log('Driver capabilities', capabilities);
147
- const capabilitiesInfo = capabilities ? capabilities_1.parseCapabilities(capabilities) : undefined;
147
+ const capabilitiesInfo = capabilities ? capabilities_1.parseCapabilities(capabilities, this._customConfig) : undefined;
148
148
  const driverInfo = await ((_d = (_c = this._spec).getDriverInfo) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));
149
149
  this._driverInfo = Object.assign(Object.assign({}, capabilitiesInfo), driverInfo);
150
150
  if (this.isWeb) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
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.2",
77
+ "@applitools/types": "1.4.0",
78
78
  "@applitools/utils": "1.2.14"
79
79
  },
80
80
  "devDependencies": {
@@ -1,4 +1,4 @@
1
1
  import type * as types from '@applitools/types';
2
2
  declare type Capabilities = Record<string, any>;
3
- export declare function parseCapabilities(capabilities: Capabilities): types.DriverInfo;
3
+ export declare function parseCapabilities(capabilities: Capabilities, customConfig?: types.CustomCapabilitiesConfig): types.DriverInfo;
4
4
  export {};
package/types/driver.d.ts CHANGED
@@ -17,7 +17,7 @@ export declare class Driver<TDriver, TContext, TElement, TSelector> {
17
17
  spec: types.SpecDriver<TDriver, TContext, TElement, TSelector>;
18
18
  driver: Driver<TDriver, TContext, TElement, TSelector> | TDriver;
19
19
  logger?: any;
20
- customConfig?: any;
20
+ customConfig?: types.CustomDriverConfig;
21
21
  });
22
22
  get target(): TDriver;
23
23
  get currentContext(): Context<TDriver, TContext, TElement, TSelector>;