@applitools/driver 1.3.1 → 1.3.2

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 CHANGED
@@ -3,6 +3,10 @@
3
3
  ## Unreleased
4
4
 
5
5
 
6
+ ## 1.3.2 - 2021/11/14
7
+
8
+ - adjust scrolling algorithm on native devices
9
+
6
10
  ## 1.3.1 - 2021/11/14
7
11
 
8
12
  - add in-house capability parsing and system bars size handling mechanisms
package/dist/element.js CHANGED
@@ -328,25 +328,25 @@ class Element {
328
328
  }
329
329
  const actions = [];
330
330
  const xPadding = Math.floor(scrollableRegion.width * 0.1);
331
- const yCenter = Math.floor(scrollableRegion.y + scrollableRegion.height / 2);
331
+ const yTrack = Math.floor(scrollableRegion.y + scrollableRegion.height / 2); // center
332
332
  const xLeft = scrollableRegion.y + xPadding;
333
333
  const xDirection = remainingOffset.y > 0 ? 'right' : 'left';
334
334
  let xRemaining = Math.abs(remainingOffset.x);
335
335
  while (xRemaining > 0) {
336
336
  const xRight = scrollableRegion.x + Math.min(xRemaining + xPadding, scrollableRegion.width - xPadding);
337
337
  const [xStart, xEnd] = xDirection === 'right' ? [xRight, xLeft] : [xLeft, xRight];
338
- actions.push({ action: 'press', x: xStart, y: yCenter }, { action: 'wait', ms: 1500 }, { action: 'moveTo', x: xEnd, y: yCenter }, { action: 'release' });
338
+ actions.push({ action: 'press', x: xStart, y: yTrack }, { action: 'wait', ms: 1500 }, { action: 'moveTo', x: xEnd, y: yTrack }, { action: 'release' });
339
339
  xRemaining -= xRight - xLeft;
340
340
  }
341
- const yPadding = Math.floor(scrollableRegion.height * 0.08);
342
- const xCenter = Math.floor(scrollableRegion.x + scrollableRegion.width / 2); // 0
341
+ const yPadding = Math.floor(scrollableRegion.height * 0.1);
342
+ const xTrack = Math.floor(scrollableRegion.x + 5); // a little bit off left border
343
343
  const yTop = scrollableRegion.y + yPadding;
344
344
  const yDirection = remainingOffset.y > 0 ? 'down' : 'up';
345
345
  let yRemaining = Math.abs(remainingOffset.y) + (await this.getTouchPadding()) * 2;
346
346
  while (yRemaining > 0) {
347
347
  const yBottom = scrollableRegion.y + Math.min(yRemaining + yPadding, scrollableRegion.height - yPadding);
348
348
  const [yStart, yEnd] = yDirection === 'down' ? [yBottom, yTop] : [yTop, yBottom];
349
- actions.push({ action: 'press', x: xCenter, y: yStart }, { action: 'wait', ms: 1500 }, { action: 'moveTo', x: xCenter, y: yEnd }, { action: 'wait', ms: 1500 }, { action: 'release' });
349
+ actions.push({ action: 'press', x: xTrack, y: yStart }, { action: 'wait', ms: 1500 }, { action: 'moveTo', x: xTrack, y: yEnd }, { action: 'wait', ms: 1500 }, { action: 'release' });
350
350
  yRemaining -= yBottom - yTop;
351
351
  }
352
352
  if (actions.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/driver",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Applitools universal framework wrapper",
5
5
  "keywords": [
6
6
  "applitools",