@applitools/driver 1.4.3 → 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 +5 -0
- package/dist/driver.js +1 -1
- package/dist/element.js +12 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
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
|
+
|
|
6
11
|
## 1.4.3 - 2021/12/17
|
|
7
12
|
|
|
8
13
|
- convert base64 result of `spec.takeScreenshot` to `Buffer` before return it from `Driver`'s `takeScreenshot` method
|
package/dist/driver.js
CHANGED
|
@@ -392,7 +392,7 @@ class Driver {
|
|
|
392
392
|
async takeScreenshot() {
|
|
393
393
|
const image = await this._spec.takeScreenshot(this.target);
|
|
394
394
|
if (utils.types.isString(image)) {
|
|
395
|
-
return Buffer.from(image.replace(/[\r\n]+/g, ''));
|
|
395
|
+
return Buffer.from(image.replace(/[\r\n]+/g, ''), 'base64');
|
|
396
396
|
}
|
|
397
397
|
return image;
|
|
398
398
|
}
|
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,
|