@percy/appium-app
Advanced tools
Comparing version 2.0.5 to 2.0.6
{ | ||
"name": "@percy/appium-app", | ||
"description": "Appium client library for visual testing with Percy", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "author": "Perceptual Inc.", |
@@ -17,3 +17,3 @@ const { Cache } = require('../util/cache'); | ||
// In typescript for wdio we get driver.constuctor.name as 'BoundBrowser' | ||
if (driver.constructor.name.includes('Browser') && !Undefined(driver.getSession)) { | ||
if (driver.constructor.name.includes('Browser') && !Undefined(driver.capabilities)) { | ||
this.type = 'wdio'; | ||
@@ -34,3 +34,3 @@ } else if ((driver.constructor.name === '' || | ||
/* istanbul ignore next */ // not sure why its marking it when its covered | ||
if (this.wdio) return await this.driver.getSession(); | ||
if (this.wdio) return await this.driver.capabilities; | ||
}); | ||
@@ -113,2 +113,8 @@ }); | ||
async getWindowSize() { | ||
return await TimeIt.run('getWindowSize', async () => { | ||
return await this.driver.getWindowSize(); | ||
}); | ||
} | ||
get commandExecutorUrl() { | ||
@@ -115,0 +121,0 @@ if (this.wd) return `${this.driver.configUrl.protocol}//${this.remoteHostname}${this.driver.configUrl.path}`; |
@@ -9,3 +9,2 @@ const { Metadata } = require('./metadata'); | ||
const caps = await this.caps(); | ||
if (await this.staticData()) { | ||
@@ -16,4 +15,9 @@ const data = await this.staticData(); | ||
// In Ios the height of statusBarHeight in caps needs to be multiplied by pixel ratio | ||
return (caps.statBarHeight || 1) * (caps.pixelRatio || 1); | ||
// For iOS method to fetch statusBarHeight for wdio & wd is different | ||
if (this.driver.wdio) { | ||
return (await this.viewportRect()).top; | ||
} else { | ||
const caps = await this.caps(); | ||
return (caps.statBarHeight || 1) * (caps.pixelRatio || 1); | ||
} | ||
} | ||
@@ -31,3 +35,2 @@ | ||
// We do not use existing functions because user can override those | ||
const caps = await this.caps(); | ||
if (await this.staticData()) { | ||
@@ -37,7 +40,24 @@ const data = await this.staticData(); | ||
} | ||
const height = caps.statBarHeight * caps.pixelRatio + caps.viewportRect?.height; | ||
const width = caps.viewportRect?.width; | ||
let height, width; | ||
// For iOS method to fetch screenSize for wdio & wd is different | ||
if (this.driver.wdio) { | ||
const viewportRect = await this.viewportRect(); | ||
height = viewportRect.top + viewportRect.height; | ||
width = viewportRect.width; | ||
} else { | ||
const caps = await this.caps(); | ||
height = caps.statBarHeight * caps.pixelRatio + caps.viewportRect?.height; | ||
width = caps.viewportRect?.width; | ||
} | ||
return { width, height }; | ||
} | ||
async viewportRect() { | ||
if (this._viewportRect) return this._viewportRect; | ||
this._viewportRect = await this.driver.execute('mobile: viewportRect'); | ||
return this._viewportRect; | ||
} | ||
// Need override because ios does not have desired in caps | ||
@@ -58,3 +78,12 @@ async deviceName() { | ||
async scaleFactor() { | ||
return (await this.caps()).pixelRatio; | ||
// For iOS method to fetch scaleFactor for wdio & wd is different | ||
if (this.driver.wdio) { | ||
const viewportRect = await this.viewportRect(); | ||
const actualWidth = viewportRect.width; | ||
const windowSize = await this.driver.getWindowSize(); | ||
const width = windowSize.width; | ||
return actualWidth / width; | ||
} else { | ||
return (await this.caps()).pixelRatio; | ||
} | ||
} | ||
@@ -61,0 +90,0 @@ } |
@@ -19,2 +19,3 @@ const log = require('../util/log'); | ||
this._navigationBarHeight = navigationBarHeight; | ||
this._viewportRect = null; | ||
} | ||
@@ -21,0 +22,0 @@ |
@@ -1,2 +0,1 @@ | ||
const { Undefined } = require('./validations'); | ||
@@ -3,0 +2,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52377
1242