Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertofrontado/db62ec54718f0d7e025f460d14b99b1d to your computer and use it in GitHub Desktop.
Save robertofrontado/db62ec54718f0d7e025f460d14b99b1d to your computer and use it in GitHub Desktop.
SnapshotTesting-Test-LoginViewController-MultipleDevices
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