Skip to content

Commit

Permalink
[CI] Add disabled tests for visionOS (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
davdroman authored Jul 17, 2024
1 parent b7c9a81 commit 51146e6
Show file tree
Hide file tree
Showing 46 changed files with 148 additions and 142 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,14 @@ jobs:
# os: macos-14
# xcode: 15.4

# - platform: [visionOS, 1]
# runtime: visionOS 1.2
# os: macos-14
# xcode: 15.4
- platform: [visionOS, 1]
runtime: visionOS 1.2
os: macos-14
xcode: 15.4
- platform: [visionOS, 2]
runtime: visionOS 2.0
os: macos-14
xcode: 16.0
steps:
- name: Git Checkout
uses: actions/checkout@v4
Expand All @@ -148,11 +152,6 @@ jobs:
- name: Set environment variables
run: echo "SKIP_SLOW_FASTLANE_WARNING=1" >> $GITHUB_ENV

- if: ${{ matrix.platform[0] == 'visionOS' }}
run: |
defaults write com.apple.dt.Xcode AllowUnsupportedVisionOSHost -bool YES
defaults write com.apple.CoreSimulator AllowUnsupportedVisionOSHost -bool YES
- name: Select Xcode version
run: sudo xcodes select ${{ matrix.xcode }}

Expand Down
38 changes: 19 additions & 19 deletions Examples/Showcase/Showcase/AppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ struct AppView: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.window,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { window in
window.backgroundColor = .brown
}
Expand Down Expand Up @@ -87,7 +87,7 @@ struct ListShowcase: View {
tableView.backgroundView = UIView()
tableView.backgroundColor = .cyan
}
.introspect(.list, on: .iOS(.v16, .v17, .v18), .visionOS(.v1)) { collectionView in
.introspect(.list, on: .iOS(.v16, .v17, .v18), .visionOS(.v1, .v2)) { collectionView in
collectionView.backgroundView = UIView()
collectionView.subviews.dropFirst(1).first?.backgroundColor = .cyan
}
Expand All @@ -112,7 +112,7 @@ struct ListShowcase: View {
tableView.backgroundView = UIView()
tableView.backgroundColor = .cyan
}
.introspect(.list, on: .iOS(.v16, .v17, .v18), .visionOS(.v1), scope: .ancestor) { collectionView in
.introspect(.list, on: .iOS(.v16, .v17, .v18), .visionOS(.v1, .v2), scope: .ancestor) { collectionView in
collectionView.backgroundView = UIView()
collectionView.subviews.dropFirst(1).first?.backgroundColor = .cyan
}
Expand Down Expand Up @@ -150,7 +150,7 @@ struct ScrollViewShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.scrollView,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { scrollView in
scrollView.layer.backgroundColor = UIColor.cyan.cgColor
}
Expand All @@ -171,7 +171,7 @@ struct ScrollViewShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.scrollView,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1),
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2),
scope: .ancestor
) { scrollView in
scrollView.layer.backgroundColor = UIColor.cyan.cgColor
Expand Down Expand Up @@ -207,13 +207,13 @@ struct NavigationShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.navigationView(style: .stack),
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { navigationController in
navigationController.navigationBar.backgroundColor = .cyan
}
.introspect(
.navigationView(style: .columns),
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { splitViewController in
#if os(visionOS)
splitViewController.preferredDisplayMode = .oneBesideSecondary
Expand All @@ -226,7 +226,7 @@ struct NavigationShowcase: View {
}
.introspect(
.searchField,
on: .iOS(.v15, .v16, .v17, .v18), .tvOS(.v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v15, .v16, .v17, .v18), .tvOS(.v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { searchBar in
searchBar.backgroundColor = .red
#if os(iOS)
Expand Down Expand Up @@ -256,7 +256,7 @@ struct PresentationShowcase: View {
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
#elseif os(visionOS)
.introspect(.sheet, on: .visionOS(.v1)) { sheetPresentationController in
.introspect(.sheet, on: .visionOS(.v1, .v2)) { sheetPresentationController in
sheetPresentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
#endif
Expand All @@ -269,7 +269,7 @@ struct PresentationShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.fullScreenCover,
on: .iOS(.v14, .v15, .v16, .v17, .v18), .tvOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v14, .v15, .v16, .v17, .v18), .tvOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { presentationController in
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
Expand All @@ -284,7 +284,7 @@ struct PresentationShowcase: View {
.padding()
.introspect(
.popover,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { presentationController in
presentationController.containerView?.backgroundColor = .red.withAlphaComponent(0.75)
}
Expand All @@ -305,7 +305,7 @@ struct GenericViewShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.view,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { view in
view.backgroundColor = .cyan
}
Expand All @@ -320,7 +320,7 @@ struct GenericViewShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.view,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { view in
view.backgroundColor = .lightGray
}
Expand All @@ -334,7 +334,7 @@ struct GenericViewShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.view,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { view in
view.backgroundColor = .blue
}
Expand All @@ -348,7 +348,7 @@ struct GenericViewShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.view,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { view in
view.backgroundColor = .red
}
Expand All @@ -375,7 +375,7 @@ struct SimpleElementsShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.textField,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { textField in
textField.backgroundColor = .red
}
Expand All @@ -390,7 +390,7 @@ struct SimpleElementsShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.textField,
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { textField in
textField.backgroundColor = .green
}
Expand Down Expand Up @@ -491,7 +491,7 @@ struct SimpleElementsShowcase: View {
Text("DatePicker Red")
}
#if os(iOS) || os(visionOS)
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)) { datePicker in
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)) { datePicker in
datePicker.backgroundColor = .red
}
#elseif os(macOS)
Expand All @@ -512,7 +512,7 @@ struct SimpleElementsShowcase: View {
#if os(iOS) || os(tvOS) || os(visionOS)
.introspect(
.picker(style: .segmented),
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1)
on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .tvOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2)
) { datePicker in
datePicker.backgroundColor = .red
}
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ extension iOSViewVersion<TextFieldType, UITextField> {
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
}

extension tvOSViewVersion<TextFieldType, UITextField> {
Expand All @@ -231,10 +232,12 @@ extension tvOSViewVersion<TextFieldType, UITextField> {
public static let v15 = Self(for: .v15)
public static let v16 = Self(for: .v16)
public static let v17 = Self(for: .v17)
public static let v18 = Self(for: .v18)
}

extension visionOSViewVersion<TextFieldType, UITextField> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
}
#elseif canImport(AppKit)
extension macOSViewVersion<TextFieldType, NSTextField> {
Expand All @@ -243,6 +246,7 @@ extension macOSViewVersion<TextFieldType, NSTextField> {
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
}
#endif
```
Expand Down
3 changes: 2 additions & 1 deletion Sources/ViewTypes/ColorPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import SwiftUI
///
/// var body: some View {
/// ColorPicker("Pick a color", selection: $color)
/// .introspect(.colorPicker, on: .visionOS(.v1)) {
/// .introspect(.colorPicker, on: .visionOS(.v1, .v2)) {
/// print(type(of: $0)) // UIColorPicker
/// }
/// }
Expand Down Expand Up @@ -73,6 +73,7 @@ extension iOSViewVersion<ColorPickerType, UIColorWell> {
@available(iOS 14, *)
extension visionOSViewVersion<ColorPickerType, UIColorWell> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
}
#elseif canImport(AppKit)
@available(macOS 11, *)
Expand Down
1 change: 1 addition & 0 deletions Sources/ViewTypes/FormWithGroupedStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ extension tvOSViewVersion<FormWithGroupedStyleType, UITableView> {

extension visionOSViewVersion<FormWithGroupedStyleType, UICollectionView> {
public static let v1 = Self(for: .v1)
public static let v2 = Self(for: .v2)
}
#elseif canImport(AppKit)
extension macOSViewVersion<FormWithGroupedStyleType, NSScrollView> {
Expand Down
2 changes: 1 addition & 1 deletion Sources/ViewTypes/SignInWithAppleButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import SwiftUI
/// } onCompletion: { result in
/// // do something with result
/// }
/// .introspect(.signInWithAppleButton, on: .visionOS(.v1)) {
/// .introspect(.signInWithAppleButton, on: .visionOS(.v1, .v2)) {
/// print(type(of: $0)) // ASAuthorizationAppleIDButton
/// }
/// }
Expand Down
6 changes: 3 additions & 3 deletions Tests/Tests/ViewTypes/ColorPickerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ final class ColorPickerTests: XCTestCase {
VStack {
ColorPicker("", selection: .constant(PlatformColor.red.cgColor))
#if os(iOS) || os(visionOS)
.introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1), customize: spy0)
.introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2), customize: spy0)
#elseif os(macOS)
.introspect(.colorPicker, on: .macOS(.v11, .v12, .v13, .v14), customize: spy0)
#endif

ColorPicker("", selection: .constant(PlatformColor.green.cgColor))
#if os(iOS) || os(visionOS)
.introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1), customize: spy1)
.introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2), customize: spy1)
#elseif os(macOS)
.introspect(.colorPicker, on: .macOS(.v11, .v12, .v13, .v14), customize: spy1)
#endif

ColorPicker("", selection: .constant(PlatformColor.blue.cgColor))
#if os(iOS) || os(visionOS)
.introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1), customize: spy2)
.introspect(.colorPicker, on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2), customize: spy2)
#elseif os(macOS)
.introspect(.colorPicker, on: .macOS(.v11, .v12, .v13, .v14), customize: spy2)
#endif
Expand Down
6 changes: 3 additions & 3 deletions Tests/Tests/ViewTypes/DatePickerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@ final class DatePickerTests: XCTestCase {
VStack {
DatePicker("", selection: .constant(date0))
#if os(iOS) || os(visionOS)
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1), customize: spy0)
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2), customize: spy0)
#elseif os(macOS)
.introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13, .v14), customize: spy0)
#endif
.cornerRadius(8)

DatePicker("", selection: .constant(date1))
#if os(iOS) || os(visionOS)
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1), customize: spy1)
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2), customize: spy1)
#elseif os(macOS)
.introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13, .v14), customize: spy1)
#endif
.cornerRadius(8)

DatePicker("", selection: .constant(date2))
#if os(iOS) || os(visionOS)
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1), customize: spy2)
.introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2), customize: spy2)
#elseif os(macOS)
.introspect(.datePicker, on: .macOS(.v10_15, .v11, .v12, .v13, .v14), customize: spy2)
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class DatePickerWithCompactStyleTests: XCTestCase {
DatePicker("", selection: .constant(date0))
.datePickerStyle(.compact)
#if os(iOS) || os(visionOS)
.introspect(.datePicker(style: .compact), on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1), customize: spy0)
.introspect(.datePicker(style: .compact), on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2), customize: spy0)
#elseif os(macOS)
.introspect(.datePicker(style: .compact), on: .macOS(.v10_15_4, .v11, .v12, .v13, .v14), customize: spy0)
#endif
Expand All @@ -39,7 +39,7 @@ final class DatePickerWithCompactStyleTests: XCTestCase {
DatePicker("", selection: .constant(date1))
.datePickerStyle(.compact)
#if os(iOS) || os(visionOS)
.introspect(.datePicker(style: .compact), on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1), customize: spy1)
.introspect(.datePicker(style: .compact), on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2), customize: spy1)
#elseif os(macOS)
.introspect(.datePicker(style: .compact), on: .macOS(.v10_15_4, .v11, .v12, .v13, .v14), customize: spy1)
#endif
Expand All @@ -48,7 +48,7 @@ final class DatePickerWithCompactStyleTests: XCTestCase {
DatePicker("", selection: .constant(date2))
.datePickerStyle(.compact)
#if os(iOS) || os(visionOS)
.introspect(.datePicker(style: .compact), on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1), customize: spy2)
.introspect(.datePicker(style: .compact), on: .iOS(.v14, .v15, .v16, .v17, .v18), .visionOS(.v1, .v2), customize: spy2)
#elseif os(macOS)
.introspect(.datePicker(style: .compact), on: .macOS(.v10_15_4, .v11, .v12, .v13, .v14), customize: spy2)
#endif
Expand Down
Loading

0 comments on commit 51146e6

Please sign in to comment.