Skip to content
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

Merged
merged 3 commits into from
Apr 23, 2024
Merged

Appium v2 Support for wdio #280

merged 3 commits into from
Apr 23, 2024

Conversation

pankaj443
Copy link
Contributor

JIRA: https://browserstack.atlassian.net/browse/PAPP-457
Update WDIO flow to use execute viewportRect for getting deviceSize and pixel ratio.

@pankaj443 pankaj443 requested a review from a team as a code owner April 22, 2024 08:33
}

// 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 */
Copy link
Contributor

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 ?

Copy link
Contributor Author

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

}

// 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') {
Copy link
Contributor

@ninadbstack ninadbstack Apr 22, 2024

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.

Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor

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 ]

Copy link
Contributor Author

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) {
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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

ninadbstack
ninadbstack previously approved these changes Apr 23, 2024
@pankaj443 pankaj443 merged commit 7fa5f7e into master Apr 23, 2024
5 checks passed
@pankaj443 pankaj443 deleted the PAPP_457 branch April 23, 2024 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants