Skip to content

Instantly share code, notes, and snippets.

@edudnyk
Last active October 7, 2021 23:56
Show Gist options
  • Save edudnyk/0d2626b1f8fa65e613ab80535bb6dc0b to your computer and use it in GitHub Desktop.
Save edudnyk/0d2626b1f8fa65e613ab80535bb6dc0b to your computer and use it in GitHub Desktop.
ChangedThrice / DismissedTwice test case in SheeKit
final class SheeTestCase: ViewTestCase {
...
func testItemChangedThriceDismissedTwice() {
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: 20)
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.turnRunloop(times: 10)
viewTest.sendTouchSequence([
(location: CGPoint(x: bounds.maxX * 0.75, y: bounds.midY), globalLocation: nil, timestamp: Date())
])
viewTest.turnRunloop(times: 10)
XCTAssertEqual(dismissCounter, 2)
XCTAssertNil(presentedViewController)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment