#!/usr/bin/env bash # Cotton Data Dev walked on a simulator by its UI tests (apps/cotton/UITests/Data), against the dev server only. # # DATA_TEST= bash scripts/data-walk.sh [derived data] # # A walk that signs in reads the invented account from the environment: WALK_COTTON_PHONE, and the files named by # WALK_COTTON_CODE_FILE (its sign-in code) and WALK_COTTON_RECOVERY_FILE (its recovery code). The codes go to the # test runner's environment only, never to the log or a picture. set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" UDID=${1:?simulator udid} DERIVED=${2:-$ROOT/.derived-data-walk} export COTTON_FLAVOR=dev if [ -n "${WALK_COTTON_PHONE:-}" ]; then export TEST_RUNNER_WALK_COTTON_PHONE="$WALK_COTTON_PHONE"; fi if [ -n "${WALK_COTTON_CODE_FILE:-}" ]; then TEST_RUNNER_WALK_COTTON_CODE="$(tr -d '[:space:]' < "$WALK_COTTON_CODE_FILE")"; export TEST_RUNNER_WALK_COTTON_CODE; fi if [ -n "${WALK_COTTON_RECOVERY_FILE:-}" ]; then TEST_RUNNER_WALK_COTTON_RECOVERY="$(tr -d '\n' < "$WALK_COTTON_RECOVERY_FILE")"; export TEST_RUNNER_WALK_COTTON_RECOVERY; fi bash "$ROOT/scripts/gen-ios-ui-tests.sh" xcrun simctl bootstatus "$UDID" -b >/dev/null cd "$ROOT/apps/cotton" xcodebuild test -project UITests.xcodeproj -scheme data-ui \ -destination "platform=iOS Simulator,id=$UDID" -derivedDataPath "$DERIVED" \ -only-testing:"DataUITests/${DATA_TEST:-DataOpenTests}" COTTON_FLAVOR=dev ARCHS=arm64 ONLY_ACTIVE_ARCH=YES \ -resultBundlePath "$DERIVED/data-walk-$(date +%s).xcresult"