Skip to content

Commit

Permalink
Merge pull request #279 from calabash/feature/appcenter-test-submit
Browse files Browse the repository at this point in the history
Appcenter test submit
  • Loading branch information
jmoody authored May 8, 2018
2 parents d139e17 + c6c0a1a commit e729d78
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 62 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Gemfile.lock

# Test Cloud
.xtc-credentials
xtc-submit
.appcenter-credentials
testcloud-submit
bin/test-cloud-uploader

# JetBrains
Expand Down
69 changes: 22 additions & 47 deletions bin/xtc.sh → bin/appcenter.sh
Original file line number Diff line number Diff line change
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 @@ -27,21 +28,18 @@ SKIP_IPA_BUILD: iff 1, then skip re-building the ipa.
'make test-ipa' 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_CALABASH: 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,64 +56,41 @@ 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 test-ipa
PREPARE_TC_ONLY="${SKIP_IPA_BUILD}" make test-ipa

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}"
XTC_USER="${XTC_PRODUCTION_USER}"
info "Uploading to Production"
else
API_TOKEN="${XTC_STAGING_API_TOKEN}"
ENDPOINT="${XTC_STAGING_ENDPOINT}"
XTC_USER="${XTC_STAGING_USER}"
info "Uploading to Staging"
fi

# To submit to a pipeline branch, replace <branch> and append to
# PARAMETERS
PIPELINE="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}"
INJECT="inject=${LIB_BEETS};${LIB_CABBAGE};${LIB_CUCUMBER}"

APP_ENV="app_env:ARG_FROM_UPLOADER_FOR_AUT=From-the-CLI-uploader!"
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" \
appcenter test run calabash \
--debug \
--app-path testcloud-submit/TestApp.ipa \
--app App-Center-Test-Cloud/DeviceAgent-TestApp \
--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
28 changes: 14 additions & 14 deletions bin/make/test-ipa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ mkdir -p "${BUILD_PRODUCTS_DIR}"

info "Prepared archive directory"

if [ "${PREPARE_XTC_ONLY}" != "1" ]; then
if [ "${PREPARE_TC_ONLY}" != "1" ]; then
rm -rf "${INSTALL_DIR}"
mkdir -p "${INSTALL_DIR}"

Expand Down Expand Up @@ -112,21 +112,21 @@ if [ "${PREPARE_XTC_ONLY}" != "1" ]; then
fi
banner "Preparing for XTC Submit"

XTC_DIR="xtc-submit"
rm -rf "${XTC_DIR}"
mkdir -p "${XTC_DIR}"
TC_DIR="testcloud-submit"
rm -rf "${TC_DIR}"
mkdir -p "${TC_DIR}"

install_with_ditto cucumber/features "${XTC_DIR}/features"
install_with_ditto cucumber/config/xtc-profiles.yml "${XTC_DIR}/cucumber.yml"
install_with_ditto cucumber/features "${TC_DIR}/features"
install_with_ditto cucumber/config/xtc-profiles.yml "${TC_DIR}/cucumber.yml"
install_with_ditto cucumber/config/xtc-hooks.rb \
"${XTC_DIR}/features/support/01_launch.rb"
install_with_ditto "${INSTALLED_IPA}" "${XTC_DIR}/"
install_with_ditto "${INSTALLED_DSYM}" "${XTC_DIR}/${DSYM}"
mkdir -p "${XTC_DIR}/.xtc"
"${TC_DIR}/features/support/01_launch.rb"
install_with_ditto "${INSTALLED_IPA}" "${TC_DIR}/"
install_with_ditto "${INSTALLED_DSYM}" "${TC_DIR}/${DSYM}"
mkdir -p "${TC_DIR}/.xtc"

rm -rf "${XTC_DIR}/features/.idea"
rm -rf "${TC_DIR}/features/.idea"

cat >"${XTC_DIR}/Gemfile" <<EOF
cat >"${TC_DIR}/Gemfile" <<EOF
source "https://rubygems.org"
gem "calabash-cucumber"
Expand All @@ -135,7 +135,7 @@ gem "rspec", "~> 3.0"
gem "xamarin-test-cloud"
EOF

info "Wrote ${XTC_DIR}/Gemfile with contents"
cat "${XTC_DIR}/Gemfile"
info "Wrote ${TC_DIR}/Gemfile with contents"
cat "${TC_DIR}/Gemfile"

info "Done!"
1 change: 1 addition & 0 deletions cucumber/features/meta.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Given the app has launched
Then I can tell DeviceAgent not to automatically dismiss SpringBoard alerts
Then I can tell DeviceAgent to automatically dismiss SpringBoard alerts

@not_xtc
Scenario: XCUIElement types
Given the app has launched
Then I can compare Xcode element types with DeviceAgent supported element types
Expand Down

0 comments on commit e729d78

Please sign in to comment.