@applitools/driver 1.5.2 → 1.5.5
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 +3 -2
- package/dist/element.js +17 -5
- package/package.json +4 -4
- package/types/element.d.ts +1 -0
- package/types/spec-utils.d.ts +8 -1
- package/CHANGELOG.md +0 -239
package/dist/context.js
CHANGED
|
@@ -214,10 +214,11 @@ class Context {
|
|
|
214
214
|
if ((_a = this.driver.features) === null || _a === void 0 ? void 0 : _a.shadowSelector)
|
|
215
215
|
return { context, selector: elementSelector };
|
|
216
216
|
let root = null;
|
|
217
|
+
let element = null;
|
|
217
218
|
let currentSelector = elementSelector;
|
|
218
219
|
while (specUtils.isCommonSelector(this._spec, currentSelector) &&
|
|
219
220
|
specUtils.isSelector(this._spec, currentSelector.shadow)) {
|
|
220
|
-
|
|
221
|
+
element = await this._spec.findElement(this.target, specUtils.transformSelector(this._spec, currentSelector, this.driver), root);
|
|
221
222
|
if (!element)
|
|
222
223
|
return null;
|
|
223
224
|
root = await this._spec.executeScript(this.target, snippets.getShadowRoot, [element]);
|
|
@@ -227,7 +228,7 @@ class Context {
|
|
|
227
228
|
}
|
|
228
229
|
return {
|
|
229
230
|
context,
|
|
230
|
-
shadow: root ? new element_1.Element({ spec: this._spec, context, element
|
|
231
|
+
shadow: root ? new element_1.Element({ spec: this._spec, context, element, logger: this._logger, root }) : null,
|
|
231
232
|
selector: currentSelector,
|
|
232
233
|
};
|
|
233
234
|
}
|
package/dist/element.js
CHANGED
|
@@ -46,9 +46,16 @@ class Element {
|
|
|
46
46
|
if (options.logger)
|
|
47
47
|
this._logger = options.logger;
|
|
48
48
|
if (this._spec.isElement(options.element)) {
|
|
49
|
-
|
|
49
|
+
let elementToUse = options.element;
|
|
50
|
+
if (options.root) {
|
|
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;
|
|
56
|
+
}
|
|
50
57
|
// Some frameworks contains information about the selector inside an element
|
|
51
|
-
this._selector = (_d = options.selector) !== null && _d !== void 0 ? _d : (_f = (_e = this._spec).extractSelector) === null || _f === void 0 ? void 0 : _f.call(_e,
|
|
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);
|
|
52
59
|
this._index = options.index;
|
|
53
60
|
}
|
|
54
61
|
else if (specUtils.isSelector(this._spec, options.selector)) {
|
|
@@ -151,7 +158,8 @@ class Element {
|
|
|
151
158
|
height: (this.driver.isAndroid ? contentSize.height : 0) + contentSize.scrollableOffset,
|
|
152
159
|
};
|
|
153
160
|
})
|
|
154
|
-
.catch(
|
|
161
|
+
.catch(err => {
|
|
162
|
+
this._logger.log(`Unable to get the attribute 'contentSize' when looking up touchPadding due to the following error:`, `'${err.message}'`);
|
|
155
163
|
return this._spec.getElementRegion(this.driver.target, this.target);
|
|
156
164
|
}), { touchPadding } = _d, contentRegion = __rest(_d, ["touchPadding"]);
|
|
157
165
|
this._logger.log('Extracted native content size attribute', contentRegion);
|
|
@@ -162,6 +170,7 @@ class Element {
|
|
|
162
170
|
height: Math.max((_c = contentSize === null || contentSize === void 0 ? void 0 : contentSize.height) !== null && _c !== void 0 ? _c : 0, contentRegion.height),
|
|
163
171
|
};
|
|
164
172
|
this._touchPadding = touchPadding !== null && touchPadding !== void 0 ? touchPadding : this._touchPadding;
|
|
173
|
+
this._logger.log('touchPadding', this._touchPadding);
|
|
165
174
|
if (this.driver.isAndroid) {
|
|
166
175
|
this._state.contentSize = utils.geometry.scale(this._state.contentSize, 1 / this.driver.pixelRatio);
|
|
167
176
|
}
|
|
@@ -228,8 +237,11 @@ class Element {
|
|
|
228
237
|
else if (this.driver.isAndroid) {
|
|
229
238
|
const data = await this.getAttribute('contentSize')
|
|
230
239
|
.then(JSON.parse)
|
|
231
|
-
.catch(
|
|
232
|
-
|
|
240
|
+
.catch(err => {
|
|
241
|
+
this._logger.log(`Unable to get the attribute 'contentSize' when looking up touchPadding due to the following error:`, `'${err.message}'`);
|
|
242
|
+
});
|
|
243
|
+
this._touchPadding = (_a = data === null || data === void 0 ? void 0 : data.touchPadding) !== null && _a !== void 0 ? _a : 20;
|
|
244
|
+
this._logger.log('touchPadding', this._touchPadding);
|
|
233
245
|
}
|
|
234
246
|
}
|
|
235
247
|
return this._touchPadding;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@applitools/snippets": "2.2.
|
|
77
|
-
"@applitools/types": "1.2.
|
|
76
|
+
"@applitools/snippets": "2.2.2",
|
|
77
|
+
"@applitools/types": "1.2.2",
|
|
78
78
|
"@applitools/utils": "1.2.13"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@applitools/sdk-release-kit": "0.
|
|
81
|
+
"@applitools/sdk-release-kit": "1.0.4",
|
|
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/element.d.ts
CHANGED
package/types/spec-utils.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type * as types from '@applitools/types';
|
|
2
|
-
|
|
2
|
+
declare type CommonSelector<TSelector = never> = {
|
|
3
|
+
selector: TSelector | string;
|
|
4
|
+
type?: string;
|
|
5
|
+
shadow?: CommonSelector<TSelector> | TSelector | string;
|
|
6
|
+
frame?: CommonSelector<TSelector> | TSelector | string;
|
|
7
|
+
};
|
|
8
|
+
export declare function isCommonSelector<TSelector>(spec: Pick<types.SpecDriver<unknown, unknown, unknown, TSelector>, 'isSelector'>, selector: any): selector is CommonSelector<TSelector>;
|
|
3
9
|
export declare function isSelector<TSelector>(spec: Pick<types.SpecDriver<unknown, unknown, unknown, TSelector>, 'isSelector'>, selector: any): selector is types.Selector<TSelector>;
|
|
4
10
|
export declare function transformSelector<TSelector>(spec: Pick<types.SpecDriver<unknown, unknown, unknown, TSelector>, 'isSelector' | 'transformSelector'>, selector: types.Selector<TSelector>, environment?: {
|
|
5
11
|
isWeb?: boolean;
|
|
@@ -11,3 +17,4 @@ export declare function splitSelector<TSelector>(spec: Pick<types.SpecDriver<unk
|
|
|
11
17
|
contextSelectors: types.Selector<TSelector>[];
|
|
12
18
|
elementSelector: types.Selector<TSelector>;
|
|
13
19
|
};
|
|
20
|
+
export {};
|
package/CHANGELOG.md
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
## Unreleased
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
## 1.5.2 - 2022/3/7
|
|
7
|
-
|
|
8
|
-
- exclude iOS Safari from dynamic SRE calculation
|
|
9
|
-
|
|
10
|
-
## 1.5.1 - 2022/3/7
|
|
11
|
-
|
|
12
|
-
- fix `getScrollingElement` in mobile native
|
|
13
|
-
|
|
14
|
-
## 1.5.0 - 2022/3/6
|
|
15
|
-
|
|
16
|
-
- add `waitForSelector` method
|
|
17
|
-
- support assigning 'scrollingElement' as 'body' or 'html' dom element
|
|
18
|
-
- updated to @applitools/snippets@2.2.0 (from 2.1.15)
|
|
19
|
-
- updated to @applitools/types@1.2.0 (from 1.0.25)
|
|
20
|
-
|
|
21
|
-
## 1.4.16 - 2022/2/16
|
|
22
|
-
|
|
23
|
-
- updated to @applitools/snippets@2.1.15 (from 2.1.14)
|
|
24
|
-
|
|
25
|
-
## 1.4.15 - 2022/2/15
|
|
26
|
-
|
|
27
|
-
- updated to @applitools/snippets@2.1.14 (from 2.1.13)
|
|
28
|
-
|
|
29
|
-
## 1.4.14 - 2022/2/15
|
|
30
|
-
|
|
31
|
-
- add `viewportScale` getter to `Driver` class
|
|
32
|
-
- updated to @applitools/snippets@2.1.13 (from 2.1.12)
|
|
33
|
-
- updated to @applitools/types@1.0.25 (from 1.0.24)
|
|
34
|
-
- updated to @applitools/utils@1.2.13 (from 1.2.12)
|
|
35
|
-
|
|
36
|
-
## 1.4.13 - 2022/2/10
|
|
37
|
-
|
|
38
|
-
- fix android helper
|
|
39
|
-
- updated to @applitools/utils@1.2.12 (from 1.2.11)
|
|
40
|
-
|
|
41
|
-
## 1.4.12 - 2022/2/8
|
|
42
|
-
|
|
43
|
-
- fix usage of `-ios class chain` selectors
|
|
44
|
-
|
|
45
|
-
## 1.4.11 - 2022/2/8
|
|
46
|
-
|
|
47
|
-
- use `-ios class chain` selectors instead of `class name` for iOS specific elements
|
|
48
|
-
|
|
49
|
-
## 1.4.10 - 2022/2/4
|
|
50
|
-
|
|
51
|
-
- updated to @applitools/types@1.0.24 (from 1.0.23)
|
|
52
|
-
|
|
53
|
-
### 📝 DOCUMENTATION
|
|
54
|
-
- Create a README.md with a description for basic concepts and spec driver methods.
|
|
55
|
-
|
|
56
|
-
## 1.4.9 - 2022/1/12
|
|
57
|
-
|
|
58
|
-
- handle case with `spec.getCookies` throws an error when trying to get cookies of the browser
|
|
59
|
-
|
|
60
|
-
## 1.4.8 - 2022/1/5
|
|
61
|
-
|
|
62
|
-
- handle legacy appium capabilities
|
|
63
|
-
- updated to @applitools/utils@1.2.11 (from 1.2.5)
|
|
64
|
-
|
|
65
|
-
## 1.4.7 - 2021/12/22
|
|
66
|
-
|
|
67
|
-
- updated to @applitools/snippets@2.1.12 (from 2.1.11)
|
|
68
|
-
|
|
69
|
-
## 1.4.6 - 2021/12/22
|
|
70
|
-
|
|
71
|
-
- extract device orientation in `Driver`'s `init` and provide readonly access through the `orientation` getter of the `Driver`
|
|
72
|
-
- updated to @applitools/snippets@2.1.11 (from 2.1.10)
|
|
73
|
-
- updated to @applitools/types@1.0.23 (from 1.0.22)
|
|
74
|
-
- updated to @applitools/utils@1.2.5 (from 1.2.4)
|
|
75
|
-
|
|
76
|
-
## 1.4.5 - 2021/12/20
|
|
77
|
-
|
|
78
|
-
- improve native android app scrolling performance
|
|
79
|
-
- fix bug with `Buffer.from` and base64
|
|
80
|
-
- updated to @applitools/snippets@2.1.10 (from 2.1.9)
|
|
81
|
-
|
|
82
|
-
## 1.4.3 - 2021/12/17
|
|
83
|
-
|
|
84
|
-
- convert base64 result of `spec.takeScreenshot` to `Buffer` before return it from `Driver`'s `takeScreenshot` method
|
|
85
|
-
- updated to @applitools/snippets@2.1.9 (from 2.1.8)
|
|
86
|
-
|
|
87
|
-
## 1.4.2 - 2021/12/16
|
|
88
|
-
|
|
89
|
-
- fix exports subpathes
|
|
90
|
-
|
|
91
|
-
## 1.4.1 - 2021/12/16
|
|
92
|
-
|
|
93
|
-
- updated to @applitools/snippets@2.1.8 (from 2.1.7)
|
|
94
|
-
|
|
95
|
-
## 1.4.0 - 2021/12/16
|
|
96
|
-
|
|
97
|
-
- improve native apps scrolling automation
|
|
98
|
-
- fix ios safe area related issues
|
|
99
|
-
- add helper library abstraction to cover appium edge cases
|
|
100
|
-
- made `setViewportSize` more reliable in worst case scenario and faster in best case scenario
|
|
101
|
-
- updated to @applitools/types@1.0.22 (from 1.0.21)
|
|
102
|
-
|
|
103
|
-
## 1.3.5 - 2021/11/23
|
|
104
|
-
|
|
105
|
-
- updated to @applitools/types@1.0.21 (from 1.0.20)
|
|
106
|
-
|
|
107
|
-
## 1.3.4 - 2021/11/18
|
|
108
|
-
|
|
109
|
-
- fix capabilities parsing for native apps
|
|
110
|
-
|
|
111
|
-
## 1.3.3 - 2021/11/14
|
|
112
|
-
|
|
113
|
-
- do not throw if `getCookies` method is missed in spec driver
|
|
114
|
-
|
|
115
|
-
## 1.3.2 - 2021/11/14
|
|
116
|
-
|
|
117
|
-
- adjust scrolling algorithm on native devices
|
|
118
|
-
|
|
119
|
-
## 1.3.1 - 2021/11/14
|
|
120
|
-
|
|
121
|
-
- add in-house capability parsing and system bars size handling mechanisms
|
|
122
|
-
- adjust scrolling algorithm on native devices
|
|
123
|
-
- support cookies
|
|
124
|
-
- updated to @applitools/types@1.0.20 (from 1.0.19)
|
|
125
|
-
|
|
126
|
-
## 1.3.0 - 2021/11/10
|
|
127
|
-
|
|
128
|
-
- updated to @applitools/types@1.0.19 (from 1.0.18)
|
|
129
|
-
|
|
130
|
-
## 1.3.0 - 2021/11/10
|
|
131
|
-
|
|
132
|
-
- updated to @applitools/types@1.0.19 (from 1.0.18)
|
|
133
|
-
|
|
134
|
-
## 1.2.7 - 2021/10/30
|
|
135
|
-
|
|
136
|
-
- updated to @applitools/types@1.0.18 (from 1.0.14)
|
|
137
|
-
- updated to @applitools/utils@1.2.4 (from 1.2.3)
|
|
138
|
-
|
|
139
|
-
## 1.2.6 - 2021/10/7
|
|
140
|
-
|
|
141
|
-
- fix issue with fractional viewport size on mobile devices
|
|
142
|
-
|
|
143
|
-
## 1.2.5 - 2021/10/5
|
|
144
|
-
|
|
145
|
-
- fix issue with wrong user agent overrides valid driver info
|
|
146
|
-
|
|
147
|
-
## 1.2.4 - 2021/9/24
|
|
148
|
-
|
|
149
|
-
- fix issue with switching to the duplicated context
|
|
150
|
-
|
|
151
|
-
## 1.2.3 - 2021/9/24
|
|
152
|
-
|
|
153
|
-
- updated to @applitools/types@1.0.14 (from 1.0.13)
|
|
154
|
-
|
|
155
|
-
## 1.2.2 - 2021/9/10
|
|
156
|
-
|
|
157
|
-
- no changes
|
|
158
|
-
|
|
159
|
-
## 1.2.1 - 2021/9/10
|
|
160
|
-
|
|
161
|
-
- fix mocked scripts in MockDriver
|
|
162
|
-
|
|
163
|
-
## 1.2.0 - 2021/9/9
|
|
164
|
-
|
|
165
|
-
- add support for deep selectors
|
|
166
|
-
- updated to @applitools/snippets@2.1.7 (from 2.1.6)
|
|
167
|
-
- updated to @applitools/types@1.0.13 (from 1.0.12)
|
|
168
|
-
- updated to @applitools/utils@1.2.3 (from 1.2.2)
|
|
169
|
-
|
|
170
|
-
## 1.1.5 - 2021/9/6
|
|
171
|
-
|
|
172
|
-
- updated to @applitools/snippets@2.1.6 (from 2.1.5)
|
|
173
|
-
|
|
174
|
-
## 1.1.4 - 2021/9/6
|
|
175
|
-
|
|
176
|
-
- add support of reach spec selectors with shadow properties
|
|
177
|
-
- updated to @applitools/snippets@2.1.5 (from 2.1.4)
|
|
178
|
-
- updated to @applitools/types@1.0.12 (from 1.0.8)
|
|
179
|
-
|
|
180
|
-
## 1.1.3 - 2021/8/13
|
|
181
|
-
|
|
182
|
-
- add `statusBarHeight` getter to the driver
|
|
183
|
-
- handle base64 screenshots with line breaks
|
|
184
|
-
- handle iOS issue with returning actual scroll position after scrolling
|
|
185
|
-
- updated to @applitools/types@1.0.8 (from 1.0.6)
|
|
186
|
-
|
|
187
|
-
## 1.1.2 - 2021/8/8
|
|
188
|
-
|
|
189
|
-
- fix default method to compare elements
|
|
190
|
-
|
|
191
|
-
## 1.1.1 - 2021/8/7
|
|
192
|
-
|
|
193
|
-
- improve context and element location calculations
|
|
194
|
-
- updated to @applitools/utils@1.2.2 (from 1.2.1)
|
|
195
|
-
|
|
196
|
-
## 1.1.0 - 2021/8/4
|
|
197
|
-
|
|
198
|
-
- add types support
|
|
199
|
-
- add default implementation for element comparison
|
|
200
|
-
- add native device automation support
|
|
201
|
-
- updated to @applitools/types@1.0.5 (from 1.0.4)
|
|
202
|
-
- updated to @applitools/snippets@2.1.4 (from 2.1.3)
|
|
203
|
-
- updated to @applitools/types@1.0.6 (from 1.0.5)
|
|
204
|
-
- updated to @applitools/utils@1.2.1 (from 1.2.0)
|
|
205
|
-
|
|
206
|
-
## 1.0.7 - 2021/6/8
|
|
207
|
-
|
|
208
|
-
- replace setWindowRect with setWindowSize
|
|
209
|
-
|
|
210
|
-
## 1.0.6 - 2021/5/24
|
|
211
|
-
|
|
212
|
-
- updated to @applitools/utils@1.2.0 (from 1.1.3)
|
|
213
|
-
|
|
214
|
-
## 1.0.5 - 2021/5/11
|
|
215
|
-
|
|
216
|
-
- updated to @applitools/snippets@2.1.3 (from 2.1.1)
|
|
217
|
-
- updated to @applitools/utils@1.1.3 (from 1.0.1)
|
|
218
|
-
|
|
219
|
-
## 1.0.4 - 2021/1/27
|
|
220
|
-
|
|
221
|
-
- no changes
|
|
222
|
-
|
|
223
|
-
## 1.0.3 - 2021/1/27
|
|
224
|
-
|
|
225
|
-
- chore: add husky
|
|
226
|
-
- updated to @applitools/snippets@2.1.1 (from 2.1.0)
|
|
227
|
-
- updated to @applitools/utils@1.0.1 (from 1.0.0)
|
|
228
|
-
|
|
229
|
-
## 1.0.2 - 2020/12/29
|
|
230
|
-
|
|
231
|
-
- add `setTransforms` method to element
|
|
232
|
-
- add `setTransforms` method to element
|
|
233
|
-
## 1.0.1 - 2020/12/1
|
|
234
|
-
|
|
235
|
-
- add getTransforms method to the element
|
|
236
|
-
|
|
237
|
-
## 1.0.0 - 2020/12/1
|
|
238
|
-
|
|
239
|
-
- Provide a framework-agnostic way to work with webdriver/cdp drivers
|