Skip to content

Instantly share code, notes, and snippets.

@rafaelcs
Created January 11, 2019 05:47
Show Gist options
  • Save rafaelcs/a89b8101873e75746a2ce27014c4c5e6 to your computer and use it in GitHub Desktop.
Save rafaelcs/a89b8101873e75746a2ce27014c4c5e6 to your computer and use it in GitHub Desktop.
File to integrate UI tests with Appium on Buddybuild
#!/usr/bin/env bash
chruby 2.5.1
echo $'=== Building App for Simulator ==='
APP_ID_FOLDER='/tmp/sandbox/'$BUDDYBUILD_APP_ID'/bbtest'
xcodebuild -project "[your_app_name].xcodeproj" \
-scheme "$BUDDYBUILD_SCHEME" \
-configuration "Debug" \
-destination "platform=iOS Simulator,OS=12.1,name=iPhone 7" \
-derivedDataPath $APP_ID_FOLDER \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_ALLOWED=NO \
ENABLE_BITCODE=NO \
ONLY_ACTIVE_ARCH=YES \
DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
echo $'=== Installing Appium ==='
# Upgrade npm
npm i npm@latest -g
# Install Appium
npm install -g appium
echo $'=== Installing authorize-ios ==='
npm install -g authorize-ios
sudo authorize-ios
echo $'=== Installing rubygems ==='
sudo gem install bundler
bundle update
echo $'=== Running Appium in background process ==='
nohup appium &
echo $! > $BUDDYBUILD_WORKSPACE/appium_pid.txt
export APP_PATH=$APP_ID_FOLDER'/Build/Products/Debug-iphonesimulator/[your_app_name].app'
echo $'=== Clone test project and install dependencies ==='
git clone https://github.com/[your_company]/[your_repository].git
# Bundle install
bundle install
echo $'=== Run UI tests ==='
bundle exec rspec --format doc spec/*.rb
echo $'=== Kill Appium process ==='
# Cleanup Appium process
kill -9 `cat $BUDDYBUILD_WORKSPACE/appium_pid.txt`
rm $BUDDYBUILD_WORKSPACE/appium_pid.txt
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment