@applitools/driver
Advanced tools
Comparing version 1.9.4 to 1.9.5
@@ -36,5 +36,9 @@ "use strict"; | ||
if (info.isNative) { | ||
info.displaySize = extractDisplaySize(capabilities); | ||
info.pixelRatio = capabilities.pixelRatio; | ||
info.statusBarHeight = capabilities.statBarHeight; | ||
info.displaySize = extractDisplaySize(capabilities); | ||
if (info.displaySize && capabilities.viewportRect) { | ||
info.navigationBarHeight = | ||
info.displaySize.height - (capabilities.viewportRect.top + capabilities.viewportRect.height); | ||
} | ||
} | ||
@@ -41,0 +45,0 @@ return info; |
@@ -187,7 +187,7 @@ "use strict"; | ||
barsSize.navigationBarHeight = barsSize.navigationBarWidth; | ||
// when status bar is overlapping content on android it returns status bar height equal to viewport height | ||
// when status bar is overlapping content on android it returns status bar height equal to display height | ||
if (barsSize.statusBarHeight < this._driverInfo.displaySize.height) { | ||
this._driverInfo.statusBarHeight = Math.max((_u = this._driverInfo.statusBarHeight) !== null && _u !== void 0 ? _u : 0, barsSize.statusBarHeight); | ||
} | ||
// when navigation bar is invisible on android it returns navigation bar height equal to viewport height | ||
// when navigation bar is invisible on android it returns navigation bar height equal to display height | ||
if (barsSize.navigationBarHeight < this._driverInfo.displaySize.height) { | ||
@@ -194,0 +194,0 @@ this._driverInfo.navigationBarHeight = Math.max((_v = this._driverInfo.navigationBarHeight) !== null && _v !== void 0 ? _v : 0, barsSize.navigationBarHeight); |
@@ -291,3 +291,3 @@ "use strict"; | ||
} | ||
else { | ||
if (!this._state.touchPadding) { | ||
const touchPadding = await this.getAttribute('contentSize') | ||
@@ -398,7 +398,7 @@ .then(data => JSON.parse(data).touchPadding) | ||
} | ||
const actions = []; | ||
const isPager = await this.isPager(); | ||
const touchPadding = await this.getTouchPadding(); | ||
const actions = []; | ||
// horizontal scrolling | ||
const xPadding = Math.max(Math.floor(effectiveRegion.width * 0.07), touchPadding); | ||
const xPadding = touchPadding + 3; | ||
const yTrack = Math.floor(effectiveRegion.y + effectiveRegion.height / 2); // center | ||
@@ -408,2 +408,3 @@ const xLeft = effectiveRegion.y + xPadding; | ||
const xGap = xDirection === 'right' ? -touchPadding : touchPadding; | ||
const xCompensation = xDirection === 'right' ? -1 : 1; | ||
let xRemaining = Math.abs(remainingOffset.x); | ||
@@ -426,14 +427,28 @@ if (isPager) { | ||
} | ||
else { | ||
else if (this.driver.isAndroid) { | ||
actions.push([ | ||
{ action: 'press', y: yTrack, x: xStart }, | ||
// move through scrolling gap (actual scrolling will be triggered only after that) | ||
{ action: 'press', y: yTrack, x: xStart - xGap }, | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', y: yTrack, x: xStart + xGap }, | ||
{ action: 'moveTo', y: yTrack, x: xStart + xCompensation }, | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', y: yTrack, x: xStart }, | ||
// perform actual scrolling | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', y: yTrack, x: xEnd + xGap }, | ||
{ action: 'moveTo', y: yTrack, x: xEnd }, | ||
{ action: 'release' }, | ||
]); | ||
} | ||
else if (this.driver.isIOS) { | ||
actions.push([ | ||
// move through scrolling gap (actual scrolling will be triggered only after that) | ||
{ action: 'press', y: yTrack, x: xStart - xGap }, | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', y: yTrack, x: xStart }, | ||
// perform actual scrolling | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', y: yTrack, x: xEnd }, | ||
// prevent inertial scrolling after release | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', y: yTrack + 1, x: xEnd + xGap }, | ||
{ action: 'moveTo', y: yTrack + 1, x: xEnd }, | ||
{ action: 'release' }, | ||
@@ -445,3 +460,3 @@ ]); | ||
// vertical scrolling | ||
const yPadding = Math.max(Math.floor(effectiveRegion.height * 0.07), touchPadding); | ||
const yPadding = Math.max(Math.floor(effectiveRegion.height * 0.05), touchPadding + 3); | ||
const xTrack = Math.floor(effectiveRegion.x + 5); // a little bit off left border | ||
@@ -451,2 +466,3 @@ const yBottom = effectiveRegion.y + effectiveRegion.height - yPadding; | ||
const yGap = yDirection === 'down' ? -touchPadding : touchPadding; | ||
const yCompensation = yDirection === 'down' ? -1 : 1; | ||
let yRemaining = Math.abs(remainingOffset.y); | ||
@@ -469,14 +485,28 @@ if (isPager) { | ||
} | ||
else { | ||
else if (this.driver.isAndroid) { | ||
actions.push([ | ||
{ action: 'press', x: xTrack, y: yStart }, | ||
// move through scrolling gap (actual scrolling will be triggered only after that) | ||
{ action: 'press', x: xTrack, y: yStart - yGap }, | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', x: xTrack, y: yStart + yGap }, | ||
{ action: 'moveTo', x: xTrack, y: yStart + yCompensation }, | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', x: xTrack, y: yStart }, | ||
// perform actual scrolling | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', x: xTrack, y: yEnd + yGap }, | ||
{ action: 'moveTo', x: xTrack, y: yEnd }, | ||
{ action: 'release' }, | ||
]); | ||
} | ||
else if (this.driver.isIOS) { | ||
actions.push([ | ||
// move through scrolling gap (actual scrolling will be triggered only after that) | ||
{ action: 'press', x: xTrack, y: yStart - yGap }, | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', x: xTrack, y: yStart }, | ||
// perform actual scrolling | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', x: xTrack, y: yEnd }, | ||
// prevent inertial scrolling after release | ||
{ action: 'wait', ms: 100 }, | ||
{ action: 'moveTo', x: xTrack + 1, y: yEnd + yGap }, | ||
{ action: 'moveTo', x: xTrack + 1, y: yEnd }, | ||
{ action: 'release' }, | ||
@@ -498,6 +528,6 @@ ]); | ||
const actualScrollableRegion = await this.getClientRegion(); | ||
this._state.scrollOffset = utils.geometry.round(utils.geometry.offsetNegative(requiredOffset, { | ||
this._state.scrollOffset = utils.geometry.offsetNegative(requiredOffset, { | ||
x: scrollableRegion.x - actualScrollableRegion.x, | ||
y: scrollableRegion.y - actualScrollableRegion.y, | ||
})); | ||
}); | ||
return this._state.scrollOffset; | ||
@@ -504,0 +534,0 @@ } |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.HelperAndroid = void 0; | ||
const utils = __importStar(require("@applitools/utils")); | ||
class HelperAndroid { | ||
@@ -35,6 +59,6 @@ constructor(options) { | ||
async getContentSize(element) { | ||
let contentHeight; | ||
let contentHeightString; | ||
if (this._legacy) { | ||
await this._element.click(); | ||
contentHeight = await this._element.getText(); | ||
contentHeightString = await this._element.getText(); | ||
} | ||
@@ -47,7 +71,10 @@ else { | ||
await this._element.click(); | ||
contentHeight = await this._element.getText(); | ||
contentHeightString = await this._element.getText(); | ||
await this._element.type(''); | ||
} | ||
const region = await this._spec.getElementRegion(this._element.driver.target, element.target); | ||
return { width: region.width, height: Number(contentHeight) }; | ||
const contentHeight = Number(contentHeightString); | ||
if (Number.isNaN(contentHeight)) | ||
return utils.geometry.size(region); | ||
return { width: region.width, height: contentHeight }; | ||
} | ||
@@ -76,3 +103,3 @@ async getRegion(element) { | ||
return null; | ||
await this._element.type(`moveToTop;${elementId};0;0`); | ||
await this._element.type(`moveToTop;${elementId};0;-1`); | ||
await this._element.click(); | ||
@@ -98,5 +125,8 @@ await this._element.type(''); | ||
await this._element.type(''); | ||
return Number(touchPaddingString); | ||
const touchPadding = Number(touchPaddingString); | ||
if (Number.isNaN(touchPadding)) | ||
return null; | ||
return touchPadding; | ||
} | ||
} | ||
exports.HelperAndroid = HelperAndroid; |
{ | ||
"name": "@applitools/driver", | ||
"version": "1.9.4", | ||
"version": "1.9.5", | ||
"description": "Applitools universal framework wrapper", | ||
@@ -79,6 +79,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@applitools/logger": "1.1.12", | ||
"@applitools/snippets": "2.4.2", | ||
"@applitools/types": "1.5.3", | ||
"@applitools/utils": "1.3.8" | ||
"@applitools/logger": "1.1.13", | ||
"@applitools/snippets": "2.4.3", | ||
"@applitools/types": "1.5.4", | ||
"@applitools/utils": "1.3.9" | ||
}, | ||
@@ -85,0 +85,0 @@ "devDependencies": { |
210446
3313
+ Added@applitools/logger@1.1.13(transitive)
+ Added@applitools/snippets@2.4.3(transitive)
+ Added@applitools/types@1.5.4(transitive)
+ Added@applitools/utils@1.3.9(transitive)
- Removed@applitools/logger@1.1.12(transitive)
- Removed@applitools/snippets@2.4.2(transitive)
- Removed@applitools/types@1.5.3(transitive)
- Removed@applitools/utils@1.3.8(transitive)
Updated@applitools/logger@1.1.13
Updated@applitools/snippets@2.4.3
Updated@applitools/types@1.5.4
Updated@applitools/utils@1.3.9