Skip to content

fix(lambdatest): fix session listing and attach-to-session for LambdaTest (TE-13124)#30

Open
SahilSawLT wants to merge 1357 commits into
LambdaTest:mainfrom
SahilSawLT:TE-13124-appium-inspector-fixes
Open

fix(lambdatest): fix session listing and attach-to-session for LambdaTest (TE-13124)#30
SahilSawLT wants to merge 1357 commits into
LambdaTest:mainfrom
SahilSawLT:TE-13124-appium-inspector-fixes

Conversation

@SahilSawLT

@SahilSawLT SahilSawLT commented Jun 1, 2026

Copy link
Copy Markdown

Summary

Fixes Appium Inspector web browser version support for LambdaTest mobile sessions.

JIRA: TE-13124

Changes

1. Session listing via LTMA API

When the server type is TESTMUAI, fetch running sessions directly from the LambdaTest Test Management API instead of /wd/hub/sessions. This is needed because /wd/hub/sessions only returns App sessions (RD App, VD App) — web sessions (RD Web, VD Web) are not included. The LTMA endpoint returns all 4 mobile surfaces.

The LTMA host is derived from the configured hub host:

  • mobile-hub.lambdatest.comapi.lambdatest.com
  • hub-{cluster}.lambdatestinternal.comapi-{cluster}.lambdatestinternal.com
  • mobile-hub-{cluster}.lambdatestinternal.comapi-{cluster}.lambdatestinternal.com

2. Capabilities unwrapping for manual session ID entry

When the user manually types a session ID (cache-miss path), MHPS returns nested capabilities:

{"value": {"capabilities": {"desired": {"platformName": "Android"}}, "sessionId": "abc"}}

Unwrap after res.value — matching the existing // adjust for TestMu AI-specific format pattern already present in the cached sessions path.

3. appMode fix for web sessions

After attaching to a session, appMode (NATIVE vs WEB) was always NATIVE because sessionCaps.browserName is empty when the user only provided a session ID. Fixed by using driver.capabilities.browserName for attached sessions, which is populated from the actual running session after a successful attach.

Test plan

  • RD App session appears in "Attach to Session" list and attaches correctly
  • RD Web session appears and attaches with correct appMode (WEB not NATIVE)
  • VD App session appears and attaches correctly
  • VD Web session appears and attaches with correct appMode
  • Desktop Electron app unaffected (no CORS restriction, no code change to Electron path)
  • Non-LambdaTest server types unaffected

🤖 Generated with Claude Code

renovate Bot and others added 30 commits March 6, 2026 16:51
…#2683)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…#2688)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…#2698)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: eglitise <37242620+eglitise@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…um#2701)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: eglitise <37242620+eglitise@users.noreply.github.com>
* test: update getOptimalXpath tests

* address copilot comments
renovate Bot and others added 30 commits June 13, 2026 16:39
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: eglitise <37242620+eglitise@users.noreply.github.com>
…appium#2926)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
* refactor: move locator search & Siri imports to header

* refactor: split App Source into smaller components
)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…appium#2932)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
appium#2933)

Bumps the npm_and_yarn group with 1 update in the / directory: [js-yaml](https://github.com/nodeca/js-yaml).


Updates `js-yaml` from 4.1.1 to 4.2.0
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/commits)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.2.0
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ppium#2934)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Bumps the npm_and_yarn group with 1 update in the / directory: [undici](https://github.com/nodejs/undici).


Updates `undici` from 6.26.0 to 6.27.0
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v6.26.0...v6.27.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 6.27.0
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: eglitise <37242620+eglitise@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…ppium#2947)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
When attaching to an existing session that has a browserName, the inspector
navigated the browser to appium.io, discarding the page the user's test was
already on. Only navigate when we created the session ourselves; when
attaching (attachSessId is set), leave the current page untouched. appMode
still switches to WEB_HYBRID in both cases.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fetch running sessions from both the provider session-list API (derived from
the hub host) and the standard /wd/hub/sessions endpoint, then merge the
results so app and web sessions both appear when attaching. Failures from
either source are tolerated so one unavailable endpoint doesn't hide the
sessions returned by the other.

Extract the logic into a dedicated fetchTestMuAISessions() helper, mirroring
the existing fetchAllSessions() so getRunningSessions stays a thin dispatcher.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…estMu AI

mobile:getContexts can drop real webviews (the strict Android parser filters
unattached / non-'page' entries) or emit duplicate entries whose IDs the
driver won't accept (chrome browser tabs all collapsing to one webview ID),
causing "No such context found" on switch.

For TestMu AI sessions, use the standard /contexts endpoint as the source of
truth for which context IDs exist, enriched with mobile:getContexts metadata
(title/url) where IDs match. All other server types keep the existing
behavior unchanged. The server type is threaded into InspectorDriver so the
branch is scoped to TestMu AI only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add braces to the single-line if statements flagged by the `curly` ESLint
rule (npm run lint). No behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Run `npm run prettier` to satisfy the format check: expand the curly-rule
braces in unwrapTestMuAICaps onto their own lines and wrap the
attachedSessionCaps ternary. No behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Per maintainer feedback on appium#2892, the
mobile:getContexts vs /contexts inconsistency should be fixed in the
uiautomator2 driver rather than worked around in the vendor-agnostic
Inspector core. Revert the /contexts-authoritative context logic and the
serverType plumbing on InspectorDriver. Root cause tracked in appium/appium#22423.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When attaching to an existing session, sessionCaps never carries
browserName, so reading it from driver.capabilities benefits all server
types. Drop the TestMu AI gating per review feedback on
appium#2892.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies documentation Improvements or additions to documentation fix i18n

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants