Device Farm iOS Runtime not found

0

I'm trying to run a project built with Appium and webdriver.IO on iOS devices using Device Farm. The project is based on this boiler template provided by webdriver.IO (https://github.com/webdriverio/appium-boilerplate), but I'm not able to connect with the device.

Here is what I have on my test spec yml:

version: 0.1

phases:
  install:
    commands:
      - export APPIUM_VERSION=1.19.0
      - avm $APPIUM_VERSION
      - ln -s /usr/local/avm/versions/$APPIUM_VERSION/node_modules/.bin/appium  /usr/local/avm/versions/$APPIUM_VERSION/node_modules/appium/bin/appium.js

      - >-
        if [ $(echo $APPIUM_VERSION | cut -d "." -f2) -ge 19 ];
        then
          DEVICEFARM_DEVICE_UDID_FOR_APPIUM=$(echo $DEVICEFARM_DEVICE_UDID | tr -d "-");
          DEVICEFARM_WDA_DERIVED_DATA_PATH=$DEVICEFARM_WDA_DERIVED_DATA_PATH_V6;
        elif [ $(echo $APPIUM_VERSION | cut -d "." -f2) -ge 18 ];
        then
          DEVICEFARM_DEVICE_UDID_FOR_APPIUM=$(echo $DEVICEFARM_DEVICE_UDID | tr -d "-");
          DEVICEFARM_WDA_DERIVED_DATA_PATH=$DEVICEFARM_WDA_DERIVED_DATA_PATH_V5;
        elif [ $(echo $APPIUM_VERSION | cut -d "." -f2) -ge 17 ];
        then
          DEVICEFARM_DEVICE_UDID_FOR_APPIUM=$(echo $DEVICEFARM_DEVICE_UDID | tr -d "-");
          DEVICEFARM_WDA_DERIVED_DATA_PATH=$DEVICEFARM_WDA_DERIVED_DATA_PATH_V4;
        elif [ $(echo $APPIUM_VERSION | cut -d "." -f2) -ge 16 ];
        then
          DEVICEFARM_DEVICE_UDID_FOR_APPIUM=$(echo $DEVICEFARM_DEVICE_UDID | tr -d "-");
          DEVICEFARM_WDA_DERIVED_DATA_PATH=$DEVICEFARM_WDA_DERIVED_DATA_PATH_V3;
        elif [ $(echo $APPIUM_VERSION | cut -d "." -f2) -ge 15 ];
        then
          DEVICEFARM_DEVICE_UDID_FOR_APPIUM=$(echo $DEVICEFARM_DEVICE_UDID | tr -d "-");
          DEVICEFARM_WDA_DERIVED_DATA_PATH=$DEVICEFARM_WDA_DERIVED_DATA_PATH_V2;
        else
          DEVICEFARM_DEVICE_UDID_FOR_APPIUM=$DEVICEFARM_DEVICE_UDID;
          DEVICEFARM_WDA_DERIVED_DATA_PATH=$DEVICEFARM_WDA_DERIVED_DATA_PATH_V1;
        fi

      - nvm install 14.18.3

      - echo "Navigate to test package directory"
      - cd $DEVICEFARM_TEST_PACKAGE_PATH
      - npm install *.tgz

  pre_test:
    commands:
      - echo "Start appium server"
      - >-
        appium --log-timestamp
        --default-capabilities "{\"usePrebuiltWDA\": true, \"derivedDataPath\":\"$DEVICEFARM_WDA_DERIVED_DATA_PATH\",
        \"deviceName\": \"$DEVICEFARM_DEVICE_NAME\", \"platformName\":\"$DEVICEFARM_DEVICE_PLATFORM_NAME\", \"app\":\"$DEVICEFARM_APP_PATH\",
        \"automationName\":\"XCUITest\", \"udid\":\"$DEVICEFARM_DEVICE_UDID_FOR_APPIUM\", \"platformVersion\":\"$DEVICEFARM_DEVICE_OS_VERSION\"}"
        >> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &

      - >-
        start_appium_timeout=0;
        while [ true ];
        do
            if [ $start_appium_timeout -gt 60 ];
            then
                echo "appium server never started in 60 seconds. Exiting";
                exit 1;
            fi;
            grep -i "Appium REST http interface listener started on 0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1;
            if [ $? -eq 0 ];
            then
                echo "Appium REST http interface listener started on 0.0.0.0:4723";
                break;
            else
                echo "Waiting for appium server to start. Sleeping for 1 second";
                sleep 1;
                start_appium_timeout=$((start_appium_timeout+1));
            fi;
        done;
  test:
    commands:
      - echo "Navigate to test code directory"
      - cd $DEVICEFARM_TEST_PACKAGE_PATH/node_modules/my-project
      - echo "Start Appium Node test"
      - npm run ios.app

  post_test:
    commands:
artifacts:
  - $DEVICEFARM_LOG_DIR

When it reaches the test command it fails with this error:

