Skip to content

Commit

Permalink
Add previews to integration test cases (#2551)
Browse files Browse the repository at this point in the history
* Add previews to all integration tests.

* wip;

* wip

* wip

* debug

* xcode 15

* split out examples

* wip

* wip

* move around tests so they don't go off screen

* wip

* wip

* ops

* wip

* wip

---------

Co-authored-by: Stephen Celis <[email protected]>
  • Loading branch information
mbrandonw and stephencelis authored Nov 9, 2023
1 parent 4f9df4d commit 464d95e
Show file tree
Hide file tree
Showing 31 changed files with 420 additions and 176 deletions.
26 changes: 18 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
- release
steps:
- uses: actions/checkout@v4
- name: Select Xcode 14.3
run: sudo xcode-select -s /Applications/Xcode_14.3.app
- name: Select Xcode 15
run: sudo xcode-select -s /Applications/Xcode_15.0.1.app
- name: Run ${{ matrix.config }} tests
run: make CONFIG=${{ matrix.config }} test-library

Expand All @@ -35,8 +35,8 @@ jobs:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode 14.3
run: sudo xcode-select -s /Applications/Xcode_14.3.app
- name: Select Xcode 15
run: sudo xcode-select -s /Applications/Xcode_15.0.1.app
- name: Build for library evolution
run: make build-for-library-evolution

Expand All @@ -45,8 +45,8 @@ jobs:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode 14.3
run: sudo xcode-select -s /Applications/Xcode_14.3.app
- name: Select Xcode 15
run: sudo xcode-select -s /Applications/Xcode_15.0.1.app
- name: Run benchmark
run: make benchmark

Expand All @@ -55,7 +55,17 @@ jobs:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode 14.3
run: sudo xcode-select -s /Applications/Xcode_14.3.app
- name: Select Xcode 15
run: sudo xcode-select -s /Applications/Xcode_15.0.1.app
- name: Run tests
run: make test-examples

integration:
name: Integration
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- name: Select Xcode 15
run: sudo xcode-select -s /Applications/Xcode_15.0.1.app
- name: Run tests
run: make test-integration
10 changes: 0 additions & 10 deletions Examples/Integration/Integration.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
CA487B2C2A15185300F54A79 /* BaseIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA487B2B2A15185300F54A79 /* BaseIntegrationTests.swift */; };
CA4BA5E929E76A7F0004FF9D /* NavigationStackTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA4BA5E829E76A7F0004FF9D /* NavigationStackTestCase.swift */; };
CA4BA5EB29E76F110004FF9D /* LegacyNavigationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA4BA5EA29E76F110004FF9D /* LegacyNavigationTests.swift */; };
CA595273296DF46D00B5B695 /* NavigationStackBindingTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA595272296DF46D00B5B695 /* NavigationStackBindingTestCase.swift */; };
CA595275296DF55A00B5B695 /* NavigationStackBindingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA595274296DF55A00B5B695 /* NavigationStackBindingTests.swift */; };
CA595278296DF67E00B5B695 /* ComposableArchitecture in Frameworks */ = {isa = PBXBuildFile; productRef = CA595277296DF67E00B5B695 /* ComposableArchitecture */; };
CA8B2E9A2AC576CA008272E0 /* BasicsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA8B2E962AC576B5008272E0 /* BasicsTests.swift */; };
CA8B2E9B2AC576CA008272E0 /* EnumTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA8B2E942AC576B5008272E0 /* EnumTests.swift */; };
Expand Down Expand Up @@ -97,8 +95,6 @@
CA487B2B2A15185300F54A79 /* BaseIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseIntegrationTests.swift; sourceTree = "<group>"; };
CA4BA5E829E76A7F0004FF9D /* NavigationStackTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationStackTestCase.swift; sourceTree = "<group>"; };
CA4BA5EA29E76F110004FF9D /* LegacyNavigationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyNavigationTests.swift; sourceTree = "<group>"; };
CA595272296DF46D00B5B695 /* NavigationStackBindingTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationStackBindingTestCase.swift; sourceTree = "<group>"; };
CA595274296DF55A00B5B695 /* NavigationStackBindingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationStackBindingTests.swift; sourceTree = "<group>"; };
CA595276296DF66B00B5B695 /* swift-composable-architecture */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "swift-composable-architecture"; path = ../..; sourceTree = "<group>"; };
CA8B2E942AC576B5008272E0 /* EnumTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnumTests.swift; sourceTree = "<group>"; };
CA8B2E952AC576B5008272E0 /* OptionalTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OptionalTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -183,7 +179,6 @@
E9919D41296E47A400C8716B /* BindingsAnimationsTestBench.swift */,
E9919D3D296E28C800C8716B /* EscapedWithViewStoreTestCase.swift */,
CAA1CB1E296DEEAC000665B1 /* ForEachBindingTestCase.swift */,
CA595272296DF46D00B5B695 /* NavigationStackBindingTestCase.swift */,
CA4BA5E829E76A7F0004FF9D /* NavigationStackTestCase.swift */,
DC92799A2A1E59D500B2031A /* PresentationItemTestCase.swift */,
CAF5802429A5651D0042FB62 /* LegacyPresentationTestCase.swift */,
Expand All @@ -198,7 +193,6 @@
DCFFB8E82A15792C006AF839 /* BindingLocalTests.swift */,
E9919D3F296E3EF400C8716B /* EscapedWithViewStoreTests.swift */,
CAA1CB0F296DEE79000665B1 /* ForEachBindingTests.swift */,
CA595274296DF55A00B5B695 /* NavigationStackBindingTests.swift */,
CA4BA5EA29E76F110004FF9D /* LegacyNavigationTests.swift */,
CAF5802629A567BB0042FB62 /* LegacyPresentationTests.swift */,
DC140CC629E0E8F3006DF553 /* SwitchStoreTests.swift */,
Expand Down Expand Up @@ -452,7 +446,6 @@
CA4BA5E929E76A7F0004FF9D /* NavigationStackTestCase.swift in Sources */,
E9919D42296E47A400C8716B /* BindingsAnimationsTestBench.swift in Sources */,
DCFFB8E72A156488006AF839 /* BindingLocalTestCase.swift in Sources */,
CA595273296DF46D00B5B695 /* NavigationStackBindingTestCase.swift in Sources */,
CAF5802529A5651D0042FB62 /* LegacyPresentationTestCase.swift in Sources */,
CA8B2EB22AC5AD63008272E0 /* NavigationTestCase.swift in Sources */,
E9919D3E296E28C800C8716B /* EscapedWithViewStoreTestCase.swift in Sources */,
Expand All @@ -478,7 +471,6 @@
CAF5802729A567BB0042FB62 /* LegacyPresentationTests.swift in Sources */,
CA487B2C2A15185300F54A79 /* BaseIntegrationTests.swift in Sources */,
CA8B2EA72AC584BE008272E0 /* SiblingTests.swift in Sources */,
CA595275296DF55A00B5B695 /* NavigationStackBindingTests.swift in Sources */,
CAA1CB10296DEE79000665B1 /* ForEachBindingTests.swift in Sources */,
DCFFB8E92A15792C006AF839 /* BindingLocalTests.swift in Sources */,
CA8B2E9A2AC576CA008272E0 /* BasicsTests.swift in Sources */,
Expand Down Expand Up @@ -570,7 +562,6 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -624,7 +615,6 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down
7 changes: 7 additions & 0 deletions Examples/Integration/Integration/BasicsTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ struct BasicsView: View {
}
}
}

