Skip to content

fix: skip the webview scan when switching to the native context - #1111

Merged
KazuCocoa merged 1 commit into
appium:masterfrom
chinmayajha:fix/skip-webview-scan-for-native
Oct 20, 2026
Merged

KazuCocoa merged 1 commit into
appium:masterfrom
chinmayajha:fix/skip-webview-scan-for-native

Conversation

@chinmayajha

Copy link
Copy Markdown
Contributor

setContext in lib/commands/context/exports.ts runs getWebViewsMapping on every switch, including a switch back to NATIVE_APP. The native context is always in the list, and the native branch of switchContext never reads the mapping. When a debuggable app's WebView is frozen in the background, its devtools socket accepts connections but never answers. Every scan then waits out the 2 s CDP timeout (CDP_REQ_TIMEOUT), so each switch back to native spends about 2 s in a scan it does not need.

Skip the scan when the target is NATIVE_APP, which xcuitest-driver's setContext already does. Switches to webviews still scan and still throw NoSuchContextError. A new unit test covers the native switch; it fails on master and passes with this change. The commit cherry-picks cleanly onto beta.

Validation: TypeScript build, lint, format:check and all 266 unit tests pass. No device or emulator end-to-end run.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: chinmayajha / name: Chinmay Jha (2c70136)

@KazuCocoa
KazuCocoa merged commit 78e796a into appium:master Oct 20, 2026
5 checks passed
github-actions Bot pushed a commit that referenced this pull request Oct 20, 2026
## [14.2.5](v14.2.4...v14.2.5) (2026-10-20)

### Bug Fixes

* skip the webview scan when switching to the native context ([#1111](#1111)) ([78e796a](78e796a))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 14.2.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chinmayajha
chinmayajha deleted the fix/skip-webview-scan-for-native branch October 20, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants