Skip to content

fix: setContext missing return statements#154

Closed
scruff311 wants to merge 1 commit intoappium:mainfrom
scruff311:fix/set-context-missing-return
Closed

fix: setContext missing return statements#154
scruff311 wants to merge 1 commit intoappium:mainfrom
scruff311:fix/set-context-missing-return

Conversation

@scruff311
Copy link

Summary

  • setContext in src/command.ts is missing return statements after the await calls in both the Android (isAndroidUiautomator2DriverSession) and iOS (isXCUITestDriverSession) branches
  • This causes execution to always fall through to throw new Error('setContext is not supported'), even when the context switch succeeds on the driver
  • Added return after each await driver.setContext(...) call so the function exits before reaching the throw

Note that the sibling functions getCurrentContext and getContexts don't have this issue because they use return await, which exits the function. setContext returns void, so the await alone doesn't prevent fall-through.

Fixes #153

…statements

The setContext function was missing return statements after the await
calls in both the Android and iOS branches, causing execution to always
fall through to the throw statement — even when the context switch
succeeded on the driver.

Fixes appium#153
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 6, 2026

CLA Missing ID

Copy link
Member

@KazuCocoa KazuCocoa left a comment

Choose a reason for hiding this comment

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

Thank you!

@KazuCocoa
Copy link
Member

@scruff311 do you have chance to sign the CLA?

@KazuCocoa KazuCocoa changed the title Fix setContext missing return statements fix: setContext missing return statements Feb 7, 2026
@scruff311
Copy link
Author

@scruff311 do you have chance to sign the CLA?

All set

@KazuCocoa
Copy link
Member

It looks like the email used for the git commit might be different from what you used to sign the CLA. Could you double check if both email addresses were the same? @scruff311

Feel free to create a new PR to with proper email if needed

@KazuCocoa
Copy link
Member

1.12.3 includes this fix

@KazuCocoa KazuCocoa closed this Feb 11, 2026
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.

switch_context returns 'setContext is not supported' on iOS (v1.11.0)

3 participants

Comments