Skip to content

Instantly share code, notes, and snippets.

@edudnyk
Last active October 7, 2021 23:53
Show Gist options
  • Save edudnyk/eecde9c5c4803c134e5b3c60a5f62c17 to your computer and use it in GitHub Desktop.
Save edudnyk/eecde9c5c4803c134e5b3c60a5f62c17 to your computer and use it in GitHub Desktop.
ChangedThrice / DismissedOnce test case in SheeKit
final class SheeTestCase: ViewTestCase {
...
func testItemChangedThriceDismissedOnce() {
guard let viewTest = viewTest else {
XCTFail("No view to test.")
return
}
let bounds = UIScreen.main.bounds
viewTest.sendTouchSequence([
(location: CGPoint(x: bounds.maxX * 0.25, y: bounds.midY), globalLocation: nil, timestamp: Date())
])
viewTest.turnRunloop(times: 10)
guard let _ = presentedViewController else {
XCTFail("No presented view to test.")
return
}
viewTest.sendTouchSequence([
(location: CGPoint(x: bounds.maxX * 0.75, y: bounds.midY), globalLocation: nil, timestamp: Date())
])
viewTest.sendTouchSequence([
(location: CGPoint(x: bounds.maxX * 0.75, y: bounds.midY), globalLocation: nil, timestamp: Date())
])
viewTest.turnRunloop(times: 10)
XCTAssertEqual(dismissCounter, 1)
XCTAssertNil(presentedViewController)
UIView.setAnimationsEnabled(true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment