appium / appium-inspector

A GUI inspector for mobile apps and more, powered by a (separately installed) Appium server
https://appium.github.io/appium-inspector/
Other
1.15k stars 284 forks source link

bug: cannot use `Attach to Session` when using LambdaTest cloud provider #1652

Closed Delta456 closed 1 month ago

Delta456 commented 1 month ago

Is this an issue specifically with Appium Inspector?

Is there an existing issue for this?

Current Behavior

When trying to use Appium inspector's Attach to Session using the LambdaTest cloud provider and entering all credentials. The session ID also automatically comes but when clicked on one it gives Cannot read property 'match' of undefined as shown.

image

Expected Behavior

I expected Attach to Session to work for LambdaTest as other Cloud Providers seem to work correctly

Operating System

Mac

Appium Inspector Version

2024.8.2

Appium Version

No response

Further Information

Perhaps this would be important

image

Also Attach to Session used to work in versions <= 2023.3.1 release.

eglitise commented 1 month ago

This seems like a LambdaTest-specific issue, since they use a slightly different response format. I believe a fix was attempted in #1369, but it spun off into a separate discussion. Looking at the proposed change again, and knowing the adjustments made to have the LambdaTest session show up under Attach to Sessions, I think that fixing this will be fairly straightforward.

Delta456 commented 1 month ago

This seems like a LambdaTest-specific issue, since they use a slightly different response format. I believe a fix was attempted in #1369, but it spun off into a separate discussion. Looking at the proposed change again, and knowing the adjustments made to have the LambdaTest session show up under Attach to Sessions, I think that fixing this will be fairly straightforward.

I see! Can you guide how this fix would be straightforward? I will try to make this work and open a PR.

eglitise commented 1 month ago

The change should be made in app/common/renderer/actions/Session.js, lines 553-555:

        if (attachedSession) {
          attachedSessionCaps = attachedSession.capabilities;
        } else {

I think this could work as a fix:

        if (attachedSession) {
          attachedSessionCaps = attachedSession.capabilities;
          if (session.serverType === SERVER_TYPES.LAMBDATEST) {
            // adjust for LambdaTest-specific format
            if ('capabilities' in attachedSessionCaps) {
              attachedSessionCaps = attachedSessionCaps.capabilities;
            }
            if ('desired' in attachedSessionCaps) {
              attachedSessionCaps = attachedSessionCaps.desired;
            }
          }
        } else {

A PR would be greatly appreciated :) especially because I can't test this myself (I only have local devices on hand)