//
//  TuskerUITests.swift
//  TuskerUITests
//
//  Created by Shadowfacts on 8/15/18.
//  Copyright © 2018 Shadowfacts. All rights reserved.
//

import XCTest
//import Embassy
//import Ambassador

class TuskerUITests: XCTestCase {
    
//    var eventLoop: EventLoop!
//    var router: Router!
//    var server: HTTPServer!
//    var eventLoopThreadCondition: NSCondition!
//    var eventLoopThread: Thread!
    
    var app: XCUIApplication!

//    private func setupWebServer() {
//        eventLoop = try! SelectorEventLoop(selector: try! KqueueSelector())
//        router = Router()
//        server = DefaultHTTPServer(eventLoop: eventLoop, port: 8080, app: router.app)
//        router["/hello"] = JSONResponse(handler: { (_) in
//            return ["Hello", "World"]
//        })
//        try! server.start()
//
//        eventLoopThreadCondition = NSCondition()
//        eventLoopThread = Thread(block: {
//            self.eventLoop.runForever()
//            self.eventLoopThreadCondition.lock()
//            self.eventLoopThreadCondition.signal()
//            self.eventLoopThreadCondition.unlock()
//        })
//        eventLoopThread.start()
//    }
    
    override func setUp() {
//        setupWebServer()
        
        continueAfterFailure = false
        app = XCUIApplication()
        app.launchEnvironment["UI_TESTING"] = "true"
    }

    override func tearDown() {
//        server.stopAndWait()
//        eventLoopThreadCondition.lock()
//        eventLoop.stop()
//        while eventLoop.running {
//            if !eventLoopThreadCondition.wait(until: Date(timeIntervalSinceNow: 10)) {
//                fatalError("Join eventLoopThread timeout")
//            }
//        }
    }

}
