@applitools/driver 1.8.6 → 1.8.9
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/dist/context.js +7 -3
- package/dist/driver.js +4 -0
- package/dist/element.js +10 -1
- package/package.json +1 -1
package/dist/context.js
CHANGED
|
@@ -470,6 +470,7 @@ class Context {
|
|
|
470
470
|
async getRegionInViewport(region) {
|
|
471
471
|
var _a, _b;
|
|
472
472
|
let currentContext = this;
|
|
473
|
+
this._logger.log('Converting context region to viewport region', region);
|
|
473
474
|
if (region)
|
|
474
475
|
region = utils.geometry.offsetNegative(region, await currentContext.getInnerOffset());
|
|
475
476
|
else
|
|
@@ -478,9 +479,12 @@ class Context {
|
|
|
478
479
|
const contextRegion = await currentContext.getClientRegion();
|
|
479
480
|
// const contextScrollingRegion = await currentContext.getScrollingRegion()
|
|
480
481
|
const parentContextInnerOffset = (_b = (await ((_a = currentContext.parent) === null || _a === void 0 ? void 0 : _a.getInnerOffset()))) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
482
|
+
if (utils.geometry.contains(contextRegion, region) && !utils.geometry.equals(contextRegion, region)) {
|
|
483
|
+
this._logger.log('Intersecting context region', region, 'with context region', contextRegion);
|
|
484
|
+
region = utils.geometry.intersect(contextRegion, utils.geometry.offset(region, contextRegion));
|
|
485
|
+
// region = utils.geometry.intersect(contextScrollingRegion, region)
|
|
486
|
+
region = utils.geometry.offsetNegative(region, parentContextInnerOffset);
|
|
487
|
+
}
|
|
484
488
|
currentContext = currentContext.parent;
|
|
485
489
|
}
|
|
486
490
|
return region;
|
package/dist/driver.js
CHANGED
|
@@ -191,6 +191,10 @@ class Driver {
|
|
|
191
191
|
if (barsSize.navigationBarHeight / this.pixelRatio < displaySize.height) {
|
|
192
192
|
this._driverInfo.navigationBarHeight = Math.max((_u = this._driverInfo.navigationBarHeight) !== null && _u !== void 0 ? _u : 0, barsSize.navigationBarHeight);
|
|
193
193
|
}
|
|
194
|
+
else {
|
|
195
|
+
// if navigation bar height is bigger then display height he can use it to reset display height
|
|
196
|
+
displaySize.height = barsSize.navigationBarHeight / this.pixelRatio;
|
|
197
|
+
}
|
|
194
198
|
// bar heights have to be scaled on android
|
|
195
199
|
(_3 = this._driverInfo).statusBarHeight && (_3.statusBarHeight = this._driverInfo.statusBarHeight / this.pixelRatio);
|
|
196
200
|
(_4 = this._driverInfo).navigationBarHeight && (_4.navigationBarHeight = this._driverInfo.navigationBarHeight / this.pixelRatio);
|
package/dist/element.js
CHANGED
|
@@ -120,7 +120,16 @@ class Element {
|
|
|
120
120
|
this._logger.log('Extracting region of native element with selector', this.selector);
|
|
121
121
|
const region = await this._spec.getElementRegion(this.driver.target, this.target);
|
|
122
122
|
this._logger.log('Extracted native region', region);
|
|
123
|
-
|
|
123
|
+
const normalizedRegion = await this.driver.normalizeRegion(region);
|
|
124
|
+
// if element is a child of scrolling element, then region location should be adjusted
|
|
125
|
+
const scrollingElement = await this.context.getScrollingElement();
|
|
126
|
+
if (scrollingElement) {
|
|
127
|
+
const scrollingRegion = await this._spec.getElementRegion(this.driver.target, scrollingElement.target);
|
|
128
|
+
if (utils.geometry.contains(scrollingRegion, region) && !(await this.equals(scrollingElement))) {
|
|
129
|
+
return utils.geometry.offset(normalizedRegion, await scrollingElement.getScrollOffset());
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return normalizedRegion;
|
|
124
133
|
}
|
|
125
134
|
});
|
|
126
135
|
this._logger.log('Extracted region', region);
|