Skip to content

Commit

Permalink
Create a test plan for snapshot testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ns-vasilev committed Mar 9, 2024
1 parent 158a076 commit ebbe1a1
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 11 deletions.
43 changes: 41 additions & 2 deletions .github/workflows/flare_ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
destination: ${{ matrix.destination }}
name: ${{ matrix.name }}
test_plan: FlareUI
test_plan: FlareUIUnitTests
- name: Upload test coverage reports to Codecov
uses: ./.github/actions/upload_test_coverage_report
with:
Expand Down Expand Up @@ -114,7 +115,7 @@ jobs:
scheme: FlareUI
destination: ${{ matrix.destination }}
name: ${{ matrix.name }}
test_plan: FlareUI
test_plan: FlareUIUnitTests
- name: Upload test coverage reports to Codecov
uses: ./.github/actions/upload_test_coverage_report
with:
Expand Down Expand Up @@ -152,7 +153,7 @@ jobs:
scheme: FlareUI
destination: ${{ matrix.destination }}
name: ${{ matrix.name }}
test_plan: FlareUI
test_plan: FlareUIUnitTests
- name: Upload test coverage reports to Codecov
uses: ./.github/actions/upload_test_coverage_report
with:
Expand Down Expand Up @@ -181,6 +182,44 @@ jobs:
- name: ${{ matrix.name }}
run: swift build -c release --target FlareUI

snapshots:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}.app/Contents/Developer"
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- destination: "platform=macOS"
xcode: "Xcode_15.0"
runsOn: macos-13
name: "macOS 13, Xcode 15.0, Swift 5.9.0"
- destination: "OS=17.0.1,name=iPhone 14 Pro"
name: "iOS 17.0.1"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=17.0,name=Apple TV"
name: "tvOS 17.0"
xcode: "Xcode_15.0"
runsOn: macos-13
steps:
- uses: actions/checkout@v3
- name: ${{ matrix.name }}
uses: ./.github/actions/build_and_test
with:
scheme: FlareUI
destination: ${{ matrix.destination }}
name: ${{ matrix.name }}SnapshotTests
test_plan: SnapshotTests
- name: Upload test coverage reports to Codecov
uses: ./.github/actions/upload_test_coverage_report
with:
scheme_name: FlareUI
filename: ${{ matrix.name }}SnapshotTests
token: ${{ secrets.CODECOV_TOKEN }}

merge-test-reports:
needs: [iOS, macOS, watchOS, tvOS]
runs-on: macos-13
Expand Down
8 changes: 0 additions & 8 deletions Tests/FlareUITests/UnitTests/FlareUITests.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
},
"testTargets" : [
{
"skippedTests" : [
"ProductInfoViewSnapshotTests",
"ProductPlaceholderViewSnapshotTests",
"ProductViewSnapshotTests",
"ProductsViewSnapshotTests",
"SnapshotTestCase"
],
"target" : {
"containerPath" : "container:Flare.xcodeproj",
"identifier" : "514A62DAD52F32058E8084C4",
Expand Down
46 changes: 46 additions & 0 deletions Tests/TestPlans/SnapshotTests.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"configurations" : [
{
"id" : "982AD05B-EBD5-4A98-A373-D1868847261D",
"name" : "Configuration 1",
"options" : {

}
}
],
"defaultOptions" : {
"codeCoverage" : {
"targets" : [
{
"containerPath" : "container:Flare.xcodeproj",
"identifier" : "8D5BAE0D59CA24F5E8E0C695",
"name" : "FlareUI"
}
]
},
"targetForVariableExpansion" : {
"containerPath" : "container:Flare.xcodeproj",
"identifier" : "8D5BAE0D59CA24F5E8E0C695",
"name" : "FlareUI"
}
},
"testTargets" : [
{
"skippedTests" : [
"ArrayExtensionsTests",
"ProductPresenterTests",
"ProductStrategyTests",
"ProductViewModelFactoryTests",
"ProductsPresenterTests",
"StoreButtonPresenterTests",
"SubscriptionDateComponentsFactoryTests"
],
"target" : {
"containerPath" : "container:Flare.xcodeproj",
"identifier" : "514A62DAD52F32058E8084C4",
"name" : "FlareUITests"
}
}
],
"version" : 1
}
19 changes: 18 additions & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ targets:
- path: Sources/FlareUI
scheme:
testPlans:
- path: Tests/TestPlans/FlareUI.xctestplan
- path: Tests/TestPlans/FlareUIUnitTests.xctestplan
defaultPlan: true
- path: Tests/TestPlans/SnapshotTests.xctestplan
gatherCoverageData: true
coverageTargets:
- FlareUI
Expand Down Expand Up @@ -124,6 +125,22 @@ targets:
TARGETED_DEVICE_FAMILY: "1,2,3,4"
sources:
- Tests/FlareUITests
# FlareUISnapshotTests:
# type: bundle.unit-test
# supportedDestinations: [iOS, tvOS, macOS]
# dependencies:
# - target: Flare
# - target: FlareMock
# - target: FlareUI
# - package: SnapshotTesting
# settings:
# base:
# GENERATE_INFOPLIST_FILE: YES
# PRODUCT_BUNDLE_IDENTIFIER: com.spacecode.flare-unit-tests
# SUPPORTED_PLATFORMS: "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator"
# TARGETED_DEVICE_FAMILY: "1,2,3,4"
# sources:
# - Tests/FlareUITests/SnapshotTests
IntegrationTests:
type: bundle.unit-test
supportedDestinations: [iOS, tvOS, macOS]
Expand Down

0 comments on commit ebbe1a1

Please sign in to comment.