Add UI tests for accepting space invites. (#4602)

* Fix the space visibility icon size in the join room screen.

* Add a UI test for accepting space invites.
This commit is contained in:
Doug
2025-10-09 10:11:02 +01:00
committed by GitHub
parent 0e047477c5
commit c572a1a431
51 changed files with 166 additions and 83 deletions
@@ -14,6 +14,7 @@ class UserSessionScreenTests: XCTestCase {
let unjoinedSpaceRoomName = "Company Room"
let joinedSubspaceName = "Joined Space"
let joinedSubspaceRoomName = "Management"
let spaceInviteName = "First space"
enum Step {
static let homeScreen = 1
@@ -108,4 +109,36 @@ class UserSessionScreenTests: XCTestCase {
try await Task.sleep(for: .seconds(1))
try await app.assertScreenshot(step: Step.spaceJoinRoomScreen)
}
func testAcceptSpaceInvite() async throws {
let app = Application.launch(.userSessionSpacesFlow)
app.swipeDown() // Make sure the header shows a large title
try await app.assertScreenshot(step: Step.spacesTabBar)
// Tap the space invite cell.
app.staticTexts[A11yIdentifiers.homeScreen.roomName(spaceInviteName)].tap()
XCTAssert(app.buttons[A11yIdentifiers.joinRoomScreen.join].waitForExistence(timeout: 5.0))
try await Task.sleep(for: .seconds(1))
try await app.assertScreenshot(step: Step.spaceJoinRoomScreen)
// Tap join on the join room screen.
app.buttons[A11yIdentifiers.joinRoomScreen.join].tap()
XCTAssert(app.staticTexts[A11yIdentifiers.roomScreen.name].waitForExistence(timeout: 5.0)) // The space screen reuses the room screen header
try await Task.sleep(for: .seconds(1))
try await app.assertScreenshot(step: Step.spaceScreen)
// Go back to the room list.
app.navigationBars.buttons["Chats"].firstMatch.tap(.center)
XCTAssert(app.staticTexts["Chats"].waitForExistence(timeout: 5.0))
// Tap the join button in the space invite cell.
app.buttons.matching(NSPredicate(format: "identifier == %@ && label == %@",
A11yIdentifiers.homeScreen.roomName(spaceInviteName),
"Accept")).firstMatch.tap()
XCTAssert(app.staticTexts[A11yIdentifiers.roomScreen.name].waitForExistence(timeout: 5.0)) // The space screen reuses the room screen header
try await Task.sleep(for: .seconds(1))
try await app.assertScreenshot(step: Step.spaceScreen)
}
}