@applitools/driver 1.14.1 → 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,39 @@
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
+
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)
11
+
12
+
13
+ ### Code Refactoring
14
+
15
+ * use Uint8Array instead of Buffer for binary data representation ([#1928](https://github.com/applitools/eyes.sdk.javascript1/issues/1928)) ([d1472ab](https://github.com/applitools/eyes.sdk.javascript1/commit/d1472ab8fd49e9a240e99a44dbf1d180b6c7a54b))
16
+
17
+
18
+ ### Dependencies
19
+
20
+ * @applitools/utils bumped to 1.6.1
21
+ #### Bug Fixes
22
+
23
+ * add browser entry point declaration and test ([#1933](https://github.com/applitools/eyes.sdk.javascript1/issues/1933)) ([5ba0720](https://github.com/applitools/eyes.sdk.javascript1/commit/5ba0720d62a9af8a9a2e1c2437c569e6ab19afd8))
24
+
25
+
26
+ #### Code Refactoring
27
+
28
+ * use Uint8Array instead of Buffer for binary data representation ([#1928](https://github.com/applitools/eyes.sdk.javascript1/issues/1928)) ([d1472ab](https://github.com/applitools/eyes.sdk.javascript1/commit/d1472ab8fd49e9a240e99a44dbf1d180b6c7a54b))
29
+ * @applitools/logger bumped to 2.0.11
30
+ #### Bug Fixes
31
+
32
+ * add browser entry point declaration and test ([#1933](https://github.com/applitools/eyes.sdk.javascript1/issues/1933)) ([5ba0720](https://github.com/applitools/eyes.sdk.javascript1/commit/5ba0720d62a9af8a9a2e1c2437c569e6ab19afd8))
33
+
34
+
35
+
36
+
3
37
  ## [1.14.1](https://github.com/applitools/eyes.sdk.javascript1/compare/js/driver@1.14.0...js/driver@1.14.1) (2023-09-21)
4
38
 
5
39
 
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.1",
3
+ "version": "1.14.3",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",
@@ -73,9 +73,9 @@
73
73
  "test": "run --top-level mocha './test/**/*.spec.ts'"
74
74
  },
75
75
  "dependencies": {
76
- "@applitools/logger": "2.0.10",
76
+ "@applitools/logger": "2.0.11",
77
77
  "@applitools/snippets": "2.4.24",
78
- "@applitools/utils": "1.6.0",
78
+ "@applitools/utils": "1.6.1",
79
79
  "semver": "7.5.4"
80
80
  },
81
81
  "devDependencies": {
package/types/driver.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Size, Region } from '@applitools/utils';
3
2
  import type { DriverInfo, Capabilities, UserAgent, Environment, Viewport, Features, ScreenOrientation, Cookie } from './types';
4
3
  import { type Selector } from './selector';
@@ -72,7 +71,7 @@ export declare class Driver<T extends SpecType> {
72
71
  switchToChildContext(...references: ContextReference<T>[]): Promise<Context<T>>;
73
72
  normalizeRegion(region: Region): Promise<Region>;
74
73
  getRegionInViewport(context: Context<T>, region: Region): Promise<Region>;
75
- takeScreenshot(): Promise<Buffer>;
74
+ takeScreenshot(): Promise<Uint8Array>;
76
75
  getViewportSize(): Promise<Size>;
77
76
  setViewportSize(size: Size): Promise<void>;
78
77
  getDisplaySize(): Promise<Size | undefined>;
@@ -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
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Size } from '@applitools/utils';
3
2
  import type { DriverInfo } from '../types';
4
3
  export type Driver = any;
@@ -28,7 +27,7 @@ export declare function getElementText(_driver: Driver, element: Element): Promi
28
27
  export declare function mainContext(driver: Driver): Promise<Driver>;
29
28
  export declare function parentContext(driver: Driver): Promise<Driver>;
30
29
  export declare function childContext(driver: Driver, element: Element): Promise<Driver>;
31
- export declare function takeScreenshot(driver: Driver): Promise<Buffer | string>;
30
+ export declare function takeScreenshot(driver: Driver): Promise<Uint8Array | string>;
32
31
  export declare function getDriverInfo(driver: Driver): Promise<DriverInfo>;
33
32
  export declare function getWindowSize(driver: Driver): Promise<Size>;
34
33
  export declare function setWindowSize(driver: Driver, size: Size): Promise<void>;
@@ -36,4 +35,5 @@ export declare function getOrientation(_driver: Driver): Promise<'portrait' | 'l
36
35
  export declare function getUrl(driver: Driver): Promise<string>;
37
36
  export declare function getTitle(driver: Driver): Promise<string>;
38
37
  export declare function visit(driver: Driver, url: string): Promise<void>;
38
+ export declare function getCurrentWorld(driver: Driver): Promise<any>;
39
39
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Size, Region } from '@applitools/utils';
3
2
  import type { DriverInfo, Capabilities, ScreenOrientation, Cookie } from './types';
4
3
  import { type CommonSelector } from './selector';
@@ -124,7 +123,7 @@ export interface SpecDriver<T extends SpecType> {
124
123
  getUrl?(driver: T['driver']): Promise<string>;
125
124
  visit?(driver: T['driver'], url: string): Promise<void>;
126
125
  performAction?(driver: T['driver'], steps: any[]): Promise<void>;
127
- takeScreenshot(driver: T['driver']): Promise<Buffer | string>;
126
+ takeScreenshot(driver: T['driver']): Promise<Uint8Array | string>;
128
127
  getCurrentWorld?(driver: T['driver']): Promise<string>;
129
128
  getWorlds?(driver: T['driver']): Promise<string[]>;
130
129
  switchWorld?(driver: T['driver'], id: string): Promise<void>;