Tusker/TuskerUITests/OnboardingTests.swift

44 lines
1.3 KiB
Swift

//
// OnboardingTests.swift
// TuskerUITests
//
// Created by Shadowfacts on 12/21/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import XCTest
//import Ambassador
class OnboardingTests: TuskerUITests {
override func setUp() {
super.setUp()
// router.instanceRoutes()
app.launch()
}
// can't test logging in because there's no way of interacting with the safari VC that's used in the OAuth flow
func testSearchSuggestedInstances() {
XCTAssertTrue(app.cells.firstMatch.waitForExistence(timeout: 2))
let firstInstanceLabel = app.cells.staticTexts.firstMatch.label
let secondInstanceLabel = app.cells.element(boundBy: 1).staticTexts.firstMatch.label
let searchField = app.searchFields.element
searchField.tap()
searchField.typeText(firstInstanceLabel)
XCTAssertTrue(app.staticTexts[firstInstanceLabel].exists)
XCTAssertFalse(app.staticTexts[secondInstanceLabel].exists)
}
func testCustomInstanceAppears() {
let searchField = app.searchFields.element
searchField.tap()
searchField.typeText("http://localhost:8080")
XCTAssertTrue(app.staticTexts["localhost"].waitForExistence(timeout: 2))
XCTAssertTrue(app.staticTexts["An instance description"].exists)
}
}