#!/usr/bin/env bash # Cinemas walked by hand on a simulator, filmed: the UI test that drives Cinemas Dev on its invented library with # taps and scrolls (apps/cotton/UITests/Cinemas/CinemasWalkTests.swift), with the simulator's screen recorded around # it. Nothing of anyone's: the library is made up and the posters are drawn. # # bash scripts/cinemas-walk.sh [derived data] # # CINEMAS_TEST names another class of CinemasUITests to run (CinemasMotionTests, CinemasAccessibilityTests); a video # of "-" records none. set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" UDID=${1:?simulator udid} VIDEO=${2:?video path} DERIVED=${3:-$ROOT/.derived-cinemas-walk} # Package.swift decides COTTON_DEV (the invented library) from the environment, not from a build setting. export COTTON_FLAVOR=dev bash "$ROOT/scripts/gen-ios-ui-tests.sh" xcrun simctl bootstatus "$UDID" -b >/dev/null if [ "$VIDEO" != "-" ]; then xcrun simctl io "$UDID" recordVideo --codec=h264 --force "$VIDEO" & RECORDER=$! trap 'kill -INT "$RECORDER" 2>/dev/null || true; wait "$RECORDER" 2>/dev/null || true' EXIT sleep 2 fi cd "$ROOT/apps/cotton" xcodebuild test -project UITests.xcodeproj -scheme cinemas-ui \ -destination "platform=iOS Simulator,id=$UDID" -derivedDataPath "$DERIVED" \ -only-testing:"CinemasUITests/${CINEMAS_TEST:-CinemasWalkTests}" COTTON_FLAVOR=dev ARCHS=arm64 ONLY_ACTIVE_ARCH=YES \ -resultBundlePath "$DERIVED/cinemas-walk-$(date +%s).xcresult"