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") } }