[0-0] 2022-10-12T18:40:09.878Z INFO webdriver: [POST] http://localhost:4723/session
[0-0] 2022-10-12T18:40:09.878Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       platformName: 'iOS',
[0-0]       'appium:platformVersion': '15.0',
[0-0]       'appium:deviceName': '00008110-000168240242801E',
[0-0]       'appium:udid': '00008110000168240242801E',
[0-0]       'appium:orientation': 'PORTRAIT',
[0-0]       'appium:automationName': 'XCUITest',
[0-0]       'appium:autoAcceptAlerts': true,
[0-0]       'appium:app': '/tmp/scratchKIhaym.scratch/share-jDiY7x.scratch/app-UNungi.ipa',
[0-0]       'appium:newCommandTimeout': 240
[0-0]     },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: {
[0-0]     platformName: 'iOS',
[0-0]     'appium:platformVersion': '15.0',
[0-0]     'appium:deviceName': '00008110-000168240242801E',
[0-0]     'appium:udid': '00008110000168240242801E',
[0-0]     'appium:orientation': 'PORTRAIT',
[0-0]     'appium:automationName': 'XCUITest',
[0-0]     'appium:autoAcceptAlerts': true,
[0-0]     'appium:app': '/tmp/scratchKIhaym.scratch/share-jDiY7x.scratch/app-UNungi.ipa',
[0-0]     'appium:newCommandTimeout': 240
[0-0]   }
[0-0] }
[0-0] 2022-10-12T18:45:09.895Z ERROR webdriver: Request failed with status undefined due to TimeoutError: Timeout awaiting 'request' for 300000ms when running "http://localhost:4723/session" with method "POST" and args "{"capabilities":{"alwaysMatch":{"platformName":"iOS","appium:platformVersion":"15.0","appium:deviceName":"00008110-000168240242801E","appium:udid":"00008110000168240242801E","appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:autoAcceptAlerts":true,"appium:app":"/tmp/scratchKIhaym.scratch/share-jDiY7x.scratch/app-UNungi.ipa","appium:newCommandTimeout":240},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"iOS","appium:platformVersion":"15.0","appium:deviceName":"00008110-000168240242801E","appium:udid":"00008110000168240242801E","appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:autoAcceptAlerts":true,"appium:app":"/tmp/scratchKIhaym.scratch/share-jDiY7x.scratch/app-UNungi.ipa","appium:newCommandTimeout":240}}"
[0-0] 2022-10-12T18:45:09.895Z ERROR webdriver: TimeoutError: Timeout awaiting 'request' for 300000ms when running "http://localhost:4723/session" with method "POST" and args "{"capabilities":{"alwaysMatch":{"platformName":"iOS","appium:platformVersion":"15.0","appium:deviceName":"00008110-000168240242801E","appium:udid":"00008110000168240242801E","appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:autoAcceptAlerts":true,"appium:app":"/tmp/scratchKIhaym.scratch/share-jDiY7x.scratch/app-UNungi.ipa","appium:newCommandTimeout":240},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"iOS","appium:platformVersion":"15.0","appium:deviceName":"00008110-000168240242801E","appium:udid":"00008110000168240242801E","appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:autoAcceptAlerts":true,"appium:app":"/tmp/scratchKIhaym.scratch/share-jDiY7x.scratch/app-UNungi.ipa","appium:newCommandTimeout":240}}"
[0-0]     at getTimeoutError (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/webdriver/build/utils.js:320:24)
[0-0]     at NodeJSRequest._request (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/webdriver/build/request/index.js:154:59)
[0-0]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
[0-0]     at async startWebDriverSession (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/webdriver/build/utils.js:67:20)
[0-0]     at async Function.newSession (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/webdriver/build/index.js:46:45)
[0-0]     at async remote (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/webdriverio/build/index.js:77:22)
[0-0]     at async Runner._startSession (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/@wdio/runner/build/index.js:223:56)
[0-0]     at async Runner._initSession (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/@wdio/runner/build/index.js:176:25)
[0-0]     at async Runner.run (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/@wdio/runner/build/index.js:88:19)
[0-0] 2022-10-12T18:45:09.903Z ERROR @wdio/runner: Error: Failed to create session.
[0-0] Timeout awaiting 'request' for 300000ms when running "http://localhost:4723/session" with method "POST" and args "{"capabilities":{"alwaysMatch":{"platformName":"iOS","appium:platformVersion":"15.0","appium:deviceName":"00008110-000168240242801E","appium:udid":"00008110000168240242801E","appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:autoAcceptAlerts":true,"appium:app":"/tmp/scratchKIhaym.scratch/share-jDiY7x.scratch/app-UNungi.ipa","appium:newCommandTimeout":240},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"iOS","appium:platformVersion":"15.0","appium:deviceName":"00008110-000168240242801E","appium:udid":"00008110000168240242801E","appium:orientation":"PORTRAIT","appium:automationName":"XCUITest","appium:autoAcceptAlerts":true,"appium:app":"/tmp/scratchKIhaym.scratch/share-jDiY7x.scratch/app-UNungi.ipa","appium:newCommandTimeout":240}}"
[0-0]     at startWebDriverSession (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/webdriver/build/utils.js:72:15)
[0-0]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
[0-0]     at async Function.newSession (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/webdriver/build/index.js:46:45)
[0-0]     at async remote (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/webdriverio/build/index.js:77:22)
[0-0]     at async Runner._startSession (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/@wdio/runner/build/index.js:223:56)
[0-0]     at async Runner._initSession (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/@wdio/runner/build/index.js:176:25)
[0-0]     at async Runner.run (/private/tmp/scratchKIhaym.scratch/test-packageGHSSfw/node_modules/appium-qa-mobile-automation/node_modules/@wdio/runner/build/index.js:88:19)
2022-10-12T18:45:10.037Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
asked 2 years ago130 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions