#!/usr/bin/env bash # The apps' own UI tests (XCUITest on a simulator, never in the checks): their # targets live in a project generated here for the run, `UITests.xcodeproj` # beside the shipped one, as the deck walk's do, so the # shipped spec keeps its one scheme and its test targets # (the ios-project-spec test). The shipped spec is included # whole, gated as gen-ios-project.sh gates it. # # bash scripts/gen-ios-ui-tests.sh # # Schemes, each Debug, each its app and its tests: # story-ui CottonStory + StoryUITests (UITests/Story) # chat-ui CottonMessages + ChatUITests (UITests/Chat) # days-ui CottonDays + DaysUITests (UITests/Days) # notes-ui CottonNotes + NotesUITests (UITests/Notes) # sites-ui CottonSites + SitesUITests (UITests/Sites) # cinemas-ui CottonCinemas + CinemasUITests (UITests/Cinemas) # data-ui CottonData + DataUITests (UITests/Data) # albums-ui CottonAlbums + AlbumsUITests (UITests/Albums) # mail-ui CottonMail + PostUITests (UITests/Post) # contacts-ui CottonContacts + ContactsUITests (UITests/Contacts) # then, for example: # xcodebuild test -project apps/cotton/UITests.xcodeproj -scheme story-ui \ # -destination 'platform=iOS Simulator,id=' -only-testing:StoryUITests COTTON_FLAVOR=dev set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" IOS="$ROOT/apps/cotton" command -v xcodegen >/dev/null 2>&1 || { echo "gen-ios-ui-tests: xcodegen is not on PATH (brew install xcodegen)" >&2; exit 1; } bash "$ROOT/scripts/ffi-stub.sh" cd "$IOS" SHIPPED=project.yml rm -f .uitests.gated.yml if npx tsx "$ROOT/scripts/ios-spec-gate.ts" project.yml .uitests.gated.yml; then SHIPPED=.uitests.gated.yml; fi # name|app target|folder SUITES="StoryUITests|CottonStory|UITests/Story story-ui ChatUITests|CottonMessages|UITests/Chat chat-ui DaysUITests|CottonDays|UITests/Days days-ui NotesUITests|CottonNotes|UITests/Notes notes-ui SitesUITests|CottonSites|UITests/Sites sites-ui CinemasUITests|CottonCinemas|UITests/Cinemas cinemas-ui DataUITests|CottonData|UITests/Data data-ui AlbumsUITests|CottonAlbums|UITests/Albums albums-ui PostUITests|CottonMail|UITests/Post mail-ui ContactsUITests|CottonContacts|UITests/Contacts contacts-ui" { echo "include:" echo " - path: $SHIPPED" echo "name: UITests" echo "targets:" while read -r suite scheme; do IFS='|' read -r name app folder <<<"$suite" cat < .uitests.yml xcodegen generate --spec .uitests.yml --project . --quiet mkdir -p UITests.xcodeproj/project.xcworkspace/xcshareddata/swiftpm cp Package.resolved UITests.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved echo "gen-ios-ui-tests: apps/cotton/UITests.xcodeproj (schemes story-ui, chat-ui, days-ui, notes-ui, sites-ui, cinemas-ui, data-ui, albums-ui, mail-ui, contacts-ui)"