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

Fix Github Action Checks #221

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
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
18 changes: 12 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ jobs:
- name: Set Xcode Version
uses: maxim-lobanov/[email protected]
with:
xcode-version: '16.1'
xcode-version: '16.2'

- name: Checkout
uses: actions/[email protected]

- name: Install Gem Dependencies
run: bundle install
- name: Set Ruby Version
uses: ruby/[email protected]
with:
ruby-version: '3.0.0'
bundler-cache: true

- name: Run UnitTests
run: bundle exec fastlane test
Expand All @@ -36,13 +39,16 @@ jobs:
- name: Set Xcode Version
uses: maxim-lobanov/[email protected]
with:
xcode-version: '16.1'
xcode-version: '16.2'

- name: Checkout
uses: actions/[email protected]

- name: Install Gem Dependencies
run: bundle install
- name: Set Ruby Version
uses: ruby/[email protected]
with:
ruby-version: '3.0.0'
bundler-cache: true

- name: Run SnapshotTests
run: bundle exec fastlane snapshot_test
27 changes: 15 additions & 12 deletions CineasteSnapshotTests/XCTestCase+SnapshotTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import SnapshotTesting
func assertThemedNavigationSnapshot(
for themes: [UIUserInterfaceStyle] = [.light, .dark],
matching value: UINavigationController,
named name: String? = nil,
record recording: Bool = false,
timeout: TimeInterval = 5,
file: StaticString = #file,
Expand Down Expand Up @@ -69,7 +68,6 @@ func assertThemedViewSnapshot(
for themes: [UIUserInterfaceStyle] = [.light, .dark],
matching value: UIView,
with size: CGSize? = nil,
named name: String? = nil,
record recording: Bool = false,
timeout: TimeInterval = 5,
file: StaticString = #file,
Expand All @@ -95,15 +93,20 @@ func assertThemedViewSnapshot(
}

/// Asserts that a given value matches a reference on disk.
/// This overload makes two snapshots with "Light" and "Dark" user interface style in a UIViewController on a iPhoneX device (with safe areas).
/// This overload makes two snapshots with "Light" and "Dark" user interface style in a UIViewController on a iPhoneSE device.
///
/// - Parameters:
///
/// - themes: An array of UIUserInterfaceStyle you want to test.
/// - value: A value to compare against a reference.
func assertThemedLandscapeViewControllerSnapshot(
for themes: [UIUserInterfaceStyle] = [.light, .dark],
matching value: UIViewController
matching value: UIViewController,
record recording: Bool = false,
timeout: TimeInterval = 5,
file: StaticString = #file,
testName: String = #function,
line: UInt = #line
) {
enforceSnapshotDevice()

Expand All @@ -114,21 +117,21 @@ func assertThemedLandscapeViewControllerSnapshot(
matching: value,
as: .image(on: .iPhoneSe(.landscape), precision: 0.99),
named: "landscape-\(theme.displayName)",
record: false,
timeout: 5,
file: #file,
testName: #function,
line: #line
record: recording,
timeout: timeout,
file: file,
testName: testName,
line: line
)
}
}

private func enforceSnapshotDevice() {
let is2xDevice = UIScreen.main.scale == 2
let isVersion17 = ProcessInfo().operatingSystemVersion.majorVersion == 17
let isVersion18 = ProcessInfo().operatingSystemVersion.majorVersion == 18

guard is2xDevice, isVersion17 else {
fatalError("Running device should have @2x screen scale (like iPhone SE) and iOS17.")
guard is2xDevice, isVersion18 else {
fatalError("Running device should have @2x screen scale (like iPhone SE) and iOS18.")
}
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
14 changes: 6 additions & 8 deletions CineasteUITests/ScreenshotsUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ class ScreenshotsUITests: XCTestCase {
// "-UIPreferredContentSizeCategoryName",
// "UICTContentSizeCategoryL"
]

Task {
await setupSnapshot(self.app, waitForAnimations: true)
}
}

@MainActor
func testScreenshots() {
setupSnapshot(app, waitForAnimations: true)
app.launch()

resetMoviesIfNeeded()
Expand Down Expand Up @@ -106,10 +104,12 @@ class ScreenshotsUITests: XCTestCase {
}
}

@MainActor
func testScreenshotsOfSearchWithDarkMode() {
app.launchArguments += [
"UI_TEST_DARK_MODE"
]
setupSnapshot(app, waitForAnimations: true)
app.launch()

screenshotSearchWithMarkers()
Expand Down Expand Up @@ -180,10 +180,8 @@ extension ScreenshotsUITests {
}
}

private func namedSnapshot(_ name: String) {
Task {
await snapshot(snapshotName(for: name), timeWaitingForIdle: 0)
}
@MainActor private func namedSnapshot(_ name: String) {
snapshot(snapshotName(for: name), timeWaitingForIdle: 0)
}

private func snapshotName(for name: String) -> String {
Expand Down
Loading