Include the Members and Add Rooms screens in the spaces UI tests. (#4981)

* Expand the space flow UI tests to include the add rooms screen.

Also fixes some failures in these tests due to the room/space title now being a button.

* Expand the space flow UI tests to include the space members screen.

* Reset AppSettings before running preview tests.
This commit is contained in:
Doug
2026-01-21 15:24:54 +00:00
committed by GitHub
parent 8ff16e9133
commit 6e2ff7ae56
14 changed files with 286 additions and 16 deletions
@@ -102,6 +102,7 @@ struct RoomMembersListScreen: View {
Button(L10n.actionInvite) {
context.send(viewAction: .invite)
}
.accessibilityIdentifier(A11yIdentifiers.roomMembersListScreen.invite)
}
}
}
@@ -226,10 +226,6 @@ struct RoomScreen_Previews: PreviewProvider, TestablePreview {
}
static func makeViewModels(canSendMessage: Bool = true, hasSuccessor: Bool = false) -> ViewModels {
// TimelineItemBubbledStylerView sets enableKeyShareOnInvite to true which if run
// before these tests, ends up adding a banner to the snapshots.
AppSettings.resetAllSettings()
let roomProxyMock = JoinedRoomProxyMock(.init(id: "stable_id",
name: "Preview room",
hasOngoingCall: true,
@@ -115,6 +115,7 @@ struct SpaceAddRoomsScreen: View {
ToolbarButton(role: .cancel) {
context.send(viewAction: .cancel)
}
.accessibilityIdentifier(A11yIdentifiers.spaceAddRoomsScreen.cancel)
}
ToolbarItem(placement: .confirmationAction) {
@@ -186,11 +187,7 @@ struct SpaceAddRoomsScreen_Previews: PreviewProvider, TestablePreview {
let spaceRoomListProxy = SpaceRoomListProxyMock(.init(spaceServiceRoom: SpaceServiceRoomMock(.init(isSpace: true))))
let clientProxy = ClientProxyMock(.init())
clientProxy.recentlyVisitedRoomsFilterReturnValue = [
JoinedRoomProxyMock(.init(id: "1", name: "Room Name", canonicalAlias: "#room-name:example.com")),
JoinedRoomProxyMock(.init(id: "2", name: "Room Name", canonicalAlias: "#room-name:example.com")),
JoinedRoomProxyMock(.init(id: "3", name: "Room Name", canonicalAlias: "#room-name:example.com"))
]
clientProxy.recentlyVisitedRoomsFilterReturnValue = .mockRooms
let viewModel = SpaceAddRoomsScreenViewModel(spaceRoomListProxy: spaceRoomListProxy,
userSession: UserSessionMock(.init(clientProxy: clientProxy)),
@@ -100,6 +100,8 @@ struct SpaceScreen: View {
Button { context.send(viewAction: .addExistingRooms) } label: {
Label(L10n.actionAddExistingRooms, icon: \.room)
}
.accessibilityIdentifier(A11yIdentifiers.spaceScreen.addExistingRooms)
Button { context.send(viewAction: .manageChildren) } label: {
Label(L10n.actionManageRooms, icon: \.edit)
}
@@ -111,7 +113,9 @@ struct SpaceScreen: View {
Button { context.send(viewAction: .displayMembers(roomProxy: roomProxy)) } label: {
Label(L10n.screenSpaceMenuActionMembers, icon: \.user)
}
.accessibilityIdentifier(A11yIdentifiers.spaceScreen.viewMembers)
}
if let permalink = context.viewState.permalink {
ShareLink(item: permalink) {
Label(L10n.actionShare, icon: \.shareIos)
@@ -135,6 +139,7 @@ struct SpaceScreen: View {
// Use an SF Symbol to match what ToolbarItemGroup(placement: .secondaryAction) would give us.
Image(systemSymbol: .ellipsis)
}
.accessibilityIdentifier(A11yIdentifiers.spaceScreen.moreMenu)
}
}
}