Running Appium iOS test in the build pipeline

Bitrise Build Issue Report template

Description of the issue

Hi All,
I am new to bitrise. We are using it to build our app. After the Deploy to bitrise step, I am adding the Appium iOS automation tests in the build pipeline. The tests are triggered but not getting executed. I don’t see any error logs.

Attaching bitrise.yml file. Please let me know what I am missing here.

---
format_version: '11'
default_step_lib_source: 'https://github.com/bitrise-io/bitrise-steplib.git'
project_type: react-native
app:
  envs:
    - FASTLANE_XCODE_LIST_TIMEOUT: '120'
    - FASTLANE_WORK_DIR: ios
    - FASTLANE_LANE: beta
    - BITRISE_PROJECT_PATH: ios/OpenGov.xcworkspace
    - BITRISE_SCHEME: OpenGov
    - GRADLEW_PATH: android/gradlew
    - GRADLE_BUILD_FILE_PATH: android/app/build.gradle
    - BITRISE_JSON_PATH: $BITRISE_SOURCE_DIR/android/google_play_api_key.json
    - BITRISE_ENVIRONMENT_VARIABLE_PATH: /Users/vagrant/git/mobileAppAutomation/cit-mobile-tests/example.env
    - BITRISE_TEST_BUNDLE_ZIP_PATH: /Users/vagrant/deploy/testbundle.zip
    - BITRISE_IPA_PATH: /Users/vagrant/deploy/testbundle.zip
    - BITRISE_APP_DIR_PATH: /Users/vagrant/deploy/OpenGov.app

trigger_map:
  - pull_request_source_branch: '*'
    workflow: primary
    pull_request_target_branch: main
