@applitools/driver 1.4.1 → 1.4.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/CHANGELOG.md +15 -0
- package/dist/driver.js +5 -2
- package/dist/element.js +12 -2
- package/package.json +7 -3
- package/types/driver.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## 1.4.5 - 2021/12/20
|
|
7
|
+
|
|
8
|
+
- improve native android app scrolling performance
|
|
9
|
+
- fix bug with `Buffer.from` and base64
|
|
10
|
+
- updated to @applitools/snippets@2.1.10 (from 2.1.9)
|
|
11
|
+
|
|
12
|
+
## 1.4.3 - 2021/12/17
|
|
13
|
+
|
|
14
|
+
- convert base64 result of `spec.takeScreenshot` to `Buffer` before return it from `Driver`'s `takeScreenshot` method
|
|
15
|
+
- updated to @applitools/snippets@2.1.9 (from 2.1.8)
|
|
16
|
+
|
|
17
|
+
## 1.4.2 - 2021/12/16
|
|
18
|
+
|
|
19
|
+
- fix exports subpathes
|
|
20
|
+
|
|
6
21
|
## 1.4.1 - 2021/12/16
|
|
7
22
|
|
|
8
23
|
- updated to @applitools/snippets@2.1.8 (from 2.1.7)
|
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
|
@@ -289,6 +289,7 @@ class Element {
|
|
|
289
289
|
if (this.driver.isAndroid) {
|
|
290
290
|
remainingOffset = utils.geometry.scale(remainingOffset, this.driver.pixelRatio);
|
|
291
291
|
}
|
|
292
|
+
const actions = [];
|
|
292
293
|
const touchPadding = await this.getTouchPadding();
|
|
293
294
|
const xPadding = Math.max(Math.floor(effectiveRegion.width * 0.1), touchPadding);
|
|
294
295
|
const yTrack = Math.floor(effectiveRegion.y + effectiveRegion.height / 2); // center
|
|
@@ -299,7 +300,7 @@ class Element {
|
|
|
299
300
|
while (xRemaining > 0) {
|
|
300
301
|
const xRight = effectiveRegion.x + Math.min(xRemaining + xPadding, effectiveRegion.width - xPadding);
|
|
301
302
|
const [xStart, xEnd] = xDirection === 'right' ? [xRight, xLeft] : [xLeft, xRight];
|
|
302
|
-
|
|
303
|
+
actions.push([
|
|
303
304
|
{ action: 'press', y: yTrack, x: xStart },
|
|
304
305
|
{ action: 'wait', ms: 100 },
|
|
305
306
|
{ action: 'moveTo', y: yTrack, x: xStart + xGap },
|
|
@@ -320,7 +321,7 @@ class Element {
|
|
|
320
321
|
while (yRemaining > 0) {
|
|
321
322
|
const yTop = Math.max(yBottom - yRemaining, effectiveRegion.y + yPadding);
|
|
322
323
|
const [yStart, yEnd] = yDirection === 'down' ? [yBottom, yTop] : [yTop, yBottom];
|
|
323
|
-
|
|
324
|
+
actions.push([
|
|
324
325
|
{ action: 'press', x: xTrack, y: yStart },
|
|
325
326
|
{ action: 'wait', ms: 100 },
|
|
326
327
|
{ action: 'moveTo', x: xTrack, y: yStart + yGap },
|
|
@@ -332,6 +333,15 @@ class Element {
|
|
|
332
333
|
]);
|
|
333
334
|
yRemaining -= yBottom - yTop;
|
|
334
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
|
+
}
|
|
335
345
|
const actualScrollableRegion = await this.getClientRegion();
|
|
336
346
|
this._state.scrollOffset = utils.geometry.offsetNegative(requiredOffset, {
|
|
337
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.5",
|
|
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.10",
|
|
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>;
|