Created
September 17, 2020 21:25
-
-
Save robertofrontado/db62ec54718f0d7e025f460d14b99b1d to your computer and use it in GitHub Desktop.
SnapshotTesting-Test-LoginViewController-MultipleDevices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
import SnapshotTesting | |
@testable import SampleApp | |
class LoginViewControllerSnapshotTests: XCTestCase { | |
func test_loginViewControllerDefaultState() { | |
let viewController = UINavigationController(rootViewController: LoginViewController2()) | |
verifyViewController(viewController, named: "Default") | |
} | |
private func verifyViewController(_ viewController: UIViewController, named: String) { | |
let devices: [String: ViewImageConfig] = ["iPhoneX": .iPhoneX, | |
"iPhone8": .iPhone8, | |
"iPhoneSe": .iPhoneSe] | |
let results = devices.map { device in | |
verifySnapshot(matching: viewController, | |
as: .image(on: device.value), | |
named: "\(named)-\(device.key)", | |
testName: "LoginViewController") | |
} | |
results.forEach { XCTAssertNil($0) } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment