Tusker/TuskerUITests/OnboardingTests.swift

44 lines
1.3 KiB
Swift
Raw Normal View History

2019-12-30 20:59:49 +00:00
//
// 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()
2019-12-31 16:40:56 +00:00
router.instanceRoutes()
app.launch()
2019-12-30 20:59:49 +00:00
}
2019-12-31 16:40:56 +00:00
// can't test logging in because there's no way of interacting with the safari VC that's used in the OAuth flow
2019-12-30 20:59:49 +00:00
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)
}
2019-12-31 16:40:56 +00:00
func testCustomInstanceAppears() {
2019-12-30 20:59:49 +00:00
let searchField = app.searchFields.element
searchField.tap()
searchField.typeText("http://localhost:8080")
XCTAssertTrue(app.staticTexts["localhost"].waitForExistence(timeout: 2))
2019-12-30 20:59:49 +00:00
XCTAssertTrue(app.staticTexts["An instance description"].exists)
}
}