-
-
Notifications
You must be signed in to change notification settings - Fork 48
Home
Phi Mage edited this page Nov 28, 2015
·
3 revisions
Writing Tests of Asynchronous Operations
func testSomething() {
let url: NSURL = // ...
let expectation = self.expectationWithDescription("description")
Erik.visitURL(url) { (obj, err) -> Void in
if let error = err {
XCTFail("\(error)")
}
else if let document = obj {
if /* check something into doc */ {
expectation.fulfill()
}
}
}
self.waitForExpectationsWithTimeout(20, handler: { error in
XCTAssertNil(error, "Oh, we got timeout")
})
}
if let engine = Erik.sharedInstance.layoutEngine as? WebKitLayoutEngine {
let webView: WKWebView = engine.webView
// add WKUserScript
// add WKScriptMessageHandler
// set a WKNavigationDelegate
}
OAuthSwift : fill connexion information, submit form then authrorize and finally handle callback redirection into WKNavigationDelegate