1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import XCTest
final class ProfileConnectionsUITests: XCTestCase {
func testBrowseFollowersAndFollowing() throws {
try XCTSkipUnless(UIDevice.current.userInterfaceIdiom == .phone, "Requires iPhone")
continueAfterFailure = false
XCUIDevice.shared.orientation = .portrait
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-profile-connections-failure"]
app.launch()
app.openOwnProfile()
let followers = app.buttons["profile-followers"]
XCTAssertTrue(followers.waitForExistence(timeout: 5))
followers.tap()
let followersBar = app.navigationBars["Followers"]
XCTAssertTrue(followersBar.waitForExistence(timeout: 5))
let mae = app.buttons["profileConnection-mae"]
XCTAssertTrue(mae.waitForExistence(timeout: 5))
XCTAssertTrue(mae.label.contains("Mae Rivers"))
XCTAssertTrue(mae.label.contains("@mae.example"))
XCTAssertTrue(mae.label.contains("Writer, walker, and amateur cloud spotter"))
XCTAssertTrue(app.buttons["profileConnectionAvatar-mae"].exists)
app.buttons["Load more accounts"].tap()
let retry = app.buttons["Retry"]
XCTAssertTrue(retry.waitForExistence(timeout: 5))
XCTAssertTrue(mae.exists)
retry.tap()
let alex = app.buttons["profileConnection-alex"]
XCTAssertTrue(alex.waitForExistence(timeout: 5))
alex.tap()
let name = app.staticTexts["profileDisplayName"].firstMatch
XCTAssertTrue(name.waitForExistence(timeout: 5))
XCTAssertEqual(name.label, "Alex Kim")
app.navigationBars["Profile"].buttons["Followers"].tap()
XCTAssertTrue(alex.waitForExistence(timeout: 5))
followersBar.buttons["Profile"].tap()
let following = app.buttons["profile-following"]
XCTAssertTrue(following.waitForExistence(timeout: 5))
following.tap()
let sam = app.buttons["profileConnection-sam"]
XCTAssertTrue(sam.waitForExistence(timeout: 5))
XCTAssertFalse(alex.exists)
app.buttons["profileConnectionAvatar-sam"].tap()
XCTAssertTrue(name.waitForExistence(timeout: 5))
XCTAssertEqual(name.label, "Sam Lee")
}
}