Space flow improvements. (#4430)

* Space flow improvements

- Use a state machine to select a space.
- Add a SpaceFlowCoordinator for recursively presenting subspaces.
- Get the spaceRoomListProxy when tapping on the space so we can indicate failures.
- Fix the total room count in SpaceListScreen.

* Refactor spaceRoom → spaceRoomProxy.

* Add a UI test for the Spaces flow.
This commit is contained in:
Doug
2025-08-22 15:49:47 +01:00
committed by GitHub
parent bb5deb9c50
commit d119964d50
34 changed files with 503 additions and 73 deletions
+36 -3
View File
@@ -10,21 +10,33 @@ import XCTest
@MainActor
class UserSessionScreenTests: XCTestCase {
let firstRoomName = "Foundation 🔭🪐🌌"
let firstSpaceName = "The Foundation"
let firstSubspaceName = "Company Space"
enum Step {
static let homeScreen = 1
static let roomScreen = 2
static let composerAttachments = 3
static let spacesTabBar = 4
static let spaceList = 5
static let spaceScreen = 6
static let subspaceScreen = 7
}
func testUserSessionFlows() async throws {
let app = Application.launch(.userSessionScreen)
app.swipeDown() // Make sure the header shows a large title
try await app.assertScreenshot(step: 1)
try await app.assertScreenshot(step: Step.homeScreen)
app.buttons[A11yIdentifiers.homeScreen.roomName(firstRoomName)].tap()
XCTAssert(app.staticTexts[firstRoomName].waitForExistence(timeout: 5.0))
try await Task.sleep(for: .seconds(1))
try await app.assertScreenshot(step: 2)
try await app.assertScreenshot(step: Step.roomScreen)
app.buttons[A11yIdentifiers.roomScreen.composerToolbar.openComposeOptions].tap(.center)
try await app.assertScreenshot(step: 3)
try await app.assertScreenshot(step: Step.composerAttachments)
}
func testUserSessionReply() async throws {
@@ -53,4 +65,25 @@ class UserSessionScreenTests: XCTestCase {
let joinButton = app.buttons["Continue"]
XCTAssert(joinButton.waitForExistence(timeout: 10))
}
func testSpaceExploration() async throws {
let app = Application.launch(.userSessionSpacesFlow)
try await app.assertScreenshot(step: Step.spacesTabBar)
// app.tabBars doesn't work on iPadOS 18 😐
app.buttons["Spaces"].firstMatch.tap(.center)
try await app.assertScreenshot(step: Step.spaceList)
app.buttons[A11yIdentifiers.spaceListScreen.spaceRoomName(firstSpaceName)].tap()
XCTAssert(app.staticTexts[firstSpaceName].waitForExistence(timeout: 5.0))
try await Task.sleep(for: .seconds(1))
try await app.assertScreenshot(step: Step.spaceScreen)
app.buttons[A11yIdentifiers.spaceListScreen.spaceRoomName(firstSubspaceName)].tap()
XCTAssert(app.staticTexts[firstSubspaceName].waitForExistence(timeout: 5.0))
try await Task.sleep(for: .seconds(1))
try await app.assertScreenshot(step: Step.subspaceScreen)
}
}