I need run appium test on ios real device in jenkins. I have jenkins on local machine.
My settings test:
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “IOS”);
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “11.2.1”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “Iphone”);
capabilities.setCapability(MobileCapabilityType.UDID, 74859bb7c435945dafd8691be871ef96905030322);
capabilities.setCapability(MobileCapabilityType.APP, “/Users/TEST/Library/Developer/Xcode/DerivedData/WebDriverAgent-cvqckynzuuktkogfpkkkgyompmoj/Build/Products/Debug-iphoneos/IntegrationApp.app”);
Test successfully run if i run it in Intellij Idea + maven (mvn test) BUT when i run test in jenkins i have error:
/START APPIUM SERVER/…
[Appium] Creating new XCUITestDriver (v2.68.0) session
[Appium] Capabilities:
[Appium] app: /Users/TEST/Library/Developer/Xcode/DerivedData/WebDriverAgent-cvqckynzuuktkogfpkkkgyompmoj/Build/Products/Debug-iphoneos/IntegrationApp.app
[Appium] platformVersion: 11.2.1
[Appium] platformName: IOS
[Appium] udid: 74859bb7c435945dafd8691be871ef96905030322
[Appium] deviceName: Iphone
[BaseDriver] Expected W3C “capabilities” to be a JSON Object but was provided with: []
[BaseDriver] Falling back to MJSONWP desired capabilities
[BaseDriver] Session created with session id: b1797f6a-47ec-4dfc-8099-abc01aeaf878
[XCUITest] The ‘idevice_id’ program is not installed. If you are running a real device test it is necessary. Install with ‘brew install libimobiledevice --HEAD’
[XCUITest] Error: Unknown device or simulator UDID: ‘74859bb7c435945dafd8691be871ef96905030322’
BUT libimobiledevice is already installed
I’m having the same issue, and I believe it’s because it’s running as Jenkins user instead of current user, and it’e unable to find connected device associated with Jenkins user.
I"m guessing I have to add or modify a plugin to to change the path where it looks for the device.
[debug] [XCUITest] Current user: ‘jenkins’
[XCUITest] The ‘idevice_id’ program is not installed. If you are running a real device test it is necessary. Install with ‘brew install libimobiledevice --HEAD’
[debug] [XCUITest] Available devices:
[XCUITest] Error: Unknown device or simulator UDID: ‘c8be317ecec81cd9b8d06b47bcb575a7f46ced57’
[XCUITest] at /Users/mpsadmin/.nvm/versions/node/v11.0.0/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:707:17
first - say how you run your test job with jenkins. does the job runs on same machine where jenkins runs or on slave
to check PATH issue add into jenkins job command “echo $PATH” and check - does it show ALLLL paths as you do it manually on machine where you have NO problem to run your test.
// I set it to use the path that maven uses.
export PATH=/Users/mpsadmin/.nvm/versions/node/v11.0.0/bin:/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin:/Users/mpsadmin/Library/Android/sdk/tools:/Users/mpsadmin/Library/Android/sdk/platform-tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
echo $PATH
And I still go the error:
[debug] [XCUITest] Current user: ‘jenkins’
[XCUITest] The ‘idevice_id’ program is not installed. If you are running a real device test it is necessary. Install with ‘brew install libimobiledevice --HEAD’
[debug] [XCUITest] Available devices:
I did logout as current user and login as jenkins user, and I verified libimobiledevice was installed, and I ran idevice_id -l, and saw my device existed.
I’m not sure why it’s still trying to execute the idevice program as the jenkins user instead of the current user. I’m trying to locate where that path is being set. It would be nice if you could do it by port instead of user.
When I run the test from Eclipse = Pass
When I run the test from Eclipse using Maven = Pass
When I run the test from Jenkins = Failed.
Not sure what the Falling back to MJSONWP desired capabillities means, but I’m reasearching.
[BaseDriver] Falling back to MJSONWP desired capabilities
[BaseDriver] Session created with session id: 622a4c32-8183-4155-9a41-8a9723da9b96
[debug] [XCUITest] Current user: ‘jenkins’
[XCUITest] The ‘idevice_id’ program is not installed. If you are running a real device test it is necessary.
It ran successfully through the maven command from terminal as well.
I decided to update everything to latest( Selenium, Appium) hoping that would fix the issue, but I fucked something up.
I’m getting the below error now.
From Eclipse & Maven:
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/internal/ApacheHttpClient$Factory
at AutomationCode.TestCases.A1_ValidateInvalidCredentialMessage(TestCases.java:266)
I did notice that when I ran appium-doctor a warning came up that the ios command line tools were not installed. I wonder if that caused my issues with attaching to the iOS device.