Skip to content

Commit

Permalink
Merge pull request #16 from sergeykhliustin/update/snapshot_tests
Browse files Browse the repository at this point in the history
Updated snapshot tests
  • Loading branch information
sergiikhliustin authored Jan 24, 2023
2 parents 6d4e396 + c80a85e commit 961a9ab
Show file tree
Hide file tree
Showing 32 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Buildio.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1410;
LastSwiftUpdateCheck = 1420;
LastUpgradeCheck = 1400;
TargetAttributes = {
3F4E0353293D290800AB0322 = {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
7 changes: 6 additions & 1 deletion BuildioUITests/Sources/Shared.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ func appLight() -> XCUIApplication {
"-AppleLocale",
"en_US"
]
#if !targetEnvironment(macCatalyst)
XCUIDevice.shared.orientation = .portrait
#endif
app.launch()
return app
}
Expand All @@ -35,7 +37,9 @@ func appDark() -> XCUIApplication {
"-AppleLocale",
"en_US"
]
#if !targetEnvironment(macCatalyst)
XCUIDevice.shared.orientation = .portrait
#endif
app.launch()
return app
}
Expand Down Expand Up @@ -80,7 +84,8 @@ extension XCTActivity {
line: UInt = #line) {
guard let image = app.windows.firstMatch.screenshot().image.removingBottomBar else { return }
let view = UIImageView(image: image)
SnapshotTesting.assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.92), file: file, testName: testName, line: line)
let name = (ProcessInfo.processInfo.isMacCatalystApp ? "mac_" : "ios_") + testName
SnapshotTesting.assertSnapshot(matching: view, as: .image(perceptualPrecision: 0.92), file: file, testName: name, line: line)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,16 @@ public class TokenManager: ObservableObject {

public init(_ account: String? = nil) {
let keychain = Keychain()
self.tokens = keychain.allKeys().reduce([Token]()) { partialResult, key in
var result = partialResult
if let token = keychain[key] {
result.append(Token(token: token, email: key))
if ProcessInfo.processInfo.isTestEnv {
self.tokens = []
} else {
self.tokens = keychain.allKeys().reduce([Token]()) { partialResult, key in
var result = partialResult
if let token = keychain[key] {
result.append(Token(token: token, email: key))
}
return result
}
return result
}
self.keychain = keychain
if let account = account {
Expand Down Expand Up @@ -108,6 +112,8 @@ public class TokenManager: ObservableObject {
}

fileprivate func saveTokens() {
guard !ProcessInfo.processInfo.isTestEnv else { return }

do {
try keychain.removeAll()
} catch {
Expand Down

0 comments on commit 961a9ab

Please sign in to comment.