@applitools/driver 1.14.2 → 1.14.3

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.14.3](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.14.2...js/driver@1.14.3) (2023-09-29)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * force native on get environment ([#1939](https://github.com/applitools/eyes.sdk.javascript1/issues/1939)) ([f42854e](https://github.com/applitools/eyes.sdk.javascript1/commit/f42854eacc769751447204143cb4d50113edc732))
9
+
3
10
  ## [1.14.2](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.14.1...js/driver@1.14.2) (2023-09-25)
4
11
 
5
12
 
package/dist/driver.js CHANGED
@@ -220,9 +220,10 @@ class Driver {
220
220
  const capabilitiesEnvironment = capabilities ? (0, capabilities_1.extractCapabilitiesEnvironment)(capabilities) : null;
221
221
  this._logger.log('Extracted capabilities environment', capabilitiesEnvironment);
222
222
  this._environment = { ...this._environment, ...capabilitiesEnvironment };
223
- if (this._environment.isMobile && !this._environment.browserName) {
223
+ if (this._environment.isMobile) {
224
224
  const world = await this.getCurrentWorld();
225
- if (!!(world === null || world === void 0 ? void 0 : world.includes('WEBVIEW'))) {
225
+ this._environment.isNative = world === 'NATIVE_APP';
226
+ if (!!(world === null || world === void 0 ? void 0 : world.includes('WEBVIEW')) && !this._environment.browserName) {
226
227
  this._environment.isNative = true;
227
228
  this._environment.isWeb = true;
228
229
  }
@@ -362,5 +362,8 @@ class MockDriver {
362
362
  [inspect.custom]() {
363
363
  return '<MockDriver>';
364
364
  }
365
+ async getCurrentWorld() {
366
+ return this.environment.isNative ? 'NATIVE_APP' : 'WEBVIEW_1';
367
+ }
365
368
  }
366
369
  exports.MockDriver = MockDriver;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.visit = exports.getTitle = exports.getUrl = exports.getOrientation = exports.setWindowSize = exports.getWindowSize = exports.getDriverInfo = exports.takeScreenshot = exports.childContext = exports.parentContext = exports.mainContext = exports.getElementText = exports.findElements = exports.findElement = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.extractSelector = exports.toSimpleCommonSelector = exports.toSelector = exports.isSelector = exports.isElement = exports.isDriver = void 0;
26
+ exports.getCurrentWorld = exports.visit = exports.getTitle = exports.getUrl = exports.getOrientation = exports.setWindowSize = exports.getWindowSize = exports.getDriverInfo = exports.takeScreenshot = exports.childContext = exports.parentContext = exports.mainContext = exports.getElementText = exports.findElements = exports.findElement = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.extractSelector = exports.toSimpleCommonSelector = exports.toSelector = exports.isSelector = exports.isElement = exports.isDriver = void 0;
27
27
  const utils = __importStar(require("@applitools/utils"));
28
28
  function isDriver(driver) {
29
29
  return driver && driver.constructor.name === 'MockDriver';
@@ -137,3 +137,7 @@ async function visit(driver, url) {
137
137
  await driver.visit(url);
138
138
  }
139
139
  exports.visit = visit;
140
+ async function getCurrentWorld(driver) {
141
+ return driver.getCurrentWorld();
142
+ }
143
+ exports.getCurrentWorld = getCurrentWorld;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.14.2",
3
+ "version": "1.14.3",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",
@@ -36,4 +36,5 @@ export declare class MockDriver {
36
36
  takeScreenshot(): Promise<unknown>;
37
37
  toString(): string;
38
38
  toJSON(): string;
39
+ getCurrentWorld(): Promise<"NATIVE_APP" | "WEBVIEW_1">;
39
40
  }
@@ -35,4 +35,5 @@ export declare function getOrientation(_driver: Driver): Promise<'portrait' | 'l
35
35
  export declare function getUrl(driver: Driver): Promise<string>;
36
36
  export declare function getTitle(driver: Driver): Promise<string>;
37
37
  export declare function visit(driver: Driver, url: string): Promise<void>;
38
+ export declare function getCurrentWorld(driver: Driver): Promise<any>;
38
39
  export {};