@applitools/driver 1.8.11 → 1.8.14

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 CHANGED
@@ -211,7 +211,7 @@ class Context {
211
211
  context = await context.context(contextSelector);
212
212
  await context.focus();
213
213
  }
214
- catch (_b) {
214
+ catch {
215
215
  return null;
216
216
  }
217
217
  }
@@ -294,7 +294,7 @@ class Context {
294
294
  const root = await this.root(selector);
295
295
  if (!root)
296
296
  return null;
297
- options = Object.assign({ state: 'exist', timeout: 10000, interval: 500 }, options);
297
+ options = { state: 'exist', timeout: 10000, interval: 500, ...options };
298
298
  if (this._spec.waitForSelector) {
299
299
  const element = await this._spec.waitForSelector(root.context.target, specUtils.transformSelector(this._spec, root.selector, this.driver), (_a = root.shadow) === null || _a === void 0 ? void 0 : _a.target, options);
300
300
  return element
@@ -480,8 +480,8 @@ class Context {
480
480
  // const contextScrollingRegion = await currentContext.getScrollingRegion()
481
481
  const parentContextInnerOffset = (_b = (await ((_a = currentContext.parent) === null || _a === void 0 ? void 0 : _a.getInnerOffset()))) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
482
482
  // TODO revisit
483
- if ((utils.geometry.contains(contextRegion, region) || !currentContext.isMain) &&
484
- !utils.geometry.equals(contextRegion, region)) {
483
+ if (this.driver.isWeb ||
484
+ (!utils.geometry.equals(contextRegion, region) && utils.geometry.contains(contextRegion, region))) {
485
485
  this._logger.log('Intersecting context region', contextRegion, 'with context region', region);
486
486
  region = utils.geometry.intersect(contextRegion, utils.geometry.offset(region, contextRegion));
487
487
  // region = utils.geometry.intersect(contextScrollingRegion, region)
@@ -144,7 +144,7 @@ async function checkSpecDriver(options) {
144
144
  for (const [test, check] of Object.entries(tests)) {
145
145
  try {
146
146
  const result = (await check()) || { success: true };
147
- report.push(Object.assign({ test }, result));
147
+ report.push({ test, ...result });
148
148
  }
149
149
  catch (error) {
150
150
  report.push({ test, error: { message: error.message, expected: error.expected, actual: error.actual } });
package/dist/driver.js CHANGED
@@ -150,7 +150,7 @@ class Driver {
150
150
  this._logger.log('Driver capabilities', capabilities);
151
151
  const capabilitiesInfo = capabilities ? (0, capabilities_1.parseCapabilities)(capabilities, this._customConfig) : undefined;
152
152
  const driverInfo = await ((_d = (_c = this._spec).getDriverInfo) === null || _d === void 0 ? void 0 : _d.call(_c, this.target));
153
- this._driverInfo = Object.assign(Object.assign({}, capabilitiesInfo), driverInfo);
153
+ this._driverInfo = { ...capabilitiesInfo, ...driverInfo };
154
154
  if (this.isWeb) {
155
155
  (_e = (_w = this._driverInfo).pixelRatio) !== null && _e !== void 0 ? _e : (_w.pixelRatio = await this.execute(snippets.getPixelRatio));
156
156
  (_f = (_x = this._driverInfo).viewportScale) !== null && _f !== void 0 ? _f : (_x.viewportScale = await this.execute(snippets.getViewportScale));
@@ -209,7 +209,7 @@ class Driver {
209
209
  }
210
210
  // calculate safe area
211
211
  if (this.isIOS && !this._driverInfo.safeArea) {
212
- this._driverInfo.safeArea = Object.assign({ x: 0, y: 0 }, displaySize);
212
+ this._driverInfo.safeArea = { x: 0, y: 0, ...displaySize };
213
213
  const topElement = await this.element({ type: '-ios class chain', selector: '**/XCUIElementTypeNavigationBar' });
214
214
  if (topElement) {
215
215
  const topRegion = await this._spec.getElementRegion(this.target, topElement.target);
package/dist/element.js CHANGED
@@ -22,17 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
25
  Object.defineProperty(exports, "__esModule", { value: true });
37
26
  exports.Element = void 0;
38
27
  const utils = __importStar(require("@applitools/utils"));
@@ -177,7 +166,7 @@ class Element {
177
166
  else {
178
167
  this._logger.log('Extracting content size of native element with selector', this.selector);
179
168
  try {
180
- const _d = await this.getAttribute('contentSize')
169
+ const { touchPadding, ...contentRegion } = await this.getAttribute('contentSize')
181
170
  .then(data => {
182
171
  const contentSize = JSON.parse(data);
183
172
  return {
@@ -191,7 +180,7 @@ class Element {
191
180
  .catch(err => {
192
181
  this._logger.log(`Unable to get the attribute 'contentSize' when looking up touchPadding due to the following error:`, `'${err.message}'`);
193
182
  return this._spec.getElementRegion(this.driver.target, this.target);
194
- }), { touchPadding } = _d, contentRegion = __rest(_d, ["touchPadding"]);
183
+ });
195
184
  this._logger.log('Extracted native content size attribute', contentRegion);
196
185
  const contentSize = await ((_a = this.driver.helper) === null || _a === void 0 ? void 0 : _a.getContentSize(this));
197
186
  this._logger.log('Extracted native content size with helper library', contentSize);
@@ -31,7 +31,7 @@ class MockDriver {
31
31
  this._window = {
32
32
  title: 'Default Page Title',
33
33
  url: 'http://default.url',
34
- rect: Object.assign({ x: 0, y: 0 }, viewport),
34
+ rect: { x: 0, y: 0, ...viewport },
35
35
  };
36
36
  this._methods = new Map();
37
37
  this._scripts = new Map();
@@ -169,7 +169,16 @@ class MockDriver {
169
169
  this._scripts.set(String(scriptMatcher), resultGenerator);
170
170
  }
171
171
  mockElement(selector, state) {
172
- const element = Object.assign({ id: Symbol('elementId' + Math.floor(Math.random() * 100)), attrs: {}, style: {}, selector, parentId: null, parentContextId: null, parentRootId: null }, state);
172
+ const element = {
173
+ id: Symbol('elementId' + Math.floor(Math.random() * 100)),
174
+ attrs: {},
175
+ style: {},
176
+ selector,
177
+ parentId: null,
178
+ parentContextId: null,
179
+ parentRootId: null,
180
+ ...state,
181
+ };
173
182
  if (element.shadow) {
174
183
  element.shadowRootId = Symbol('shadowId' + (element.name || Math.floor(Math.random() * 100)));
175
184
  }
@@ -198,7 +207,7 @@ class MockDriver {
198
207
  }
199
208
  mockElements(nodes, { parentId = null, parentContextId = null, parentRootId = null } = {}) {
200
209
  for (const node of nodes) {
201
- const element = this.mockElement(node.selector, Object.assign(Object.assign({}, node), { parentId, parentContextId, parentRootId }));
210
+ const element = this.mockElement(node.selector, { ...node, parentId, parentContextId, parentRootId });
202
211
  if (node.children) {
203
212
  this.mockElements(node.children, {
204
213
  parentId: element.frame ? null : element.id,
@@ -55,7 +55,10 @@ const BROWSER_VERSION_REGEX = new RegExp(`(?:Version/${MAJOR_MINOR})`);
55
55
  function parseUserAgent(userAgent) {
56
56
  utils.guard.notNull(userAgent, { name: 'userAgent' });
57
57
  userAgent = userAgent.trim();
58
- return Object.assign(Object.assign({}, parsePlatform(userAgent)), parseBrowser(userAgent));
58
+ return {
59
+ ...parsePlatform(userAgent),
60
+ ...parseBrowser(userAgent),
61
+ };
59
62
  }
60
63
  exports.parseUserAgent = parseUserAgent;
61
64
  function parsePlatform(userAgent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.8.11",
3
+ "version": "1.8.14",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",
@@ -24,26 +24,26 @@
24
24
  "name": "Applitools Team",
25
25
  "email": "team@applitools.com"
26
26
  },
27
- "main": "./dist/index.js",
28
- "types": "./types/index.d.ts",
29
27
  "exports": {
30
28
  ".": {
31
- "default": "./dist/index.js",
32
- "types": "./types/index.d.ts"
29
+ "types": "./types/index.d.ts",
30
+ "default": "./dist/index.js"
33
31
  },
34
32
  "./fake": {
35
- "default": "./dist/fake/index.js",
36
- "types": "./types/fake/index.d.ts"
33
+ "types": "./types/fake/index.d.ts",
34
+ "default": "./dist/fake/index.js"
37
35
  },
38
36
  "./debug": {
39
- "default": "./dist/debug/index.js",
40
- "types": "./types/debug/index.d.ts"
37
+ "types": "./types/debug/index.d.ts",
38
+ "default": "./dist/debug/index.js"
41
39
  },
42
40
  "./dist/*": "./dist/*.js",
43
41
  "./dist/fake": "./dist/fake/index.js",
44
42
  "./dist/debug": "./dist/debug/index.js",
45
43
  "./package.json": "./package.json"
46
44
  },
45
+ "main": "./dist/index.js",
46
+ "types": "./types/index.d.ts",
47
47
  "typesVersions": {
48
48
  "*": {
49
49
  "fake": [
@@ -73,13 +73,13 @@
73
73
  }
74
74
  },
75
75
  "dependencies": {
76
- "@applitools/logger": "1.1.5",
76
+ "@applitools/logger": "1.1.6",
77
77
  "@applitools/snippets": "2.2.3",
78
- "@applitools/types": "1.4.3",
79
- "@applitools/utils": "1.3.0"
78
+ "@applitools/types": "1.4.4",
79
+ "@applitools/utils": "1.3.1"
80
80
  },
81
81
  "devDependencies": {
82
- "@applitools/bongo": "^2.1.0",
82
+ "@applitools/bongo": "^2.1.1",
83
83
  "@types/mocha": "^9.1.1",
84
84
  "@types/node": "^17.0.31",
85
85
  "@typescript-eslint/eslint-plugin": "^5.22.0",
@@ -96,6 +96,6 @@
96
96
  "typescript": "^4.6.4"
97
97
  },
98
98
  "engines": {
99
- "node": ">= 8.9.0"
99
+ "node": ">=12.13.0"
100
100
  }
101
101
  }
@@ -2,19 +2,4 @@ import type { SpecDriver } from '@applitools/types';
2
2
  export declare function checkSpecDriver<TDriver, TContext, TElement, TSelector>(options: {
3
3
  spec: SpecDriver<TDriver, TContext, TElement, TSelector>;
4
4
  driver: TDriver;
5
- }): Promise<({
6
- skipped: boolean;
7
- test: string;
8
- error?: undefined;
9
- } | {
10
- success: boolean;
11
- test: string;
12
- error?: undefined;
13
- } | {
14
- test: string;
15
- error: {
16
- message: any;
17
- expected: any;
18
- actual: any;
19
- };
20
- })[]>;
5
+ }): Promise<any[]>;