Skip to content

Commit

Permalink
Bin: update scripts to submit tests in AppCenter instead of XTC
Browse files Browse the repository at this point in the history
  • Loading branch information
polyakrecords committed May 14, 2018
1 parent d39f170 commit 52b092e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 69 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -9,6 +9,7 @@

# App Center/Test Cloud
.xtc-credentials
.appcenter-credentials

calabash.xcodeproj/project.xcworkspace/xcuserdata
calabash.xcodeproj/xcuserdata/
Expand All @@ -23,6 +24,7 @@ calabash-dylibs
*.app
*.ipa
tmp
testcloud-submit

Carthage/Checkouts
Carthage/Build/tvOS
Expand Down
4 changes: 1 addition & 3 deletions README.md
Expand Up @@ -95,9 +95,7 @@ $ make all
# Integration tests
$ make framework
$ make app-cal
$ cd cucumber
$ bundle update
$ bundle exec cucumber
$ bin/test/cucumber.sh
```

If you are running the XCTests from Xcode, you might see failures in
Expand Down
77 changes: 24 additions & 53 deletions bin/xtc.sh → bin/appcenter.sh
Expand Up @@ -9,9 +9,10 @@ if [ -z ${1} ]; then
Examples:
$ bin/xtc.sh e9232255
$ SKIP_IPA_BUILD=1 SERIES='Args and env' bin/xtc.sh e9232255
$ SERIES='DeviceAgent 2.0' bin/xtc.sh e9232255 48d137d6228ccda303b2a71b0d09e1d0629bf980
$ bin/appcenter.sh e9232255
$ bin/appcenter.sh organization/device-set
$ SKIP_IPA_BUILD=1 SERIES='Args and env' bin/appcenter.sh e9232255
$ SERIES='DeviceAgent 2.0' bin/appcenter.sh e9232255 48d137d6228ccda303b2a71b0d09e1d0629bf980
The DeviceAgent-SHA optional argument allows tests to be run against any
DeviceAgent that has been uploaded to S3 rather than the current active
Expand All @@ -24,24 +25,21 @@ Responds to these env variables:
SERIES: the Test Cloud series
SKIP_IPA_BUILD: iff 1, then skip re-building the ipa.
'make test-ipa' will still be called, so changes in the
'make ipa-cal' will still be called, so changes in the
features/ directory will be staged and sent to Test Cloud.
BUILD_RUN_LOOP: iff 1, then rebuild run-loop gem before uploading.
BUILD_RUN_LOOP: iff 1, then rebuild Calabash iOS gem before uploading.
"

exit 64
fi

CREDS=.xtc-credentials
CREDS=.appcenter-credentials
if [ ! -e "${CREDS}" ]; then
error "This script requires a ${CREDS} file"
error "Generating a template now:"
cat >${CREDS} <<EOF
export XTC_PRODUCTION_API_TOKEN=
export XTC_STAGING_API_TOKEN=
export XTC_USER=
export APPCENTER_TOKEN=
EOF
cat ${CREDS}
error "Update the file with your credentials and run again."
Expand All @@ -58,62 +56,35 @@ if [ "${BUILD_RUN_LOOP}" = "1" ]; then
(cd ../run_loop; rake install)
fi

if [ "${BUILD_CALABASH}" = "1" ]; then
gem uninstall -Vax --force --no-abort-on-dependent calabash-cucumber
(cd ../calabash-ios/calabash-cucumber; rake install)
fi

PREPARE_XTC_ONLY="${SKIP_IPA_BUILD}" make ipa-cal
PREPARE_TC_ONLY="${SKIP_IPA_BUILD}" make ipa-cal

cd xtc-submit
(cd testcloud-submit

rm -rf .xtc
mkdir -p .xtc

if [ "${2}" != "" ]; then
echo "${2}" > .xtc/device-agent-sha
fi

if [ "${SERIES}" = "" ]; then
SERIES=master
fi

if [ -z $XTC_ENDPOINT ]; then
API_TOKEN="${XTC_PRODUCTION_API_TOKEN}"
ENDPOINT="${XTC_PRODUCTION_ENDPOINT}"
info "Uploading to Production"
else
API_TOKEN="${XTC_STAGING_API_TOKEN}"
ENDPOINT="${XTC_STAGING_ENDPOINT}"
info "Uploading to Staging"
fi

# To submit to a pipeline branch, replace <branch> and append to
# PARAMETERS
PIPELINE="<branch>"
fi)

S3_ROOT="https://s3-eu-west-1.amazonaws.com/calabash-files/dylibs/to-test-injection"
LIB_BEETS="${S3_ROOT}/libBetaVulgaris.dylib"
LIB_CABBAGE="${S3_ROOT}/libBrassica.dylib"
LIB_CUCUMBER="${S3_ROOT}/libCucurbits.dylib"
INJECT="inject:${LIB_BEETS};${LIB_CABBAGE};${LIB_CUCUMBER}"

APP_ENV="app_env:ARG_FROM_UPLOADER_FOR_AUT=From-the-CLI-uploader!"

# Required for Test Cloud Scenarios to pass.
# Parameters always needs to include these!
PARAMETERS="${APP_ENV} ${INJECT}"

XTC_ENDPOINT="${ENDPOINT}" \
bundle exec test-cloud submit \
TestApp.ipa \
$API_TOKEN \
--user $XTC_USER \
--app-name "TestApp" \
INJECT="inject=${LIB_BEETS};${LIB_CABBAGE};${LIB_CUCUMBER}"
APP_ENV="app_env=ARG_FROM_UPLOADER_FOR_AUT=From-the-CLI-uploader!"

appcenter test run calabash \
--debug \
--app-path testcloud-submit/LPTestTarget.ipa \
--app App-Center-Test-Cloud/LPTestTarget-iOS \
--project-dir testcloud-submit \
--token $APPCENTER_TOKEN \
--devices "${1}" \
--series "${SERIES}" \
--config cucumber.yml \
--config-path cucumber.yml \
--profile default \
--dsym-file "TestApp.app.dSYM" \
--include .xtc \
--test-parameters ${PARAMETERS}
--test-parameter ${INJECT} \
--test-parameter ${APP_ENV} \
--test-series ${SERIES} \
--disable-telemetry
15 changes: 2 additions & 13 deletions bin/make/ipa-cal.sh
Expand Up @@ -104,20 +104,9 @@ DETAILS=`xcrun codesign --display --verbose=2 ${INSTALLED_APP} 2>&1`

echo "$(tput setaf 4)$DETAILS$(tput sgr0)"

banner "Preparing for XTC Submit"
banner "Preparing for AppCenter Submit"

XTC_DOTENV="cucumber/.env"

if [ ! -e "${XTC_DOTENV}" ]; then
info "No cucumber/.env file found."
info "A .env file is required for submitting to Test Cloud"
info "If you are a maintainer, you should have a .env!"
info "Ask jmoody for details"
info "Done!"
exit 0
fi

XTC_DIR="${HOME}/.calabash/xtc/calabash-ios-server/submit"
XTC_DIR="testcloud-submit"
rm -rf "${XTC_DIR}"
mkdir -p "${XTC_DIR}"

Expand Down

0 comments on commit 52b092e

Please sign in to comment.