Skip to content

Commit

Permalink
Added preferred simulator check, so no tests pass if simulator for sc…
Browse files Browse the repository at this point in the history
…heme is not iPhone 8 iOS 14.5. Same for recording.
  • Loading branch information
msadoon committed Feb 21, 2023
1 parent 84de32d commit 98135d5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Library/TestHelpers/TestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ internal class TestCase: XCTestCase {
userDefaults: self.userDefaults,
uuidType: self.uuidType
)

self.preferredSimulatorCheck()
}

override func tearDown() {
Expand All @@ -81,4 +83,13 @@ internal class TestCase: XCTestCase {

waitForExpectations(timeout: 0.01)
}

internal func preferredSimulatorCheck() {
let supportedModels = ["iPhone10,1", "iPhone10,4"] // iPhone 8
let modelKey = "SIMULATOR_MODEL_IDENTIFIER"

guard #available(iOS 14.5, *), supportedModels.contains(ProcessInfo().environment[modelKey] ?? "") else {
fatalError("Please only test and record screenshots on an iPhone 8 simulator running iOS 14.5")
}
}
}

0 comments on commit 98135d5

Please sign in to comment.