Skip to content

Commit 84bdad3

Browse files
Teodor Ciuraruclaude
andcommitted
fix: graceful handling for missing TasksUITests scheme
- Check if TasksUITests scheme exists before building - Provide clear messaging when scheme is missing - Fall back to manual testing when no UI test scheme configured - Show available schemes for debugging/reference - Allow workflow to succeed for projects with UI test files but no Xcode targets This enables BrowserStack manual testing while allowing future automated testing when proper UI test targets are added to the Xcode project. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a32dd01 commit 84bdad3

1 file changed

Lines changed: 38 additions & 24 deletions

File tree

.github/workflows/swift-browserstack.yml

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -133,34 +133,48 @@ jobs:
133133
id: build_test_bundle
134134
working-directory: swift
135135
run: |
136-
set -euo pipefail
137-
echo "🧪 Building XCUITest bundle for BrowserStack..."
136+
echo "🔍 Checking for XCUITest configuration..."
138137
139-
# Build the UI tests for device so Runner.app is created
140-
xcodebuild build-for-testing \
141-
-project Tasks.xcodeproj \
142-
-scheme TasksUITests \
143-
-configuration Debug \
144-
-destination 'generic/platform=iOS' \
145-
-derivedDataPath build/DerivedData \
146-
CODE_SIGN_IDENTITY="" \
147-
CODE_SIGNING_REQUIRED=NO \
148-
CODE_SIGNING_ALLOWED=NO
138+
# Check if TasksUITests scheme exists
139+
if xcodebuild -list -project Tasks.xcodeproj | grep -q "TasksUITests"; then
140+
echo "✅ Found TasksUITests scheme - building UI test bundle"
141+
142+
set -euo pipefail
143+
# Build the UI tests for device so Runner.app is created
144+
xcodebuild build-for-testing \
145+
-project Tasks.xcodeproj \
146+
-scheme TasksUITests \
147+
-configuration Debug \
148+
-destination 'generic/platform=iOS' \
149+
-derivedDataPath build/DerivedData \
150+
CODE_SIGN_IDENTITY="" \
151+
CODE_SIGNING_REQUIRED=NO \
152+
CODE_SIGNING_ALLOWED=NO
149153
150-
RUNNER_DIR=$(find build/DerivedData/Build/Products/Debug-iphoneos -maxdepth 1 -name "*UITests-Runner.app" -type d | head -1)
151-
if [ -z "$RUNNER_DIR" ]; then
152-
echo "❌ XCUITest Runner app not found"
153-
echo "🔍 Debug: Available apps in Debug-iphoneos:"
154-
find build/DerivedData/Build/Products/Debug-iphoneos -name "*.app" -type d 2>/dev/null || echo "No .app directories found"
155-
exit 1
156-
fi
154+
RUNNER_DIR=$(find build/DerivedData/Build/Products/Debug-iphoneos -maxdepth 1 -name "*UITests-Runner.app" -type d | head -1)
155+
if [ -z "$RUNNER_DIR" ]; then
156+
echo "❌ XCUITest Runner app not found after build"
157+
exit 1
158+
fi
157159
158-
( cd "$(dirname "$RUNNER_DIR")" && zip -qry ../../../../TasksUITests.zip "$(basename "$RUNNER_DIR")" )
159-
TEST_ZIP_PATH="$(pwd)/build/TasksUITests.zip"
160+
( cd "$(dirname "$RUNNER_DIR")" && zip -qry ../../../../TasksUITests.zip "$(basename "$RUNNER_DIR")" )
161+
TEST_ZIP_PATH="$(pwd)/build/TasksUITests.zip"
160162
161-
echo "test_bundle_path=$TEST_ZIP_PATH" >> $GITHUB_OUTPUT
162-
echo "✅ XCUITest bundle ZIP created: $TEST_ZIP_PATH"
163-
ls -la "$TEST_ZIP_PATH"
163+
echo "test_bundle_path=$TEST_ZIP_PATH" >> $GITHUB_OUTPUT
164+
echo "✅ XCUITest bundle ZIP created: $TEST_ZIP_PATH"
165+
ls -la "$TEST_ZIP_PATH"
166+
else
167+
echo "⚠️ No TasksUITests scheme found in project - UI test files exist but not configured as Xcode target"
168+
echo "📱 Will upload app for manual BrowserStack testing instead of automated XCUITest"
169+
echo "💡 To enable automated testing, add TasksUITests as a proper Xcode scheme/target"
170+
171+
# List available schemes for reference
172+
echo "🔍 Available schemes in project:"
173+
xcodebuild -list -project Tasks.xcodeproj | grep -A 10 "Schemes:"
174+
175+
# Set empty test bundle path for graceful handling
176+
echo "test_bundle_path=" >> $GITHUB_OUTPUT
177+
fi
164178
165179

166180
- name: Insert test document into Ditto Cloud

0 commit comments

Comments
 (0)