@applitools/driver 1.4.0 → 1.4.4
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 +18 -0
- package/dist/driver.js +5 -2
- package/dist/element.js +12 -3
- package/package.json +7 -3
- package/types/driver.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## 1.4.4 - 2021/12/20
|
|
7
|
+
|
|
8
|
+
- improve native android app scrolling performance
|
|
9
|
+
- fix bug with `Buffer.from` and base64
|
|
10
|
+
|
|
11
|
+
## 1.4.3 - 2021/12/17
|
|
12
|
+
|
|
13
|
+
- convert base64 result of `spec.takeScreenshot` to `Buffer` before return it from `Driver`'s `takeScreenshot` method
|
|
14
|
+
- updated to @applitools/snippets@2.1.9 (from 2.1.8)
|
|
15
|
+
|
|
16
|
+
## 1.4.2 - 2021/12/16
|
|
17
|
+
|
|
18
|
+
- fix exports subpathes
|
|
19
|
+
|
|
20
|
+
## 1.4.1 - 2021/12/16
|
|
21
|
+
|
|
22
|
+
- updated to @applitools/snippets@2.1.8 (from 2.1.7)
|
|
23
|
+
|
|
6
24
|
## 1.4.0 - 2021/12/16
|
|
7
25
|
|
|
8
26
|
- improve native apps scrolling automation
|
package/dist/driver.js
CHANGED
|
@@ -390,8 +390,11 @@ class Driver {
|
|
|
390
390
|
return this.currentContext.execute(script, arg);
|
|
391
391
|
}
|
|
392
392
|
async takeScreenshot() {
|
|
393
|
-
const
|
|
394
|
-
|
|
393
|
+
const image = await this._spec.takeScreenshot(this.target);
|
|
394
|
+
if (utils.types.isString(image)) {
|
|
395
|
+
return Buffer.from(image.replace(/[\r\n]+/g, ''), 'base64');
|
|
396
|
+
}
|
|
397
|
+
return image;
|
|
395
398
|
}
|
|
396
399
|
async getViewportSize() {
|
|
397
400
|
var _a;
|
package/dist/element.js
CHANGED
|
@@ -180,7 +180,6 @@ class Element {
|
|
|
180
180
|
return this._state.contentSize;
|
|
181
181
|
}
|
|
182
182
|
catch (err) {
|
|
183
|
-
console.log(err);
|
|
184
183
|
this._logger.warn('Failed to extract content size, extracting client size instead');
|
|
185
184
|
this._logger.error(err);
|
|
186
185
|
return utils.geometry.size(await this.getClientRegion());
|
|
@@ -290,6 +289,7 @@ class Element {
|
|
|
290
289
|
if (this.driver.isAndroid) {
|
|
291
290
|
remainingOffset = utils.geometry.scale(remainingOffset, this.driver.pixelRatio);
|
|
292
291
|
}
|
|
292
|
+
const actions = [];
|
|
293
293
|
const touchPadding = await this.getTouchPadding();
|
|
294
294
|
const xPadding = Math.max(Math.floor(effectiveRegion.width * 0.1), touchPadding);
|
|
295
295
|
const yTrack = Math.floor(effectiveRegion.y + effectiveRegion.height / 2); // center
|
|
@@ -300,7 +300,7 @@ class Element {
|
|
|
300
300
|
while (xRemaining > 0) {
|
|
301
301
|
const xRight = effectiveRegion.x + Math.min(xRemaining + xPadding, effectiveRegion.width - xPadding);
|
|
302
302
|
const [xStart, xEnd] = xDirection === 'right' ? [xRight, xLeft] : [xLeft, xRight];
|
|
303
|
-
|
|
303
|
+
actions.push([
|
|
304
304
|
{ action: 'press', y: yTrack, x: xStart },
|
|
305
305
|
{ action: 'wait', ms: 100 },
|
|
306
306
|
{ action: 'moveTo', y: yTrack, x: xStart + xGap },
|
|
@@ -321,7 +321,7 @@ class Element {
|
|
|
321
321
|
while (yRemaining > 0) {
|
|
322
322
|
const yTop = Math.max(yBottom - yRemaining, effectiveRegion.y + yPadding);
|
|
323
323
|
const [yStart, yEnd] = yDirection === 'down' ? [yBottom, yTop] : [yTop, yBottom];
|
|
324
|
-
|
|
324
|
+
actions.push([
|
|
325
325
|
{ action: 'press', x: xTrack, y: yStart },
|
|
326
326
|
{ action: 'wait', ms: 100 },
|
|
327
327
|
{ action: 'moveTo', x: xTrack, y: yStart + yGap },
|
|
@@ -333,6 +333,15 @@ class Element {
|
|
|
333
333
|
]);
|
|
334
334
|
yRemaining -= yBottom - yTop;
|
|
335
335
|
}
|
|
336
|
+
// ios actions should be executed one-by-one sequentially, otherwise the result isn't stable
|
|
337
|
+
if (this.driver.isIOS) {
|
|
338
|
+
for (const action of actions) {
|
|
339
|
+
await this._spec.performAction(this.driver.target, action);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
await this._spec.performAction(this.driver.target, [].concat(...actions));
|
|
344
|
+
}
|
|
336
345
|
const actualScrollableRegion = await this.getClientRegion();
|
|
337
346
|
this._state.scrollOffset = utils.geometry.offsetNegative(requiredOffset, {
|
|
338
347
|
x: scrollableRegion.x - actualScrollableRegion.x,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/driver",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "Applitools universal framework wrapper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"applitools",
|
|
@@ -38,7 +38,11 @@
|
|
|
38
38
|
"./debug": {
|
|
39
39
|
"default": "./dist/debug/index.js",
|
|
40
40
|
"types": "./types/debug/index.d.ts"
|
|
41
|
-
}
|
|
41
|
+
},
|
|
42
|
+
"./dist/*": "./dist/*.js",
|
|
43
|
+
"./dist/fake": "./dist/fake/index.js",
|
|
44
|
+
"./dist/debug": "./dist/debug/index.js",
|
|
45
|
+
"./package.json": "./package.json"
|
|
42
46
|
},
|
|
43
47
|
"typesVersions": {
|
|
44
48
|
"*": {
|
|
@@ -69,7 +73,7 @@
|
|
|
69
73
|
}
|
|
70
74
|
},
|
|
71
75
|
"dependencies": {
|
|
72
|
-
"@applitools/snippets": "2.1.
|
|
76
|
+
"@applitools/snippets": "2.1.9",
|
|
73
77
|
"@applitools/types": "1.0.22",
|
|
74
78
|
"@applitools/utils": "1.2.4"
|
|
75
79
|
},
|
package/types/driver.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare class Driver<TDriver, TContext, TElement, TSelector> {
|
|
|
54
54
|
element(selector: types.Selector<TSelector>): Promise<Element<TDriver, TContext, TElement, TSelector>>;
|
|
55
55
|
elements(selector: types.Selector<TSelector>): Promise<Element<TDriver, TContext, TElement, TSelector>[]>;
|
|
56
56
|
execute(script: ((arg: any) => any) | string, arg?: any): Promise<any>;
|
|
57
|
-
takeScreenshot(): Promise<Buffer
|
|
57
|
+
takeScreenshot(): Promise<Buffer>;
|
|
58
58
|
getViewportSize(): Promise<types.Size>;
|
|
59
59
|
setViewportSize(size: types.Size): Promise<void>;
|
|
60
60
|
getDisplaySize(): Promise<types.Size>;
|