Skip to content

fix(@wdio/utils): properly detect Appium browser sessions#13949

Merged
christian-bromann merged 2 commits intomainfrom
cb/fix-env-detection-appium-web
Dec 9, 2024
Merged

fix(@wdio/utils): properly detect Appium browser sessions#13949
christian-bromann merged 2 commits intomainfrom
cb/fix-env-detection-appium-web

Conversation

@christian-bromann
Copy link
Member

Proposed changes

fixes #13947

Types of changes

  • Polish (an improvement for an existing feature)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Backport Request

//: # (The current main branch is the development branch for WebdriverIO v9. If your change should be released to the current major version of WebdriverIO (v8), please raise another PR with the same changes against the v8 branch.)

  • This change is solely for v9 and doesn't need to be back-ported
  • Back-ported PR at #XXXXX

Further comments

n/a

Reviewers: @webdriverio/project-committers

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 6, 2024

Open in Stackblitz

eslint-plugin-wdio

npm i https://pkg.pr.new/webdriverio/webdriverio/eslint-plugin-wdio@13949

@wdio/allure-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/allure-reporter@13949

@wdio/appium-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/appium-service@13949

@wdio/browser-runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/browser-runner@13949

@wdio/browserstack-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/browserstack-service@13949

@wdio/cli

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/cli@13949

@wdio/concise-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/concise-reporter@13949

@wdio/config

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/config@13949

@wdio/cucumber-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/cucumber-framework@13949

@wdio/dot-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/dot-reporter@13949

@wdio/firefox-profile-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/firefox-profile-service@13949

@wdio/globals

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/globals@13949

@wdio/jasmine-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/jasmine-framework@13949

@wdio/json-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/json-reporter@13949

@wdio/junit-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/junit-reporter@13949

@wdio/lighthouse-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/lighthouse-service@13949

@wdio/local-runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/local-runner@13949

@wdio/logger

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/logger@13949

@wdio/mocha-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/mocha-framework@13949

@wdio/protocols

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/protocols@13949

@wdio/repl

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/repl@13949

@wdio/reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/reporter@13949

@wdio/runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/runner@13949

@wdio/sauce-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/sauce-service@13949

@wdio/shared-store-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/shared-store-service@13949

@wdio/smoke-test-cjs-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-cjs-service@13949

@wdio/smoke-test-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-reporter@13949

@wdio/smoke-test-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-service@13949

@wdio/spec-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/spec-reporter@13949

@wdio/static-server-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/static-server-service@13949

@wdio/sumologic-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/sumologic-reporter@13949

@wdio/testingbot-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/testingbot-service@13949

@wdio/types

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/types@13949

@wdio/utils

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/utils@13949

@wdio/webdriver-mock-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/webdriver-mock-service@13949

webdriver

npm i https://pkg.pr.new/webdriverio/webdriverio/webdriver@13949

webdriverio

npm i https://pkg.pr.new/webdriverio/webdriverio@13949

commit: 51fce64

@wswebcreation wswebcreation self-requested a review December 7, 2024 18:53
/**
* it is _not_ a mobile session if automationName is set to start a mobile session
*/
const automationName = capabilities['appium:options']?.automationName || capabilities['appium:automationName']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christian-bromann

this is strange, we are automating a mobile device, but only, if I understand it correctly, with a "browser driver". Shouldn't we introduce a new flag for this and use that to exclude specific mobile commands for non-mobile browser drivers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are automating a mobile device

No, we are using Appium to automate a browser.

Shouldn't we introduce a new flag for this and use that to exclude specific mobile commands for non-mobile browser drivers?

I think there is a difference here, users can:

  • run a browser session on a mobile device: WebdriverIO properly detects this and sets isMobile to true (which I am not sure is right), however Appium in this case supports getContext (I think)
  • we are using Appium to automate a desktop browser, here isMobile should be false but was detected as true

This patch fixes the second case. I would need more investigation to better understand the first case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christian-bromann

This link/config from @mykola-mokhnach suggests something else. This is FF on Android which would still be a mobile session.

run a browser session on a mobile device: WebdriverIO properly detects this and sets isMobile to true (which I am not sure is right), however Appium in this case supports getContext (I think)
From what I know the default drivers (appium-xcuitest-driver and appium-uiautomator2-driver) can automate both, meaning web and native. That's the reason why they support the getContext.

For now we can proceed with this change, but then we need to add a comment to the code that we need to rethink this logic

Co-authored-by: Wim Selles <wim@wswebcreation.nl>
@christian-bromann christian-bromann merged commit 832f1b7 into main Dec 9, 2024
@christian-bromann christian-bromann deleted the cb/fix-env-detection-appium-web branch December 9, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: WDIO 9.4.1 fails to create a session with chromedriver or geckodriver

2 participants