struct BasicsPreviews: PreviewProvider {
static var previews: some View {
let _ = Logger.shared.isEnabled = true
BasicsView()
}
}
7 changes: 7 additions & 0 deletions Examples/Integration/Integration/EnumTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,10 @@ struct EnumTestCase_Previews: PreviewProvider {
EnumView()
}
}

struct EnumPreviews: PreviewProvider {
static var previews: some View {
let _ = Logger.shared.isEnabled = true
EnumView()
}
}
9 changes: 9 additions & 0 deletions Examples/Integration/Integration/IdentifiedListTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,12 @@ struct IdentifiedListView: View {
}
}
}

struct IdentifiedListPreviews: PreviewProvider {
static var previews: some View {
let _ = Logger.shared.isEnabled = true
NavigationStack {
IdentifiedListView()
}
}
}
148 changes: 72 additions & 76 deletions Examples/Integration/Integration/IntegrationApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,99 +72,95 @@ struct IntegrationApp: App {
struct ContentView: View {
@State var isBindingLocalTestCasePresented = false
@State var isNavigationStackTestCasePresented = false
@State var isNavigationStackBindingTestCasePresented = false
@State var isNavigationTestCasePresented = false

var body: some View {
NavigationStack {
List {
Section {
NavigationLink("Basics") {
Form {
BasicsView()
}
}
NavigationLink("Enum") {
EnumView()
}
NavigationLink("Optional") {
OptionalView()
}
NavigationLink("Identified list") {
IdentifiedListView()
}
Button("Navigation") {
self.isNavigationTestCasePresented = true
}
.sheet(isPresented: self.$isNavigationTestCasePresented) {
NavigationTestCaseView()
}
NavigationLink("Siblings") {
SiblingFeaturesView()
}
NavigationLink("Presentation") {
PresentationView()
}
}

Section {
ForEach(TestCase.allCases) { test in
switch test {
case .escapedWithViewStore:
NavigationLink(test.rawValue) {
EscapedWithViewStoreTestCaseView()
}

case .forEachBinding:
NavigationLink(test.rawValue) {
ForEachBindingTestCaseView()
NavigationLink("iOS 16") {
List {
Section {
NavigationLink("Basics") {
Form {
BasicsView()
}
}

case .navigationStack:
Button(test.rawValue) {
self.isNavigationStackTestCasePresented = true
NavigationLink("Enum") {
EnumView()
}
.foregroundColor(.black)
.sheet(isPresented: self.$isNavigationStackTestCasePresented) {
NavigationStackTestCaseView()
NavigationLink("Optional") {
OptionalView()
}

case .navigationStackBinding:
Button(test.rawValue) {
self.isNavigationStackBindingTestCasePresented = true
NavigationLink("Identified list") {
IdentifiedListView()
}
.foregroundColor(.black)
.sheet(isPresented: self.$isNavigationStackBindingTestCasePresented) {
NavigationStackBindingTestCaseView()
Button("Navigation") {
self.isNavigationTestCasePresented = true
}

case .presentation:
NavigationLink(test.rawValue) {
PresentationTestCaseView()
.sheet(isPresented: self.$isNavigationTestCasePresented) {
NavigationTestCaseView()
}

case .presentationItem:
NavigationLink(test.rawValue) {
PresentationItemTestCaseView()
NavigationLink("Siblings") {
SiblingFeaturesView()
}

case .switchStore:
NavigationLink(test.rawValue) {
SwitchStoreTestCaseView()
NavigationLink("Presentation") {
PresentationView()
}
}
}
.navigationTitle(Text("iOS 16"))
}

case .bindingLocal:
Button(test.rawValue) {
self.isBindingLocalTestCasePresented = true
}
.foregroundColor(.black)
.sheet(isPresented: self.$isBindingLocalTestCasePresented) {
BindingLocalTestCaseView()
NavigationLink("Legacy") {
List {
ForEach(TestCase.allCases) { test in
switch test {
case .escapedWithViewStore:
NavigationLink(test.rawValue) {
EscapedWithViewStoreTestCaseView()
}

case .forEachBinding:
NavigationLink(test.rawValue) {
ForEachBindingTestCaseView()
}

case .navigationStack:
Button(test.rawValue) {
self.isNavigationStackTestCasePresented = true
}
.foregroundColor(.black)
.sheet(isPresented: self.$isNavigationStackTestCasePresented) {
NavigationStackTestCaseView()
}

case .presentation:
NavigationLink(test.rawValue) {
PresentationTestCaseView()
}

case .presentationItem:
NavigationLink(test.rawValue) {
PresentationItemTestCaseView()
}

case .switchStore:
NavigationLink(test.rawValue) {
SwitchStoreTestCaseView()
}

case .bindingLocal:
Button(test.rawValue) {
self.isBindingLocalTestCasePresented = true
}
.foregroundColor(.black)
.sheet(isPresented: self.$isBindingLocalTestCasePresented) {
BindingLocalTestCaseView()
}
}
}
}
} header: {
Text("Legacy")
.navigationTitle(Text("Legacy"))
}

Section {
Expand Down

This file was deleted.

7 changes: 7 additions & 0 deletions Examples/Integration/Integration/NavigationTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@ struct NavigationTestCaseView: View {
}
}
}

struct NavigationPreviews: PreviewProvider {
static var previews: some View {
let _ = Logger.shared.isEnabled = true
NavigationTestCaseView()
}
}
Loading

0 comments on commit 464d95e

Please sign in to comment.