workflows:
  primary:
    steps:
      - activate-ssh-key@4:
          run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
      
      - script@1:
          inputs:
            - content: |-
                #!/bin/bash
                set -ex
                if [ ! -z "$API_BITRISE_SCHEME" ] ; then
                  envman add --key GRADLE_OPTS --value '-Dorg.gradle.jvmargs="-Xmx4608m"'
                  envman add --key _JAVA_OPTIONS --value "-Xmx4608m"
                fi
          title: Setup System Environment
      
      - git-clone@6: {}
     
      - npm@1:
          inputs:
            - command: install

      - certificate-and-profile-installer@1: {}
      
      - cocoapods-install@2.2:
          inputs:
            - source_root_path: $BITRISE_SOURCE_DIR/ios
    
      - xcode-archive@4:
          inputs:
            - perform_clean_action: 'yes'
            - export_development_team: NT8BLPY78G
            - distribution_method: app-store

      # - file-downloader@1:
      #     inputs:
      #       - destination: $BITRISE_JSON_PATH
      #       - source: $BITRISEIO_BITRISE_GOOGLE_SERVICE_FILE_URL
      #     title: Download Google API service.json
      
      # - file-downloader@1:
      #     inputs:
      #       - destination: $HOME/keystores/cit-mobile-upload-key.keystore
      #       - source: $BITRISEIO_ANDROID_KEYSTORE_URL
      #     title: Download Keystore file
      
      # - file-downloader@1:
      #     inputs:
      #       - destination: $BITRISE_SOURCE_DIR/android/app/cit-mobile-upload-key.keystore
      #       - source: $BITRISEIO_ANDROID_KEYSTORE_URL
      #     title: Download KeyStore inside Android

      # - install-missing-android-tools@3: {}
      
      # - gradle-runner@2:
      #     inputs:
      #       - gradle_task: bundleDev
      #     title: Gradle Runner for AAP
      
      # - sign-apk@1: {}
      
      # - google-play-deploy@3:
      #     inputs:
      #       - package_name: com.opengov.cit.app.dev
      #       - service_account_json_key_path: $BITRISE_JSON_PATH
      #       - status: draft
      #       - track: internal
      
      # - gradle-runner@2:
      #     inputs:
      #       - gradle_task: assembleDev
      #     title: Gradle Runner for APK
       
      - deploy-to-bitrise-io@2: {}
      
      # - deploy-to-itunesconnect-application-loader@1:
      #     inputs:
      #       - connection: apple_id
      #       - password: $BITRISE_APPLE_PASS
      #       - platform: ios
      #       - app_password: $BITRISE_APPLE_ASP
      #       - itunescon_user: $BITRISE_APPLE_ASP

      - script@1:
          title: Create Automation Directory
          inputs:
            - content: |-
                #!/usr/bin/env bash
                # fail if any commands fails
                set -e
                # debug log
                set -x
                #Create Automation directory
                mkdir mobileAppAutomation

      - script@1:
          inputs:
            - content: |-
                #!/usr/bin/env bash
                # fail if any commands fails
                set -e
                # debug log
                set -x
                #clone the test automation
                cd mobileAppAutomation
                git clone -b regression_fixes git@bitbucket.org:viewpointcloud/cit-mobile-tests.git
          title: Clone App Test Automation

      - file-downloader@1:
          inputs:
            - destination: $BITRISE_ENVIRONMENT_VARIABLE_PATH
            - source: $BITRISEIO_BITRISE_AUTOMATION_ENV_VARIABLES_URL
          title: Download automation environment vars

      - script@1:
          inputs:
            - content: >-
                set -e
                # debug log
                set -x
                # install appium
                npm install -g appium@1.12.1 --unsafe-perm=true --allow-root appium --default-capabilities '{"showIOSLog": true}' &>/dev/null &
          title: Install and Start the Appium server

      - script@1:
          inputs:
            - content: |-
                set -e
                # debug log
                set -x
                #Install yarn
                brew install yarn
                # Install idevice installer
                npm install -g ios-deploy --unsafe-perm=true --allow-root
                # Install iOS Simulator
                npm install ios-sim -g --unsafe-perm=true --allow-root
          title: Install Appium iOS dependencies
    
      - script@1:
          inputs:
            - content: |-
                #!/usr/bin/env bash
                # fail if any commands fails
                set -e
                # debug log
                set -x
                #Start iPhone 12 simulator
                ios-sim start --devicetypeid com.apple.CoreSimulator.SimDeviceType.iPhone-12-Pro
          title: Start iPhone 12 Pro simulator

      - script@1:
          title: Set Up WebDriver Agent
          inputs:
            - content: >-
                #!/usr/bin/env bash
                #fail if any commands fails
                set -e
                #debug log
                set -x
                #install appium
                npm uninstall -g appium
                npm -g install appium
                npm ls -g appium-webdriveragent
                #Navigate to appium directory where webdriver agent is located
                cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
                #Run the bootstrap script
                bash Scripts/bootstrap.sh -d

      - script@1:
          inputs:
            - content: >-
                #!/usr/bin/env bash
                # fail if any commands fails
                set -e
                # debug log
                set -x
                cp -R $BITRISE_APP_DIR_PATH /mobileAppAutomation/cit-mobile-tests/app-builds/OpenGov.app
                cp $BITRISE_IPA_PATH /mobileAppAutomation/cit-mobile-tests/app-builds/OpenGov.ipa


      # - xcode-build-for-test@1: {}
      # - virtual-device-testing-for-ios@1:
      #     inputs:
      #       - test_devices: 'iphone11pro,14.7,en,portrait'

      - script@1:
          title: Run Appium iOS tests
          inputs:
            - content: |-
                #!/usr/bin/env bash
                # fail if any commands fails
                set -e
                # debug log
                set -x
                # Run iOS appium Test
                cd mobileAppAutomation
                ls -la
                cd cit-mobile-tests/
                #Point Xcode towards the developer directory
                #sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
                #npm install -g appium-doctor
                brew install carthage
                # install appium
                npm install -g appium
                #appium-doctor --ios
                #appium -v
                #Install yarn
                yarn install
                yarn build
                # Run sanity tests
                yarn tests:e2e:ios-app-sanity

    description: 'Xcode Setup '
    meta:
      bitrise.io:
        stack: osx-xcode-13.1.x
        machine_type_id: g2.4core
meta:
  bitrise.io:
    machine_type_id: g2.4core
    stack: osx-xcode-13.1.x

Environment:

Where did the issue happen?

If on Bitrise.io: which stack? If not on Bitrise.io: on what operating system? (Plus any other information you can share)

Which build Step causes the issue and which version of the step?

E.g.: Git Clone v3.6.0

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : YES/NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : YES/NO
  • Does the issue happen sporadically, or every time? :
  • Does upgrading the build Step to the latest version help? : YES/NO
  • When did the issue start? :

Local reproduction

Can it be reproduced on your own Mac/PC by following our local debug guide? Please follow at least the first section (“Testing with a full clean git clone”) to make sure to test the state of the code what bitrise.io will get when it does a git clone in the clean environment! If possible please note which sections you tried.

Local reproduction: Linux / Android (docker based) stack builds

Can it be reproduced by running the build locally, after doing a new git clone of the repository into the /tmp directory and running the build from there with the Bitrise CLI ( Bitrise CLI )? If no, can it be reproduced with Docker (using the same docker images / environment we use on bitrise.io)? Related guide: http://devcenter.bitrise.io/docker/run-your-build-locally-in-docker/ .

Build log

Please copy paste the build’s bitrise.io URL here (or if the issue happens somewhere else then the full logs), or if you can’t share the url / log here then send the url or full log through a private channel (e.g. email - Contact us ), with a link to the related Discuss issue.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.