Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): add capturing and uploading of screen capture of ui tests #4871

Merged
merged 18 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ on:
- "scripts/ci-select-xcode.sh"
- "scripts/sentry-xcodebuild.sh"
- ".codecov.yml"
- Sentry.xcodeproj
- '**/*.xctestplan'
- "Sentry.xcodeproj"
- "**/*.xctestplan"

# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
uses: mikepenz/action-junit-report@ee6b445351cd81e2f73a16a0e52d598aeac2197f # v5.3.0
if: always()
with:
report_paths: 'build/reports/junit.xml'
report_paths: "build/reports/junit.xml"
fail_on_failure: true
fail_on_parse_error: true
detailed_summary: true
Expand Down
75 changes: 53 additions & 22 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ on:

pull_request:
paths:
- 'Sources/**'
- 'Tests/**'
- '.github/workflows/ui-tests.yml'
- 'fastlane/**'
- '.sauce/config.yml'
- 'scripts/ci-select-xcode.sh'
- 'Samples/iOS-Swift/**'
- '**/*.xctestplan'

- "Sources/**"
- "Tests/**"
- ".github/workflows/ui-tests.yml"
- "fastlane/**"
- ".sauce/config.yml"
- "scripts/ci-select-xcode.sh"
- "Samples/iOS-Swift/**"
- "**/*.xctestplan"

# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
Expand All @@ -28,7 +27,6 @@ jobs:
strategy:
matrix:
target: ["ios_objc", "tvos_swift"]

steps:
- uses: actions/checkout@v4
- run: ./scripts/ci-select-xcode.sh
Expand All @@ -38,6 +36,13 @@ jobs:
run: for i in {1..2}; do fastlane ui_tests_${{matrix.target}} && break ; done
shell: sh

- name: Upload Result Bundle
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ui-tests-${{matrix.target}}.xcresult
path: fastlane/test_results/ui-tests-${{matrix.target}}.xcresult

- name: Archiving Raw Test Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
Expand All @@ -58,21 +63,27 @@ jobs:
- runs-on: macos-13
xcode: "14.3"
device: "iPhone 8 (16.1)"

steps:
- uses: actions/checkout@v4
- run: ./scripts/ci-select-xcode.sh ${{matrix.xcode}}

# GitHub Actions sometimes fail to launch the UI tests. Therefore we retry
- name: Run Fastlane
run: for i in {1..2}; do fastlane ui_tests_ios_swiftui device:"${{matrix.device}}" && break ; done
shell: sh

- name: Upload Result Bundle
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ui-tests-ios-swiftui-${{matrix.device}}.xcresult
path: fastlane/test_results/ui-tests-ios-swiftui.xcresult

