mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Event Permalink Tweaks (#2754)
* Handle errors focussing the timeline. * Add a test for focussing on an existing timeline item.
This commit is contained in:
@@ -95,6 +95,8 @@ class MockScreen: Identifiable {
|
||||
let windowManager: SecureWindowManagerProtocol
|
||||
let navigationRootCoordinator: NavigationRootCoordinator
|
||||
|
||||
private var client: UITestsSignalling.Client?
|
||||
|
||||
private var retainedState = [Any]()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
@@ -393,6 +395,37 @@ class MockScreen: Identifiable {
|
||||
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
case .roomLayoutHighlight:
|
||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||
|
||||
let timelineController = MockRoomTimelineController()
|
||||
timelineController.timelineItems = RoomTimelineItemFixtures.permalinkChunk
|
||||
let parameters = RoomScreenCoordinatorParameters(roomProxy: RoomProxyMock(with: .init(name: "Timeline highlight", avatarURL: URL.picturesDirectory)),
|
||||
timelineController: timelineController,
|
||||
mediaProvider: MockMediaProvider(),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
voiceMessageMediaManager: VoiceMessageMediaManagerMock(),
|
||||
emojiProvider: EmojiProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings)
|
||||
let coordinator = RoomScreenCoordinator(parameters: parameters)
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
|
||||
do {
|
||||
let client = try UITestsSignalling.Client(mode: .app)
|
||||
client.signals.sink { [weak self] signal in
|
||||
guard case .timeline(.focusOnEvent(let eventID)) = signal else { return }
|
||||
coordinator.focusOnEvent(eventID: eventID)
|
||||
try? client.send(.success)
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
} catch {
|
||||
fatalError("Failure setting up signalling: \(error)")
|
||||
}
|
||||
|
||||
self.client = client
|
||||
return navigationStackCoordinator
|
||||
case .roomWithDisclosedPolls:
|
||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ enum UITestsScreenIdentifier: String {
|
||||
case roomLayoutBottom
|
||||
case roomLayoutMiddle
|
||||
case roomLayoutTop
|
||||
case roomLayoutHighlight
|
||||
case roomMembersListScreenPendingInvites
|
||||
case roomPlainNoAvatar
|
||||
case roomRolesAndPermissionsFlow
|
||||
|
||||
@@ -27,11 +27,13 @@ enum UITestsSignal: Codable, Equatable {
|
||||
case success
|
||||
|
||||
case timeline(Timeline)
|
||||
enum Timeline: Codable {
|
||||
enum Timeline: Codable, Equatable {
|
||||
/// Ask the app to back paginate.
|
||||
case paginate
|
||||
/// Ask the app to simulate an incoming message.
|
||||
case incomingMessage
|
||||
/// Ask the app to simulate focussing on an event ID.
|
||||
case focusOnEvent(String)
|
||||
}
|
||||
|
||||
/// Posts a notification.
|
||||
|
||||
Reference in New Issue
Block a user