AppiumTestDistribution / appium-device-farm

This is an Appium 2.0 plugin designed to manage and create driver sessions on available devices.
https://devicefarm.org
Other
329 stars 103 forks source link

Device farm not working correctly for iOS devices #1078

Closed d4v1dk0n7 closed 6 months ago

d4v1dk0n7 commented 6 months ago

Hi all,

I'm experiencing a very strange issue... With iOS devices Device farm is not showing the installed devices, it shows devices with different id's instead. When I look for the installed devices I see this:

imagen

But when I check in Device farm it shows another device id's for the same devices:

imagen

I have tried installing several iOS simulators from XCode, when I install the platform (17.4, 17.2, 15...) the devices are automatically installed and accesible with xcrun simctl command, but always happens the same, the id's of the devices are not the same than in Device farm...

This is the platform I have installed right now...

imagen

In addition to this, if I create a new device the device farm does not shows any changes, the device is not appearing to te used. The same when I delete a device, nothing happens (but the devices that I create are really created and appears with xcrun simctl list command, and I'm able to launch the simulator...)

Due to this I'm not able to execute any tests for iOS...

With android devices all is working perfect, the devices appears (and dissapears when you remove it) and are accesible without problems. Please, I need some help, I'm stuck on this...

Thanks!

Environment

  1. Appium version (or git revision) that exhibits the issue: 2.5.2
  2. Last Appium version that did not exhibit the issue (if applicable):
  3. Node.js version (unless using Appium.app|exe): v21.7.2
  4. Npm or Yarn package manager: npm
  5. Mobile platform/version under test: xcuitest
  6. Real device or emulator/simulator: simulator
  7. Appium CLI or Appium.app|exe: CLI
saikrishna321 commented 6 months ago

@d4v1dk0n7 Can you share full server logs please as gist. Also we use node-simctl module to fetch all local simulators

https://github.com/AppiumTestDistribution/appium-device-farm/blob/main/src/device-managers/IOSDeviceManager.ts#L297-L319

https://github.com/appium/node-simctl

saikrishna321 commented 6 months ago

I'm unable to reproduce the issue

Screenshot 2024-04-14 at 6 46 38 AM
d4v1dk0n7 commented 6 months ago

@d4v1dk0n7 Can you share full server logs please as gist. Also we use node-simctl module to fetch all local simulators

https://github.com/AppiumTestDistribution/appium-device-farm/blob/main/src/device-managers/IOSDeviceManager.ts#L297-L319

https://github.com/appium/node-simctl

Hi @saikrishna321, thanks for your prompt answer!!

Here you have my gist logs: https://gist.github.com/d4v1dk0n7/361253577b476865b610b8155d4e0095

I have also installed node-simctl:

user@HRD-RA-MAC-89 ~ % sudo npm install node-simctl

added 73 packages, and audited 152 packages in 7s

17 packages are looking for funding run npm fund for details

6 vulnerabilities (2 moderate, 1 high, 3 critical)

To address issues that do not require attention, run: npm audit fix

Some issues need review, and may require choosing a different dependency.

Run npm audit for details.

But, for now, it's not working yet... Thanks!

saikrishna321 commented 6 months ago

@d4v1dk0n7 what is the output of

xcrun simctl list

d4v1dk0n7 commented 6 months ago

Hi @saikrishna321,

Finally it was a permissions issue... Running Xcode, appium and the xcrun simctl commands as root allowed me to see the correct devices in Device farm, now I'm also able to delete and create new devices and I can see them in the device pool.

Thank you for your help!!

d4v1dk0n7 commented 6 months ago

Hi @saikrishna321,

I think I've found a real issue here. When you have only one device created, then the Device farm does not shows anything...

imagen imagen imagen

It needs a minimum of 2 devices to find them...

imagen imagen

saikrishna321 commented 6 months ago

@d4v1dk0n7 Will take a look. But might not be immediately. Happy to review PR.

d4v1dk0n7 commented 6 months ago

Hi @saikrishna321,

Sorry to bother you with so many questions... But I have more doubts :)

I can see that the android devices are updated automatically in Device farm, but the iOS devices are not. For example, if I remove an android device it dissapears automatically, but to make dissapear the iOS devices I have to restart appium server... Another thing is that I would like to check if some iOS device is booted or not (I'm checking through the API http://127.0.0.1:31337/device-farm/api/device/), but it's the same, if I boot the iOS device the state of the device in Device farm is not refreshed until I restart the appium server...

Is this the expected behaviour?

Thanks!!

saikrishna321 commented 6 months ago

We only have tracking for ios real devices not for simulators.

Simulators are static.