首页 > 解决方案 > IOS Device Farm Appium Webdriverio 问题

问题描述

我的团队面临一个关于在 Ios 设备上运行测试的问题,它们运行速度非常慢,每台设备大约需要 19 分钟,在一些 ios 为 13 的设备上,应用程序未打开。在 IOS 13 上安装了应用程序,但未安装 WDA,也未打开该应用程序。

在本地,我们有 Xcode 11.1、node 11.6.0、appium 1.17.1 一切都在本地环境中运行良好且快速。仅供参考,Android 完美运行需要 7 分钟,设备场才能运行整个测试。

我们使用的 YAML 文件是 aws device farm 提供的最新文件。

version: 0.1

# Phases are collection of commands that get executed on Device Farm.
phases:
  # The install phase includes commands that install dependencies that your tests use.
  # Default dependencies for testing frameworks supported on Device Farm are already installed.
  install:
    commands:
      - export APPIUM_VERSION=1.17.1
      - 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
      - echo "Node version"
      - node --version
      - echo "NPM version"
      - npm --version
      - echo "Installing wdio globally"
      - npm install -g webdriverio @wdio/cli

      - >-
        if [ $(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


  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;

  # The test phase includes commands that run your test suite execution.
  test:
    commands:

      - cd $DEVICEFARM_TEST_PACKAGE_PATH
      - npm run test:ios

项目链接

标签: iosappiumios13webdriver-ioaws-device-farm

解决方案


在 iOS 13.3.1 上存在一个已知问题,即在使用 Appium 时应用程序无法打开,并且已在 13.4 中得到修复。有关此问题的更多详细信息 - https://github.com/appium/appium/issues/13927


推荐阅读