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)
}
}
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dee57958e736136e2598db20aae58486bf68d56352c68097319e3f4e2cea6dd9
size 452748
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:58e3b99a771576265452df3bc51eef487ecf160e48f5ce9b4dd507fe0892e6e4
size 402961
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:63044eae82b5caf0e61eaa7e65f2fff30e2dca8fe282ce7c7fd2e4edd562811d
size 373691
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0d16db9f4d2cab604bc19a76585202586df21749d48da09c8e969c2624637ccf
size 277095
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8f3668e91005046ed8ee295d34c4f160a1501e427337c6bf96cdcdf34aa83c65
size 484663
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:959f56d7a54cb10cd0fbdaac3fab6e65fab0d2d391f21211be35ea312d7c6543
size 332003
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d966e5361b6c386668228ee436c1fbf4a2b53065169120aaca669ac485736c5f
size 402376
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:10c0b735d009691762e8719ff2dc3c01ce8e1c984e080caebe322336a6d378bd
size 117024