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/c47501405f631bd0a2ea055fb1181e1f to your computer and use it in GitHub Desktop.
Save robertofrontado/c47501405f631bd0a2ea055fb1181e1f to your computer and use it in GitHub Desktop.
SnapshotTesting-Test-Button-DefaultState
import XCTest
import SnapshotTesting
@testable import SampleApp
class ButtonSnapshotTests: XCTestCase {
func test_buttonDefaultState() {
let button = Button(frame: .init(x: 0, y: 0, width: 128, height: 48)) // 1
button.setTitle("Login", for: .normal) // 2
let result = verifySnapshot(matching: button, // 3
as: .image, // 4
named: "Default", // 5
testName: "Button") // 6
XCTAssertNil(result) // 7
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment