-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Appium v2 Support for wdio #280
Conversation
percy/metadata/metadata.js
Outdated
} | ||
|
||
// items that need caps are moved to getters as caps are not stored on wd driver object | ||
// So we need to make a lazy call to avoid making session get call in app automate context | ||
async caps() { | ||
return await this.driver.getCapabilities(); | ||
/* istanbul ignore next */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we adding this on all if conditions ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed, have only kept which are specific to ios
percy/metadata/metadata.js
Outdated
} | ||
|
||
// items that need caps are moved to getters as caps are not stored on wd driver object | ||
// So we need to make a lazy call to avoid making session get call in app automate context | ||
async caps() { | ||
return await this.driver.getCapabilities(); | ||
/* istanbul ignore next */ | ||
if (typeof browser !== 'undefined') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we accessing global browser here ? it shouldnt be directly accessed, we already have reference in this.driver. Please update driver wrapper instead of metadata class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to use driver.wdio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No i mean we should do any driver specific things in the adaptor class [ the driverWrapper class ] and not in any other part of codebase. you can update methods there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also while this seems to rely on global browser object to be available, which is usually true in wdio, but its not necessary. Users can also write a script that does not use global browser [ and so adaptor checks for type of passed driver instead ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ninadbstack yes i have moved caps in driverWrapper only, others which were specific to ios only I have kept in iosMetadata.
if (await this.staticData()) { | ||
const data = await this.staticData(); | ||
return data.statusBarHeight * data.pixelRatio; | ||
} | ||
|
||
// In Ios the height of statusBarHeight in caps needs to be multiplied by pixel ratio | ||
return (caps.statBarHeight || 1) * (caps.pixelRatio || 1); | ||
if (this.driver.wdio) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kept it here since its ios specific
const width = caps.viewportRect?.width; | ||
|
||
var height, width; | ||
if (this.driver.wdio) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kept it here since its ios specific
@@ -51,7 +69,15 @@ class IosMetadata extends Metadata { | |||
} | |||
|
|||
async scaleFactor() { | |||
return (await this.caps()).pixelRatio; | |||
if (this.driver.wdio) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kept it here since its ios specific
JIRA: https://browserstack.atlassian.net/browse/PAPP-457
Update WDIO flow to use execute viewportRect for getting deviceSize and pixel ratio.