@applitools/driver 1.5.4 → 1.5.7

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/driver.js CHANGED
@@ -122,10 +122,12 @@ class Driver {
122
122
  return (_b = (_a = this._driverInfo) === null || _a === void 0 ? void 0 : _a.isMobile) !== null && _b !== void 0 ? _b : false;
123
123
  }
124
124
  get isIOS() {
125
- return this.platformName === 'iOS';
125
+ var _a;
126
+ return ((_a = this.platformName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'ios';
126
127
  }
127
128
  get isAndroid() {
128
- return this.platformName === 'Android';
129
+ var _a;
130
+ return ((_a = this.platformName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'android';
129
131
  }
130
132
  get isIE() {
131
133
  return /(internet explorer|ie)/i.test(this.browserName);
@@ -376,11 +378,13 @@ class Driver {
376
378
  }
377
379
  return this.currentContext;
378
380
  }
379
- async normalizeRegion(region) {
381
+ async normalizeRegion(region, shouldIgnoreSafeRegion) {
380
382
  if (this.isWeb || !utils.types.has(this._driverInfo, ['viewportSize', 'statusBarHeight']))
381
383
  return region;
382
384
  const scaledRegion = this.isAndroid ? utils.geometry.scale(region, 1 / this.pixelRatio) : region;
383
- const safeRegion = this.isIOS ? utils.geometry.intersect(scaledRegion, this._driverInfo.safeArea) : scaledRegion;
385
+ const safeRegion = this.isIOS && !shouldIgnoreSafeRegion
386
+ ? utils.geometry.intersect(scaledRegion, this._driverInfo.safeArea)
387
+ : scaledRegion;
384
388
  const offsetRegion = utils.geometry.offsetNegative(safeRegion, { x: 0, y: this.statusBarHeight });
385
389
  if (offsetRegion.y < 0) {
386
390
  offsetRegion.height += offsetRegion.y;
package/dist/element.js CHANGED
@@ -49,8 +49,11 @@ class Element {
49
49
  let elementToUse = options.element;
50
50
  if (options.root) {
51
51
  elementToUse = options.root;
52
+ this._target = elementToUse;
53
+ }
54
+ else {
55
+ this._target = (_c = (_b = (_a = this._spec).transformElement) === null || _b === void 0 ? void 0 : _b.call(_a, elementToUse)) !== null && _c !== void 0 ? _c : elementToUse;
52
56
  }
53
- this._target = (_c = (_b = (_a = this._spec).transformElement) === null || _b === void 0 ? void 0 : _b.call(_a, elementToUse)) !== null && _c !== void 0 ? _c : elementToUse;
54
57
  // Some frameworks contains information about the selector inside an element
55
58
  this._selector = (_d = options.selector) !== null && _d !== void 0 ? _d : (_f = (_e = this._spec).extractSelector) === null || _f === void 0 ? void 0 : _f.call(_e, elementToUse);
56
59
  this._index = options.index;
@@ -103,7 +106,7 @@ class Element {
103
106
  return this;
104
107
  }
105
108
  }
106
- async getRegion() {
109
+ async getRegion(shouldIgnoreSafeRegion) {
107
110
  const region = await this.withRefresh(async () => {
108
111
  if (this.driver.isWeb) {
109
112
  this._logger.log('Extracting region of web element with selector', this.selector);
@@ -113,7 +116,7 @@ class Element {
113
116
  this._logger.log('Extracting region of native element with selector', this.selector);
114
117
  const region = await this._spec.getElementRegion(this.driver.target, this.target);
115
118
  this._logger.log('Extracted native region', region);
116
- return this.driver.normalizeRegion(region);
119
+ return this.driver.normalizeRegion(region, shouldIgnoreSafeRegion);
117
120
  }
118
121
  });
119
122
  this._logger.log('Extracted region', region);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.5.4",
3
+ "version": "1.5.7",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",
@@ -74,11 +74,11 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@applitools/snippets": "2.2.2",
77
- "@applitools/types": "1.2.2",
77
+ "@applitools/types": "1.3.0",
78
78
  "@applitools/utils": "1.2.13"
79
79
  },
80
80
  "devDependencies": {
81
- "@applitools/sdk-release-kit": "0.13.11",
81
+ "@applitools/bongo": "^2.0.0",
82
82
  "@types/mocha": "^9.0.0",
83
83
  "@types/node": "^16.3.3",
84
84
  "@typescript-eslint/eslint-plugin": "^4.28.3",
package/types/driver.d.ts CHANGED
@@ -50,7 +50,7 @@ export declare class Driver<TDriver, TContext, TElement, TSelector> {
50
50
  switchToMainContext(): Promise<Context<TDriver, TContext, TElement, TSelector>>;
51
51
  switchToParentContext(elevation?: number): Promise<Context<TDriver, TContext, TElement, TSelector>>;
52
52
  switchToChildContext(...references: ContextReference<TDriver, TContext, TElement, TSelector>[]): Promise<Context<TDriver, TContext, TElement, TSelector>>;
53
- normalizeRegion(region: types.Region): Promise<types.Region>;
53
+ normalizeRegion(region: types.Region, shouldIgnoreSafeRegion?: boolean): Promise<types.Region>;
54
54
  getRegionInViewport(context: Context<TDriver, TContext, TElement, TSelector>, region: types.Region): Promise<types.Region>;
55
55
  element(selector: types.Selector<TSelector>): Promise<Element<TDriver, TContext, TElement, TSelector>>;
56
56
  elements(selector: types.Selector<TSelector>): Promise<Element<TDriver, TContext, TElement, TSelector>[]>;
@@ -31,7 +31,7 @@ export declare class Element<TDriver, TContext, TElement, TSelector> {
31
31
  get isRef(): boolean;
32
32
  equals(element: Element<TDriver, TContext, TElement, TSelector> | TElement): Promise<boolean>;
33
33
  init(context: Context<TDriver, TContext, TElement, TSelector>): Promise<this>;
34
- getRegion(): Promise<types.Region>;
34
+ getRegion(shouldIgnoreSafeRegion?: boolean): Promise<types.Region>;
35
35
  getClientRegion(): Promise<types.Region>;
36
36
  getContentSize(): Promise<types.Size>;
37
37
  isScrollable(): Promise<boolean>;
package/CHANGELOG.md DELETED
@@ -1,252 +0,0 @@
1
- # Change Log
2
-
3
- ## Unreleased
4
-
5
-
6
- ## 1.5.4 - 2022/3/13
7
-
8
- - updated to @applitools/snippets@2.2.2 (from 2.2.1)
9
- - updated to @applitools/types@1.2.2 (from 1.2.1)
10
-
11
- ## 1.5.3 - 2022/3/12
12
-
13
- - when handling shadowRoot, send the element containing the doc frage and the root itself to element constructor
14
- - change the sensible default value for touchPadding when running on Android to 20 (from 24)
15
- - add error logging in element.ts when unable to complete a getAttribute lookup
16
- - updated to @applitools/snippets@2.2.1 (from 2.2.0)
17
- - updated to @applitools/types@1.2.1 (from 1.2.0)
18
-
19
- ## 1.5.2 - 2022/3/7
20
-
21
- - exclude iOS Safari from dynamic SRE calculation
22
-
23
- ## 1.5.1 - 2022/3/7
24
-
25
- - fix `getScrollingElement` in mobile native
26
-
27
- ## 1.5.0 - 2022/3/6
28
-
29
- - add `waitForSelector` method
30
- - support assigning 'scrollingElement' as 'body' or 'html' dom element
31
- - updated to @applitools/snippets@2.2.0 (from 2.1.15)
32
- - updated to @applitools/types@1.2.0 (from 1.0.25)
33
-
34
- ## 1.4.16 - 2022/2/16
35
-
36
- - updated to @applitools/snippets@2.1.15 (from 2.1.14)
37
-
38
- ## 1.4.15 - 2022/2/15
39
-
40
- - updated to @applitools/snippets@2.1.14 (from 2.1.13)
41
-
42
- ## 1.4.14 - 2022/2/15
43
-
44
- - add `viewportScale` getter to `Driver` class
45
- - updated to @applitools/snippets@2.1.13 (from 2.1.12)
46
- - updated to @applitools/types@1.0.25 (from 1.0.24)
47
- - updated to @applitools/utils@1.2.13 (from 1.2.12)
48
-
49
- ## 1.4.13 - 2022/2/10
50
-
51
- - fix android helper
52
- - updated to @applitools/utils@1.2.12 (from 1.2.11)
53
-
54
- ## 1.4.12 - 2022/2/8
55
-
56
- - fix usage of `-ios class chain` selectors
57
-
58
- ## 1.4.11 - 2022/2/8
59
-
60
- - use `-ios class chain` selectors instead of `class name` for iOS specific elements
61
-
62
- ## 1.4.10 - 2022/2/4
63
-
64
- - updated to @applitools/types@1.0.24 (from 1.0.23)
65
-
66
- ### 📝 DOCUMENTATION
67
- - Create a README.md with a description for basic concepts and spec driver methods.
68
-
69
- ## 1.4.9 - 2022/1/12
70
-
71
- - handle case with `spec.getCookies` throws an error when trying to get cookies of the browser
72
-
73
- ## 1.4.8 - 2022/1/5
74
-
75
- - handle legacy appium capabilities
76
- - updated to @applitools/utils@1.2.11 (from 1.2.5)
77
-
78
- ## 1.4.7 - 2021/12/22
79
-
80
- - updated to @applitools/snippets@2.1.12 (from 2.1.11)
81
-
82
- ## 1.4.6 - 2021/12/22
83
-
84
- - extract device orientation in `Driver`'s `init` and provide readonly access through the `orientation` getter of the `Driver`
85
- - updated to @applitools/snippets@2.1.11 (from 2.1.10)
86
- - updated to @applitools/types@1.0.23 (from 1.0.22)
87
- - updated to @applitools/utils@1.2.5 (from 1.2.4)
88
-
89
- ## 1.4.5 - 2021/12/20
90
-
91
- - improve native android app scrolling performance
92
- - fix bug with `Buffer.from` and base64
93
- - updated to @applitools/snippets@2.1.10 (from 2.1.9)
94
-
95
- ## 1.4.3 - 2021/12/17
96
-
97
- - convert base64 result of `spec.takeScreenshot` to `Buffer` before return it from `Driver`'s `takeScreenshot` method
98
- - updated to @applitools/snippets@2.1.9 (from 2.1.8)
99
-
100
- ## 1.4.2 - 2021/12/16
101
-
102
- - fix exports subpathes
103
-
104
- ## 1.4.1 - 2021/12/16
105
-
106
- - updated to @applitools/snippets@2.1.8 (from 2.1.7)
107
-
108
- ## 1.4.0 - 2021/12/16
109
-
110
- - improve native apps scrolling automation
111
- - fix ios safe area related issues
112
- - add helper library abstraction to cover appium edge cases
113
- - made `setViewportSize` more reliable in worst case scenario and faster in best case scenario
114
- - updated to @applitools/types@1.0.22 (from 1.0.21)
115
-
116
- ## 1.3.5 - 2021/11/23
117
-
118
- - updated to @applitools/types@1.0.21 (from 1.0.20)
119
-
120
- ## 1.3.4 - 2021/11/18
121
-
122
- - fix capabilities parsing for native apps
123
-
124
- ## 1.3.3 - 2021/11/14
125
-
126
- - do not throw if `getCookies` method is missed in spec driver
127
-
128
- ## 1.3.2 - 2021/11/14
129
-
130
- - adjust scrolling algorithm on native devices
131
-
132
- ## 1.3.1 - 2021/11/14
133
-
134
- - add in-house capability parsing and system bars size handling mechanisms
135
- - adjust scrolling algorithm on native devices
136
- - support cookies
137
- - updated to @applitools/types@1.0.20 (from 1.0.19)
138
-
139
- ## 1.3.0 - 2021/11/10
140
-
141
- - updated to @applitools/types@1.0.19 (from 1.0.18)
142
-
143
- ## 1.3.0 - 2021/11/10
144
-
145
- - updated to @applitools/types@1.0.19 (from 1.0.18)
146
-
147
- ## 1.2.7 - 2021/10/30
148
-
149
- - updated to @applitools/types@1.0.18 (from 1.0.14)
150
- - updated to @applitools/utils@1.2.4 (from 1.2.3)
151
-
152
- ## 1.2.6 - 2021/10/7
153
-
154
- - fix issue with fractional viewport size on mobile devices
155
-
156
- ## 1.2.5 - 2021/10/5
157
-
158
- - fix issue with wrong user agent overrides valid driver info
159
-
160
- ## 1.2.4 - 2021/9/24
161
-
162
- - fix issue with switching to the duplicated context
163
-
164
- ## 1.2.3 - 2021/9/24
165
-
166
- - updated to @applitools/types@1.0.14 (from 1.0.13)
167
-
168
- ## 1.2.2 - 2021/9/10
169
-
170
- - no changes
171
-
172
- ## 1.2.1 - 2021/9/10
173
-
174
- - fix mocked scripts in MockDriver
175
-
176
- ## 1.2.0 - 2021/9/9
177
-
178
- - add support for deep selectors
179
- - updated to @applitools/snippets@2.1.7 (from 2.1.6)
180
- - updated to @applitools/types@1.0.13 (from 1.0.12)
181
- - updated to @applitools/utils@1.2.3 (from 1.2.2)
182
-
183
- ## 1.1.5 - 2021/9/6
184
-
185
- - updated to @applitools/snippets@2.1.6 (from 2.1.5)
186
-
187
- ## 1.1.4 - 2021/9/6
188
-
189
- - add support of reach spec selectors with shadow properties
190
- - updated to @applitools/snippets@2.1.5 (from 2.1.4)
191
- - updated to @applitools/types@1.0.12 (from 1.0.8)
192
-
193
- ## 1.1.3 - 2021/8/13
194
-
195
- - add `statusBarHeight` getter to the driver
196
- - handle base64 screenshots with line breaks
197
- - handle iOS issue with returning actual scroll position after scrolling
198
- - updated to @applitools/types@1.0.8 (from 1.0.6)
199
-
200
- ## 1.1.2 - 2021/8/8
201
-
202
- - fix default method to compare elements
203
-
204
- ## 1.1.1 - 2021/8/7
205
-
206
- - improve context and element location calculations
207
- - updated to @applitools/utils@1.2.2 (from 1.2.1)
208
-
209
- ## 1.1.0 - 2021/8/4
210
-
211
- - add types support
212
- - add default implementation for element comparison
213
- - add native device automation support
214
- - updated to @applitools/types@1.0.5 (from 1.0.4)
215
- - updated to @applitools/snippets@2.1.4 (from 2.1.3)
216
- - updated to @applitools/types@1.0.6 (from 1.0.5)
217
- - updated to @applitools/utils@1.2.1 (from 1.2.0)
218
-
219
- ## 1.0.7 - 2021/6/8
220
-
221
- - replace setWindowRect with setWindowSize
222
-
223
- ## 1.0.6 - 2021/5/24
224
-
225
- - updated to @applitools/utils@1.2.0 (from 1.1.3)
226
-
227
- ## 1.0.5 - 2021/5/11
228
-
229
- - updated to @applitools/snippets@2.1.3 (from 2.1.1)
230
- - updated to @applitools/utils@1.1.3 (from 1.0.1)
231
-
232
- ## 1.0.4 - 2021/1/27
233
-
234
- - no changes
235
-
236
- ## 1.0.3 - 2021/1/27
237
-
238
- - chore: add husky
239
- - updated to @applitools/snippets@2.1.1 (from 2.1.0)
240
- - updated to @applitools/utils@1.0.1 (from 1.0.0)
241
-
242
- ## 1.0.2 - 2020/12/29
243
-
244
- - add `setTransforms` method to element
245
- - add `setTransforms` method to element
246
- ## 1.0.1 - 2020/12/1
247
-
248
- - add getTransforms method to the element
249
-
250
- ## 1.0.0 - 2020/12/1
251
-
252
- - Provide a framework-agnostic way to work with webdriver/cdp drivers