Skip to content

Commit b177819

Browse files
authored
ci: Replace Maestro tests with regular UI Tests (#5398)
* Replace Maestro tests with regular UI Tests * Use reusable workflow * Fix used lane * chore: remove .gitignore from project file references * Update project format * Update project file * Use `PreviewProvider` instead of Preview macro * Use xcodegen for SwiftUITestSample * Remove `# Logs` * Disable debugging on tests * Set project version in xcconfig * Set `MARKETING_VERSION` version * Forgot to commit `SwiftUITestSample.xcconfig` * Refactor uninstall method to include skipIfNotFound parameter and update test teardown logic for cleaner state management * Set all xcconfig options * Enable debug again * Add print available disk space step
1 parent 6cbba5d commit b177819

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+377
-596
lines changed

.github/workflows/ui-tests-common.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ jobs:
4747
shell: bash
4848
run: system_profiler SPHardwareDataType
4949

50+
- name: Print available disk space
51+
shell: bash
52+
run: df -h
53+
5054
- name: Setup Ruby
5155
uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
5256
with:

.github/workflows/ui-tests-critical.yml

Lines changed: 8 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
paths:
99
- "Sources/**"
1010
- ".github/workflows/ui-tests-critical.yml"
11+
- ".github/workflows/ui-tests-common.yml"
1112
- "fastlane/**"
1213
- "TestSamples/**"
1314
- "**/*.xctestplan"
@@ -21,35 +22,14 @@ concurrency:
2122
cancel-in-progress: true
2223

2324
jobs:
24-
build-sample:
25-
name: Build SwiftUITestSample Sample
26-
runs-on: macos-15
27-
steps:
28-
- uses: actions/checkout@v4
29-
30-
- name: Print hardware info
31-
run: system_profiler SPHardwareDataType
32-
- run: ./scripts/ci-select-xcode.sh "16.2"
33-
- uses: ruby/setup-ruby@v1
34-
with:
35-
bundler-cache: true
36-
- run: bundle exec fastlane build_ios_swift_ui_test_sample
37-
- uses: actions/upload-artifact@v4
38-
with:
39-
name: SwiftUITestSample
40-
path: TestSamples/SwiftUITestSample/DerivedData/Build/Products/Debug-iphonesimulator/SwiftUITestSample.app
41-
# If no files are found, fail the job with an error, because they are required for the next step
42-
if-no-files-found: error
43-
4425
run-tests:
45-
name: Test iOS on Xcode ${{matrix.platform.xcode}} - ${{matrix.test.name}} - V3 # Up the version with every change to keep track of flaky tests
46-
needs: [build-sample]
47-
runs-on: ${{matrix.platform.runs-on}}
48-
env:
49-
APP_ARTIFACT_NAME: "SwiftUITestSample"
50-
APP_PATH: "Sample.app"
51-
MAESTRO_LOGS_PATH: "MaestroLogs"
52-
MAESTRO_DRIVER_STARTUP_TIMEOUT: 1500000 # 25 min, CI can be slow at times
26+
name: Test iOS on Xcode ${{matrix.platform.xcode}} - V4 # Up the version with every change to keep track of flaky tests
27+
uses: ./.github/workflows/ui-tests-common.yml
28+
with:
29+
fastlane_command: ui_critical_tests_ios_swiftui
30+
build_with_make: true
31+
xcode_version: ${{matrix.platform.xcode}}
32+
macos_version: ${{matrix.platform.runs-on}}
5333
strategy:
5434
fail-fast: false
5535
matrix:
@@ -65,52 +45,3 @@ jobs:
6545
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#installed-sdks
6646
- runs-on: macos-15
6747
xcode: "16.2"
68-
test:
69-
- name: "Crash"
70-
maestro_flows_path: "TestSamples/SwiftUITestSample/Maestro/crash.yaml"
71-
- name: "CorruptEnvelope"
72-
maestro_flows_path: "TestSamples/SwiftUITestSample/Maestro/corruptEnvelope.yaml"
73-
74-
steps:
75-
- uses: actions/checkout@v4
76-
77-
- name: Print hardware info
78-
run: system_profiler SPHardwareDataType
79-
80-
- name: Install tooling
81-
run: make init-ci-test
82-
83-
- uses: actions/download-artifact@v4
84-
with:
85-
name: ${{env.APP_ARTIFACT_NAME}}
86-
path: ${{env.APP_PATH}}
87-
88-
- name: Add Microphone permissions
89-
uses: ./.github/actions/add-microphone-permissions
90-
91-
- run: ./scripts/ci-boot-simulator.sh --xcode ${{matrix.platform.xcode}}
92-
93-
- name: Install App
94-
run: xcrun simctl install booted ${{env.APP_PATH}}
95-
96-
- name: Run Maestro Flows
97-
run: |
98-
maestro test ${{matrix.test.maestro_flows_path}} --format junit --debug-output ${{env.MAESTRO_LOGS_PATH}} --flatten-debug-output
99-
100-
- name: Store Maestro Logs
101-
uses: actions/upload-artifact@v4
102-
if: failure()
103-
with:
104-
name: maestro-logs-${{matrix.platform.xcode}}-${{matrix.test.name}}
105-
path: ${{env.MAESTRO_LOGS_PATH}}
106-
107-
- name: Archiving Crash Logs
108-
uses: actions/upload-artifact@v4
109-
if: ${{ failure() || cancelled() }}
110-
with:
111-
name: crash-logs-${{matrix.platform.xcode}}-${{matrix.test.name}}
112-
path: ~/Library/Logs/DiagnosticReports/**
113-
114-
- name: Store screenshot
115-
uses: ./.github/actions/capture-screenshot
116-
if: failure()

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,7 @@ Samples/tvOS-Swift/tvOS-Swift.xcodeproj
9595
Samples/visionOS-Swift/visionOS-Swift.xcodeproj
9696
Samples/watchOS-Swift/watchOS-Swift.xcodeproj
9797
Samples/SentrySampleShared/SentrySampleShared.xcodeproj
98-
99-
# Logs
100-
MaestroLogs/
98+
TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj
10199

102100
Sentry.xcframework*
103101
Sentry-Dynamic.xcframework*

Brewfile-ci-test

Lines changed: 0 additions & 4 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ init-local:
1717
.PHONY: init-ci-build
1818
init-ci-build:
1919
brew bundle --file Brewfile-ci-build
20-
21-
.PHONY: init-ci-test
22-
init-ci-test:
23-
brew bundle --file Brewfile-ci-test
2420

2521
# installs the tools needed to run CI deploy tasks locally (note that carthage is preinstalled in github actions)
2622
.PHONY: init-ci-deploy
@@ -187,4 +183,5 @@ xcode:
187183
xcodegen --spec Samples/tvOS-Swift/tvOS-Swift.yml
188184
xcodegen --spec Samples/visionOS-Swift/visionOS-Swift.yml
189185
xcodegen --spec Samples/watchOS-Swift/watchOS-Swift.yml
186+
xcodegen --spec TestSamples/SwiftUITestSample/SwiftUITestSample.yml
190187
open Sentry.xcworkspace

Plans/SwiftUITestSample_Base.xctestplan

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
"uiTestingScreenshotsLifetime" : "keepAlways"
1313
},
1414
"testTargets" : [
15-
15+
{
16+
"target" : {
17+
"containerPath" : "container:SwiftUITestSample.xcodeproj",
18+
"identifier" : "CB685CB9DBE9C3FFCE8BD314",
19+
"name" : "SwiftUITestSampleUITests"
20+
}
21+
}
1622
],
1723
"version" : 1
1824
}

TestSamples/SwiftUITestSample/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

TestSamples/SwiftUITestSample/Maestro/corruptEnvelope.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

TestSamples/SwiftUITestSample/Maestro/crash.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ONLY_ACTIVE_ARCH_Debug = YES
2+
ONLY_ACTIVE_ARCH_Test = YES
3+
ONLY_ACTIVE_ARCH_TestCI = YES
4+
ONLY_ACTIVE_ARCH_Release = NO
5+
ONLY_ACTIVE_ARCH = $(ONLY_ACTIVE_ARCH_$(CONFIGURATION))
6+
7+
SDKROOT = auto

0 commit comments

Comments
 (0)