mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Retrofit deferFulfillment onto snapshot tests. (#3641)
* Retrofit `deferFulfillment` onto snapshot tests. * Convert a bunch of preview tests to the new fulfillment publisher * Convert more tests * Remove unneeded delays from the remaining tests * Remove snapshotting delay option.
This commit is contained in:
@@ -136,20 +136,23 @@ struct LoginScreen_Previews: PreviewProvider, TestablePreview {
|
||||
NavigationStack {
|
||||
LoginScreen(context: viewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||
state.homeserver.loginMode == .password
|
||||
})
|
||||
.previewDisplayName("matrix.org")
|
||||
.snapshotPreferences(delay: 1)
|
||||
|
||||
NavigationStack {
|
||||
LoginScreen(context: credentialsViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: credentialsViewModel.context.$viewState.map { state in
|
||||
state.homeserver.loginMode == .password
|
||||
})
|
||||
.previewDisplayName("Credentials Entered")
|
||||
.snapshotPreferences(delay: 1)
|
||||
|
||||
NavigationStack {
|
||||
LoginScreen(context: unconfiguredViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Unsupported")
|
||||
.snapshotPreferences(delay: 1)
|
||||
}
|
||||
|
||||
static func makeViewModel(homeserverAddress: String = "matrix.org", withCredentials: Bool = false) -> LoginScreenViewModel {
|
||||
|
||||
+3
-1
@@ -107,7 +107,9 @@ struct ServerSelection_Previews: PreviewProvider, TestablePreview {
|
||||
NavigationStack {
|
||||
ServerSelectionScreen(context: invalidViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 1)
|
||||
.snapshotPreferences(expect: invalidViewModel.context.$viewState.map { state in
|
||||
state.hasValidationError == true
|
||||
})
|
||||
}
|
||||
|
||||
static func makeViewModel(for homeserverAddress: String) -> ServerSelectionScreenViewModel {
|
||||
|
||||
@@ -332,12 +332,16 @@ struct CreateRoom_Previews: PreviewProvider, TestablePreview {
|
||||
NavigationStack {
|
||||
CreateRoomScreen(context: publicRoomInvalidAliasViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 1.5)
|
||||
.snapshotPreferences(expect: publicRoomExistingAliasViewModel.context.$viewState.map { state in
|
||||
!state.aliasErrors.isEmpty
|
||||
})
|
||||
.previewDisplayName("Create Public Room, invalid alias")
|
||||
NavigationStack {
|
||||
CreateRoomScreen(context: publicRoomExistingAliasViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 1.5)
|
||||
.snapshotPreferences(expect: publicRoomExistingAliasViewModel.context.$viewState.map { state in
|
||||
!state.aliasErrors.isEmpty
|
||||
})
|
||||
.previewDisplayName("Create Public Room, existing alias")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,9 @@ struct EmojiPickerScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static var previews: some View {
|
||||
EmojiPickerScreen(context: viewModel.context, selectedEmojis: ["😀", "😄"])
|
||||
.previewDisplayName("Screen")
|
||||
.snapshotPreferences(delay: 0.5)
|
||||
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||
!state.categories.isEmpty
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -152,16 +152,17 @@ struct TimelineMediaPreviewDetailsView_Previews: PreviewProvider, TestablePrevie
|
||||
TimelineMediaPreviewDetailsView(item: viewModel.state.currentItem,
|
||||
context: viewModel.context)
|
||||
.previewDisplayName("Image")
|
||||
.snapshotPreferences(delay: 0.1)
|
||||
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||
state.currentItemActions?.secondaryActions.contains(.redact) ?? false
|
||||
})
|
||||
|
||||
TimelineMediaPreviewDetailsView(item: unknownTypeViewModel.state.currentItem,
|
||||
context: unknownTypeViewModel.context)
|
||||
.previewDisplayName("Unknown type")
|
||||
.snapshotPreferences(delay: 0.1)
|
||||
|
||||
TimelineMediaPreviewDetailsView(item: presentedOnRoomViewModel.state.currentItem,
|
||||
context: presentedOnRoomViewModel.context)
|
||||
.previewDisplayName("Incoming on Room")
|
||||
.snapshotPreferences(delay: 0.1)
|
||||
}
|
||||
|
||||
static func makeViewModel(contentType: UTType? = nil, isOutgoing: Bool = false, isPresentedOnRoomScreen: Bool = false) -> TimelineMediaPreviewViewModel {
|
||||
|
||||
@@ -196,19 +196,26 @@ struct HomeScreen_Previews: PreviewProvider, TestablePreview {
|
||||
NavigationStack {
|
||||
HomeScreen(context: loadingViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: loadedViewModel.context.$viewState.map { state in
|
||||
state.roomListMode == .skeletons
|
||||
})
|
||||
.previewDisplayName("Loading")
|
||||
|
||||
NavigationStack {
|
||||
HomeScreen(context: emptyViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: emptyViewModel.context.$viewState.map { state in
|
||||
state.roomListMode == .empty
|
||||
})
|
||||
.previewDisplayName("Empty")
|
||||
.snapshotPreferences(delay: 4.0)
|
||||
|
||||
NavigationStack {
|
||||
HomeScreen(context: loadedViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: loadedViewModel.context.$viewState.map { state in
|
||||
state.roomListMode == .rooms
|
||||
})
|
||||
.previewDisplayName("Loaded")
|
||||
.snapshotPreferences(delay: 4.0)
|
||||
}
|
||||
|
||||
static func viewModel(_ mode: HomeScreenRoomListMode) -> HomeScreenViewModel {
|
||||
|
||||
@@ -202,32 +202,42 @@ struct JoinRoomScreen_Previews: PreviewProvider, TestablePreview {
|
||||
NavigationStack {
|
||||
JoinRoomScreen(context: unknownViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: unknownViewModel.context.$viewState.map { state in
|
||||
state.roomDetails != nil
|
||||
})
|
||||
.previewDisplayName("Unknown")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
NavigationStack {
|
||||
JoinRoomScreen(context: knockViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: knockViewModel.context.$viewState.map { state in
|
||||
state.roomDetails != nil
|
||||
})
|
||||
.previewDisplayName("Knock")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
NavigationStack {
|
||||
JoinRoomScreen(context: joinViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: joinViewModel.context.$viewState.map { state in
|
||||
state.roomDetails != nil
|
||||
})
|
||||
.previewDisplayName("Join")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
NavigationStack {
|
||||
JoinRoomScreen(context: inviteViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: inviteViewModel.context.$viewState.map { state in
|
||||
state.roomDetails != nil
|
||||
})
|
||||
.previewDisplayName("Invite")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
NavigationStack {
|
||||
JoinRoomScreen(context: knockedViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: knockedViewModel.context.$viewState.map { state in
|
||||
state.roomDetails != nil
|
||||
})
|
||||
.previewDisplayName("Knocked")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
}
|
||||
|
||||
static func makeViewModel(mode: JoinRoomScreenInteractionMode) -> JoinRoomScreenViewModel {
|
||||
|
||||
+13
-4
@@ -127,23 +127,32 @@ struct KnockRequestsListScreen_Previews: PreviewProvider, TestablePreview {
|
||||
NavigationStack {
|
||||
KnockRequestsListScreen(context: viewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 0.2)
|
||||
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||
state.shouldDisplayRequests == true
|
||||
})
|
||||
|
||||
NavigationStack {
|
||||
KnockRequestsListScreen(context: singleRequestViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: singleRequestViewModel.context.$viewState.map { state in
|
||||
state.shouldDisplayRequests == true
|
||||
})
|
||||
.previewDisplayName("Single Request")
|
||||
.snapshotPreferences(delay: 0.2)
|
||||
|
||||
|
||||
NavigationStack {
|
||||
KnockRequestsListScreen(context: emptyViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: emptyViewModel.context.$viewState.map { state in
|
||||
state.shouldDisplayEmptyView == true
|
||||
})
|
||||
.previewDisplayName("Empty state")
|
||||
.snapshotPreferences(delay: 0.2)
|
||||
|
||||
NavigationStack {
|
||||
KnockRequestsListScreen(context: loadingViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: loadingViewModel.context.$viewState.map { state in
|
||||
state.isLoading == true
|
||||
})
|
||||
.previewDisplayName("Loading state")
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -108,7 +108,9 @@ struct IdentityConfirmationScreen_Previews: PreviewProvider, TestablePreview {
|
||||
NavigationStack {
|
||||
IdentityConfirmationScreen(context: viewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 1)
|
||||
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||
state.availableActions.contains([.interactiveVerification, .recovery])
|
||||
})
|
||||
}
|
||||
|
||||
private static var viewModel: IdentityConfirmationScreenViewModel {
|
||||
|
||||
@@ -174,12 +174,13 @@ struct RoomDetailsEditScreen_Previews: PreviewProvider, TestablePreview {
|
||||
RoomDetailsEditScreen(context: readOnlyViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Read only")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
NavigationStack {
|
||||
RoomDetailsEditScreen(context: editableViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: editableViewModel.context.$viewState.map { state in
|
||||
state.canEditTopic == true
|
||||
})
|
||||
.previewDisplayName("Editable")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,13 +419,21 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
static var previews: some View {
|
||||
RoomDetailsScreen(context: simpleRoomViewModel.context)
|
||||
.snapshotPreferences(expect: simpleRoomViewModel.context.$viewState.map { state in
|
||||
state.shortcuts.contains(.invite)
|
||||
})
|
||||
.previewDisplayName("Simple Room")
|
||||
.snapshotPreferences(delay: 2)
|
||||
|
||||
RoomDetailsScreen(context: dmRoomViewModel.context)
|
||||
.snapshotPreferences(expect: dmRoomViewModel.context.$viewState.map { state in
|
||||
state.accountOwner != nil
|
||||
})
|
||||
.previewDisplayName("DM Room")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
RoomDetailsScreen(context: genericRoomViewModel.context)
|
||||
.snapshotPreferences(expect: genericRoomViewModel.context.$viewState.map { state in
|
||||
state.shortcuts.contains(.invite)
|
||||
})
|
||||
.previewDisplayName("Generic Room")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -98,6 +98,5 @@ struct RoomDirectorySearchScreen_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
static var previews: some View {
|
||||
RoomDirectorySearchScreen(context: viewModel.context)
|
||||
.snapshotPreferences(delay: 1.0)
|
||||
}
|
||||
}
|
||||
|
||||
+15
-4
@@ -139,17 +139,28 @@ struct RoomMemberDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
static var previews: some View {
|
||||
RoomMemberDetailsScreen(context: verifiedUserViewModel.context)
|
||||
.snapshotPreferences(expect: verifiedUserViewModel.context.$viewState.map { state in
|
||||
state.isVerified == true
|
||||
})
|
||||
.previewDisplayName("Verified User")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
RoomMemberDetailsScreen(context: otherUserViewModel.context)
|
||||
.snapshotPreferences(expect: otherUserViewModel.context.$viewState.map { state in
|
||||
state.memberDetails?.role == .user
|
||||
})
|
||||
.previewDisplayName("Other User")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
RoomMemberDetailsScreen(context: accountOwnerViewModel.context)
|
||||
.snapshotPreferences(expect: accountOwnerViewModel.context.$viewState.map { state in
|
||||
state.isOwnMemberDetails == true
|
||||
})
|
||||
.previewDisplayName("Account Owner")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
RoomMemberDetailsScreen(context: ignoredUserViewModel.context)
|
||||
.snapshotPreferences(expect: ignoredUserViewModel.context.$viewState.map { state in
|
||||
state.memberDetails?.isIgnored ?? false
|
||||
})
|
||||
.previewDisplayName("Ignored User")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
}
|
||||
|
||||
static func makeViewModel(member: RoomMemberProxyMock) -> RoomMemberDetailsScreenViewModel {
|
||||
|
||||
-2
@@ -72,13 +72,11 @@ struct RoomMembersListManageMemberSheet_Previews: PreviewProvider, TestablePrevi
|
||||
actions: [.kick, .ban],
|
||||
context: viewModel.context)
|
||||
.previewDisplayName("Joined")
|
||||
.snapshotPreferences(delay: 0.2)
|
||||
|
||||
RoomMembersListManageMemberSheet(member: .init(withProxy: RoomMemberProxyMock.mockBanned[3]),
|
||||
actions: [],
|
||||
context: viewModel.context)
|
||||
.previewDisplayName("Banned")
|
||||
.snapshotPreferences(delay: 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,31 +117,41 @@ struct RoomMembersListScreen_Previews: PreviewProvider, TestablePreview {
|
||||
NavigationStack {
|
||||
RoomMembersListScreen(context: viewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 1.0)
|
||||
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||
!state.visibleJoinedMembers.isEmpty
|
||||
})
|
||||
.previewDisplayName("Member")
|
||||
|
||||
NavigationStack {
|
||||
RoomMembersListScreen(context: invitesViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 1.0)
|
||||
.snapshotPreferences(expect: invitesViewModel.context.$viewState.map { state in
|
||||
!state.visibleJoinedMembers.isEmpty
|
||||
})
|
||||
.previewDisplayName("Invites")
|
||||
|
||||
NavigationStack {
|
||||
RoomMembersListScreen(context: adminViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 1.0)
|
||||
.snapshotPreferences(expect: adminViewModel.context.$viewState.map { state in
|
||||
state.canBanUsers == true
|
||||
})
|
||||
.previewDisplayName("Admin: Members")
|
||||
|
||||
NavigationStack {
|
||||
RoomMembersListScreen(context: bannedViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 1.0)
|
||||
.snapshotPreferences(expect: bannedViewModel.context.$viewState.map { state in
|
||||
state.canBanUsers == true
|
||||
})
|
||||
.previewDisplayName("Admin: Banned")
|
||||
|
||||
NavigationStack {
|
||||
RoomMembersListScreen(context: emptyBannedViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 1.0)
|
||||
.snapshotPreferences(expect: emptyBannedViewModel.context.$viewState.map { state in
|
||||
state.canBanUsers == true
|
||||
})
|
||||
.previewDisplayName("Admin: Empty Banned")
|
||||
}
|
||||
|
||||
|
||||
@@ -151,12 +151,10 @@ struct RoomPollsHistoryScreen_Previews: PreviewProvider, TestablePreview {
|
||||
RoomPollsHistoryScreen(context: viewModelEmpty.context)
|
||||
}
|
||||
.previewDisplayName("No polls")
|
||||
.snapshotPreferences(delay: 1.0)
|
||||
|
||||
NavigationStack {
|
||||
RoomPollsHistoryScreen(context: viewModel.context)
|
||||
}
|
||||
.previewDisplayName("polls")
|
||||
.snapshotPreferences(delay: 1.0)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -224,7 +224,7 @@ struct SecureBackupRecoveryKeyScreen: View {
|
||||
struct SecureBackupRecoveryKeyScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static let key = "EsTM njec uHYA yHmh dQdW Nj4o bNRU 9jMN XGMc KUNM UFr5 R8GY"
|
||||
static let notSetUpViewModel = viewModel(recoveryState: .disabled)
|
||||
static let generatingViewModel = viewModel(recoveryState: .disabled, generateKey: true)
|
||||
static let generatingViewModel = viewModel(recoveryState: .disabled, generateKey: true, key: key)
|
||||
static let setupViewModel = viewModel(recoveryState: .enabled, generateKey: true, key: key)
|
||||
static let incompleteViewModel = viewModel(recoveryState: .incomplete)
|
||||
static let unknownViewModel = viewModel(recoveryState: .unknown)
|
||||
@@ -239,14 +239,15 @@ struct SecureBackupRecoveryKeyScreen_Previews: PreviewProvider, TestablePreview
|
||||
SecureBackupRecoveryKeyScreen(context: generatingViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Generating")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
NavigationStack {
|
||||
SecureBackupRecoveryKeyScreen(context: setupViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: setupViewModel.context.$viewState.map { state in
|
||||
state.recoveryKey != nil
|
||||
})
|
||||
.previewDisplayName("Set up")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
|
||||
NavigationStack {
|
||||
SecureBackupRecoveryKeyScreen(context: incompleteViewModel.context)
|
||||
}
|
||||
|
||||
+30
-21
@@ -125,28 +125,37 @@ struct SecureBackupScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static let recoveryIncompleteViewModel = viewModel(keyBackupState: .enabled, recoveryState: .incomplete)
|
||||
|
||||
static var previews: some View {
|
||||
Group {
|
||||
NavigationStack {
|
||||
SecureBackupScreen(context: bothSetupViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Both setup")
|
||||
|
||||
NavigationStack {
|
||||
SecureBackupScreen(context: onlyKeyBackupSetUpViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Only key backup setup")
|
||||
|
||||
NavigationStack {
|
||||
SecureBackupScreen(context: keyBackupDisabledViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Key backup disabled")
|
||||
|
||||
NavigationStack {
|
||||
SecureBackupScreen(context: recoveryIncompleteViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Recovery incomplete")
|
||||
NavigationStack {
|
||||
SecureBackupScreen(context: bothSetupViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(delay: 1.0)
|
||||
.snapshotPreferences(expect: bothSetupViewModel.context.$viewState.map { state in
|
||||
state.keyBackupState == .enabled
|
||||
})
|
||||
.previewDisplayName("Both setup")
|
||||
|
||||
NavigationStack {
|
||||
SecureBackupScreen(context: onlyKeyBackupSetUpViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: onlyKeyBackupSetUpViewModel.context.$viewState.map { state in
|
||||
state.keyBackupState == .enabled
|
||||
})
|
||||
.previewDisplayName("Only key backup setup")
|
||||
|
||||
NavigationStack {
|
||||
SecureBackupScreen(context: keyBackupDisabledViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: keyBackupDisabledViewModel.context.$viewState.map { state in
|
||||
state.keyBackupState == .unknown
|
||||
})
|
||||
.previewDisplayName("Key backup disabled")
|
||||
|
||||
NavigationStack {
|
||||
SecureBackupScreen(context: recoveryIncompleteViewModel.context)
|
||||
}
|
||||
.snapshotPreferences(expect: recoveryIncompleteViewModel.context.$viewState.map { state in
|
||||
state.recoveryState == .incomplete
|
||||
})
|
||||
.previewDisplayName("Recovery incomplete")
|
||||
}
|
||||
|
||||
static func viewModel(keyBackupState: SecureBackupKeyBackupState,
|
||||
|
||||
+7
-2
@@ -253,9 +253,14 @@ struct NotificationSettingsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
static var previews: some View {
|
||||
NotificationSettingsScreen(context: viewModel.context)
|
||||
.snapshotPreferences(delay: 2.0)
|
||||
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||
state.settings != nil
|
||||
})
|
||||
|
||||
NotificationSettingsScreen(context: viewModelConfigurationMismatch.context)
|
||||
.snapshotPreferences(delay: 2.0)
|
||||
.snapshotPreferences(expect: viewModelConfigurationMismatch.context.$viewState.map { state in
|
||||
state.settings != nil
|
||||
})
|
||||
.previewDisplayName("Configuration mismatch")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +239,9 @@ struct SettingsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static var previews: some View {
|
||||
NavigationStack {
|
||||
SettingsScreen(context: viewModel.context)
|
||||
.snapshotPreferences(delay: 1.0)
|
||||
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||
state.accountSessionsListURL != nil
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,8 +321,6 @@ struct TimelineReplyView_Previews: PreviewProvider, TestablePreview {
|
||||
}
|
||||
.padding()
|
||||
.environmentObject(viewModel.context)
|
||||
// Allow member names to load. Reduce precission as the `mockThumbnail` randomly renders slightly differently
|
||||
.snapshotPreferences(delay: 0.2, precision: 0.98)
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,14 +355,12 @@ struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview
|
||||
.previewDisplayName("Replies")
|
||||
threads
|
||||
.previewDisplayName("Thread decorator")
|
||||
.snapshotPreferences(delay: 1)
|
||||
.previewLayout(.fixed(width: 390, height: 1700))
|
||||
.padding(.bottom, 20)
|
||||
encryptionAuthenticity
|
||||
.previewDisplayName("Encryption Indicators")
|
||||
pinned
|
||||
.previewDisplayName("Pinned messages")
|
||||
.snapshotPreferences(delay: 1)
|
||||
.previewLayout(.fixed(width: 390, height: 1150))
|
||||
.padding(.bottom, 20)
|
||||
}
|
||||
|
||||
@@ -205,6 +205,5 @@ struct FormattedBodyText_Previews: PreviewProvider, TestablePreview {
|
||||
.padding()
|
||||
}
|
||||
.previewLayout(.sizeThatFits)
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,14 +112,22 @@ struct UserProfileScreen_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
static var previews: some View {
|
||||
UserProfileScreen(context: verifiedUserViewModel.context)
|
||||
.snapshotPreferences(expect: verifiedUserViewModel.context.$viewState.map { state in
|
||||
state.isVerified != nil
|
||||
})
|
||||
.previewDisplayName("Verified User")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
UserProfileScreen(context: otherUserViewModel.context)
|
||||
.snapshotPreferences(expect: otherUserViewModel.context.$viewState.map { state in
|
||||
state.isVerified != nil
|
||||
})
|
||||
.previewDisplayName("Other User")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
|
||||
UserProfileScreen(context: accountOwnerViewModel.context)
|
||||
.snapshotPreferences(expect: accountOwnerViewModel.context.$viewState.map { state in
|
||||
state.isVerified != nil
|
||||
})
|
||||
.previewDisplayName("Account Owner")
|
||||
.snapshotPreferences(delay: 0.25)
|
||||
}
|
||||
|
||||
static func makeViewModel(userID: String) -> UserProfileScreenViewModel {
|
||||
|
||||
Reference in New Issue
Block a user