DomainDigUITests/RecentSearchesTests.swift
32 lines · 1063 bytes
3 symbols in this file
1import XCTest
2
3@MainActor
4final class RecentSearchesTests: XCTestCase {
5
6 override func setUp() {
7 continueAfterFailure = false
8 }
9
10 /// Run one recent search, clear the results, then pick a different one.
11 /// The second pick must run the domain that was tapped, not the one run
12 /// before it.
13 func testTappingARecentSearchRunsThatDomain() {
14 let app = AccessibilityAuditHarness.launch(recentSearches: true)
15 app.selectRootTab("Inspect")
16
17 let field = app.textFields["e.g. cleberg.net"]
18 XCTAssertTrue(field.waitForExistence(timeout: 10))
19
20 app.buttons["Look up healthy.example"].tap()
21 XCTAssertEqual(field.value as? String, "healthy.example")
22
23 let clear = app.buttons["Cancel lookup"].exists ? app.buttons["Cancel lookup"] : app.buttons["Clear results"]
24 clear.tap()
25
26 let next = app.buttons["Look up broken.example"]
27 XCTAssertTrue(next.waitForExistence(timeout: 10))
28 next.tap()
29
30 XCTAssertEqual(field.value as? String, "broken.example")
31 }
32}