- name: Archiving Raw Test Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
if: ${{ failure() || cancelled() }}
with:
name: raw-ios-swiftui-test-output-xcode-${{matrix.xcode}}-${{matrix.device}}
name: ui-tests-ios-swiftui-raw-output-${{matrix.device}}
path: |
~/Library/Logs/scan/*.log
./fastlane/test_output/**
Expand All @@ -92,7 +103,6 @@ jobs:
- runs-on: macos-14-large
xcode: "15.4"
device: "iPhone 15 (17.2)"

steps:
- uses: actions/checkout@v4
- run: ./scripts/ci-select-xcode.sh ${{matrix.xcode}}
Expand All @@ -104,34 +114,48 @@ jobs:
- name: Run Fastlane
run: fastlane ui_tests_ios_swift device:"${{matrix.device}}"

- name: Upload Result Bundle
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ui-tests-ios-swift-${{matrix.device}}.xcresult
path: fastlane/test_results/ui-tests-ios-swift.xcresult

- name: Archiving Raw Test Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
with:
name: raw-ios-swift-test-output-${{matrix.xcode}}-${{matrix.device}}
name: ui-tests-ios-swift-raw-logs-${{matrix.device}}
path: |
~/Library/Logs/scan/*.log
./fastlane/test_output/**

ui-tests-swift6:
name: UI Tests for iOS-Swift6 Simulator
runs-on: macos-15

steps:
- uses: actions/checkout@v4
- run: ./scripts/ci-select-xcode.sh "16.2"

- name: Run Fastlane
run: fastlane ui_tests_ios_swift6

- name: Upload Result Bundle
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ui-tests-ios-swift6.xcresult
path: fastlane/test_results/ui-tests-ios-swift6.xcresult

- name: Archiving Raw Test Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
if: ${{ failure() || cancelled() }}
with:
name: raw-ios-swift-test-output-${{matrix.xcode}}-${{matrix.device}}
name: ui-tests-ios-swift6-raw-output
path: |
~/Library/Logs/scan/*.log
./fastlane/test_output/**

duplication-tests:
name: UI Tests for project with Sentry duplicated
runs-on: macos-15
Expand All @@ -143,11 +167,18 @@ jobs:
- name: Run Fastlane
run: fastlane duplication_test

- name: Upload Result Bundle
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: duplication-test.xcresult
path: fastlane/test_results/duplication-test.xcresult

- name: Archiving Raw Test Logs
uses: actions/upload-artifact@v4
if: ${{ failure() || cancelled() }}
with:
name: raw-ios-swift-test-output-${{matrix.xcode}}-${{matrix.device}}
name: duplication-test-raw-output
path: |
~/Library/Logs/scan/*.log
./fastlane/test_output/**
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Pods

# Fastlane
fastlane/test_output/
fastlane/test_results/
fastlane/README.md
report.xml
.env
Expand Down
3 changes: 2 additions & 1 deletion Plans/SentryProfilerTests_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
}
],
"defaultOptions" : {
"codeCoverage" : false
"codeCoverage" : false,
"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
2 changes: 1 addition & 1 deletion Plans/SentrySwiftUI_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"defaultOptions" : {

"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
3 changes: 2 additions & 1 deletion Plans/SentryTests_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
}
],
"defaultOptions" : {
"codeCoverage" : false
"codeCoverage" : false,
"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
3 changes: 2 additions & 1 deletion Plans/Sentry_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"containerPath" : "container:Sentry.xcodeproj",
"identifier" : "63AA759A1EB8AEF500D153DE",
"name" : "Sentry"
}
},
"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
2 changes: 1 addition & 1 deletion Plans/SwiftUITestSample_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"defaultOptions" : {

"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [

Expand Down
2 changes: 1 addition & 1 deletion Plans/iOS-ObjectiveC_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"defaultOptions" : {

"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
3 changes: 2 additions & 1 deletion Plans/iOS-Swift-Benchmarking_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"containerPath" : "container:iOS-Swift.xcodeproj",
"identifier" : "637AFDA5243B02760034958B",
"name" : "iOS-Swift"
}
},
"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
2 changes: 1 addition & 1 deletion Plans/iOS-Swift6_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"defaultOptions" : {

"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
3 changes: 2 additions & 1 deletion Plans/iOS-SwiftUI_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"containerPath" : "container:iOS-SwiftUI.xcodeproj",
"identifier" : "7BB6224826A56C4E00D0E75E",
"name" : "iOS-SwiftUI"
}
},
"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
3 changes: 2 additions & 1 deletion Plans/iOS-Swift_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@
"containerPath" : "container:iOS-Swift.xcodeproj",
"identifier" : "637AFDA5243B02760034958B",
"name" : "iOS-Swift"
}
},
"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
3 changes: 2 additions & 1 deletion Plans/iOS13-Swift_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"containerPath" : "container:iOS-Swift.xcodeproj",
"identifier" : "D8269A38274C095E00BD5BD5",
"name" : "iOS13-Swift"
}
},
"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
2 changes: 1 addition & 1 deletion Plans/iOS15-SwiftUI.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"defaultOptions" : {

"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
2 changes: 1 addition & 1 deletion Plans/macOS-SwiftUI_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"defaultOptions" : {

"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [

Expand Down
3 changes: 2 additions & 1 deletion Plans/macOS-Swift_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"containerPath" : "container:macOS-Swift.xcodeproj",
"identifier" : "637AFDEA243B04320034958B",
"name" : "macOS-Swift"
}
},
"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [

Expand Down
3 changes: 2 additions & 1 deletion Plans/tvOS-Swift_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"containerPath" : "container:tvOS-Swift.xcodeproj",
"identifier" : "7BA61D61247FA32600C130A8",
"name" : "tvOS-Swift"
}
},
"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [
{
Expand Down
2 changes: 1 addition & 1 deletion Plans/visionOS-Swift_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"defaultOptions" : {

"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [

Expand Down
3 changes: 2 additions & 1 deletion Plans/watchOS-Swift-WatchKit-App_Base.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"containerPath" : "container:watchOS-Swift.xcodeproj",
"identifier" : "7B82C48224C98A93002CA6D1",
"name" : "watchOS-Swift WatchKit App"
}
},
"uiTestingScreenshotsLifetime" : "keepAlways"
},
"testTargets" : [

Expand Down
Loading
Loading