|
|
|
@@ -1,812 +0,0 @@
|
|
|
|
|
// Generated using Sourcery 2.0.1 — https://github.com/krzysztofzablocki/Sourcery
|
|
|
|
|
// DO NOT EDIT
|
|
|
|
|
|
|
|
|
|
// swiftlint:disable all
|
|
|
|
|
// swiftformat:disable all
|
|
|
|
|
|
|
|
|
|
import XCTest
|
|
|
|
|
import SwiftUI
|
|
|
|
|
import Prefire
|
|
|
|
|
|
|
|
|
|
@testable import SnapshotTesting
|
|
|
|
|
#if canImport(AccessibilitySnapshot)
|
|
|
|
|
import AccessibilitySnapshot
|
|
|
|
|
#endif
|
|
|
|
|
@testable import ElementX
|
|
|
|
|
|
|
|
|
|
class PreviewTests: XCTestCase {
|
|
|
|
|
private let deviceConfig: ViewImageConfig = .iPhoneX
|
|
|
|
|
private let simulatorDevice = "iPhone14"
|
|
|
|
|
private let requiredOSVersion = 16
|
|
|
|
|
|
|
|
|
|
override func setUp() {
|
|
|
|
|
super.setUp()
|
|
|
|
|
|
|
|
|
|
checkEnvironments()
|
|
|
|
|
UIView.setAnimationsEnabled(false)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_advancedSettingsScreen() {
|
|
|
|
|
for preview in AdvancedSettingsScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_analyticsPromptScreenCheckmarkItem() {
|
|
|
|
|
for preview in AnalyticsPromptScreenCheckmarkItem_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_analyticsPromptScreen() {
|
|
|
|
|
for preview in AnalyticsPromptScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_analyticsSettingsScreen() {
|
|
|
|
|
for preview in AnalyticsSettingsScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_audioRoomTimelineView() {
|
|
|
|
|
for preview in AudioRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_authenticationIconImage() {
|
|
|
|
|
for preview in AuthenticationIconImage_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_bugReport() {
|
|
|
|
|
for preview in BugReport_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_collapsibleRoomTimelineView() {
|
|
|
|
|
for preview in CollapsibleRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_composerToolbar() {
|
|
|
|
|
for preview in ComposerToolbar_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_createPollScreen() {
|
|
|
|
|
for preview in CreatePollScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_createRoom() {
|
|
|
|
|
for preview in CreateRoom_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_emojiPickerScreenHeaderView() {
|
|
|
|
|
for preview in EmojiPickerScreenHeaderView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_emojiPickerScreen() {
|
|
|
|
|
for preview in EmojiPickerScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_emoteRoomTimelineView() {
|
|
|
|
|
for preview in EmoteRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_encryptedHistoryRoomTimelineView() {
|
|
|
|
|
for preview in EncryptedHistoryRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_encryptedRoomTimelineView() {
|
|
|
|
|
for preview in EncryptedRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_fileRoomTimelineView() {
|
|
|
|
|
for preview in FileRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_formButtonStyles() {
|
|
|
|
|
for preview in FormButtonStyles_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_formRowLabelStyle() {
|
|
|
|
|
for preview in FormRowLabelStyle_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_formattedBodyText() {
|
|
|
|
|
for preview in FormattedBodyText_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_fullscreenDialog() {
|
|
|
|
|
for preview in FullscreenDialog_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_headerView() {
|
|
|
|
|
for preview in HeaderView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_homeScreenEmptyStateView() {
|
|
|
|
|
for preview in HomeScreenEmptyStateView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_homeScreenInvitesButton() {
|
|
|
|
|
for preview in HomeScreenInvitesButton_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_homeScreenRoomCell() {
|
|
|
|
|
for preview in HomeScreenRoomCell_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_homeScreen() {
|
|
|
|
|
for preview in HomeScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_imageRoomTimelineView() {
|
|
|
|
|
for preview in ImageRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_inviteUsersScreenSelectedItem() {
|
|
|
|
|
for preview in InviteUsersScreenSelectedItem_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_inviteUsersScreen() {
|
|
|
|
|
for preview in InviteUsersScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_invitesScreenCell() {
|
|
|
|
|
for preview in InvitesScreenCell_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_invitesScreen() {
|
|
|
|
|
for preview in InvitesScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_legalInformationScreen() {
|
|
|
|
|
for preview in LegalInformationScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_locationMarkerView() {
|
|
|
|
|
for preview in LocationMarkerView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_locationRoomTimelineView() {
|
|
|
|
|
for preview in LocationRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_loginScreen() {
|
|
|
|
|
for preview in LoginScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_longPressWithFeedback() {
|
|
|
|
|
for preview in LongPressWithFeedback_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_mapLibreStaticMapView() {
|
|
|
|
|
for preview in MapLibreStaticMapView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_matrixUserPermalink() {
|
|
|
|
|
for preview in MatrixUserPermalink_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_mediaUploadPreviewScreen() {
|
|
|
|
|
for preview in MediaUploadPreviewScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_messageComposer() {
|
|
|
|
|
for preview in MessageComposer_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_messageForwardingScreen() {
|
|
|
|
|
for preview in MessageForwardingScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_messageText() {
|
|
|
|
|
for preview in MessageText_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_migrationScreen() {
|
|
|
|
|
for preview in MigrationScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_noticeRoomTimelineView() {
|
|
|
|
|
for preview in NoticeRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_notificationSettingsEditScreenRoomCell() {
|
|
|
|
|
for preview in NotificationSettingsEditScreenRoomCell_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_notificationSettingsEditScreen() {
|
|
|
|
|
for preview in NotificationSettingsEditScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_notificationSettingsScreen() {
|
|
|
|
|
for preview in NotificationSettingsScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_onboardingScreen() {
|
|
|
|
|
for preview in OnboardingScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_paginationIndicatorRoomTimelineView() {
|
|
|
|
|
for preview in PaginationIndicatorRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_pillView() {
|
|
|
|
|
for preview in PillView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_placeholderAvatarImage() {
|
|
|
|
|
for preview in PlaceholderAvatarImage_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_placeholderScreen() {
|
|
|
|
|
for preview in PlaceholderScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_pollOptionView() {
|
|
|
|
|
for preview in PollOptionView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_pollRoomTimelineView() {
|
|
|
|
|
for preview in PollRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_reactionsSummaryView() {
|
|
|
|
|
for preview in ReactionsSummaryView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_readMarkerRoomTimelineView() {
|
|
|
|
|
for preview in ReadMarkerRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_redactedRoomTimelineView() {
|
|
|
|
|
for preview in RedactedRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_reportContentScreen() {
|
|
|
|
|
for preview in ReportContentScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomAttachmentPicker() {
|
|
|
|
|
for preview in RoomAttachmentPicker_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomDetailsEditScreen() {
|
|
|
|
|
for preview in RoomDetailsEditScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomDetailsScreen() {
|
|
|
|
|
for preview in RoomDetailsScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomHeaderView() {
|
|
|
|
|
for preview in RoomHeaderView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomMemberDetailsScreen() {
|
|
|
|
|
for preview in RoomMemberDetailsScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomMembersListMemberCell() {
|
|
|
|
|
for preview in RoomMembersListMemberCell_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomMembersListScreen() {
|
|
|
|
|
for preview in RoomMembersListScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomNotificationSettingsCustomSectionView() {
|
|
|
|
|
for preview in RoomNotificationSettingsCustomSectionView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomNotificationSettingsScreen() {
|
|
|
|
|
for preview in RoomNotificationSettingsScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomNotificationSettingsUserDefinedScreen() {
|
|
|
|
|
for preview in RoomNotificationSettingsUserDefinedScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_roomScreen() {
|
|
|
|
|
for preview in RoomScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_separatorRoomTimelineView() {
|
|
|
|
|
for preview in SeparatorRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_serverConfirmationScreen() {
|
|
|
|
|
for preview in ServerConfirmationScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_serverSelection() {
|
|
|
|
|
for preview in ServerSelection_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_sessionVerification() {
|
|
|
|
|
for preview in SessionVerification_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_settingsScreen() {
|
|
|
|
|
for preview in SettingsScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_shimmerOverlay() {
|
|
|
|
|
for preview in ShimmerOverlay_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_softLogoutScreen() {
|
|
|
|
|
for preview in SoftLogoutScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_splashScreen() {
|
|
|
|
|
for preview in SplashScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_startChatScreen() {
|
|
|
|
|
for preview in StartChatScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_stateRoomTimelineView() {
|
|
|
|
|
for preview in StateRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_staticLocationScreenViewer() {
|
|
|
|
|
for preview in StaticLocationScreenViewer_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_stickerRoomTimelineView() {
|
|
|
|
|
for preview in StickerRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_swipeRightAction() {
|
|
|
|
|
for preview in SwipeRightAction_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_swipeToReplyView() {
|
|
|
|
|
for preview in SwipeToReplyView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_templateScreen() {
|
|
|
|
|
for preview in TemplateScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_textRoomTimelineView() {
|
|
|
|
|
for preview in TextRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_threadDecorator() {
|
|
|
|
|
for preview in ThreadDecorator_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineDeliveryStatusView() {
|
|
|
|
|
for preview in TimelineDeliveryStatusView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineItemBubbledStylerView() {
|
|
|
|
|
for preview in TimelineItemBubbledStylerView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineItemDebugView() {
|
|
|
|
|
for preview in TimelineItemDebugView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineItemMenu() {
|
|
|
|
|
for preview in TimelineItemMenu_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineItemPlainStylerView() {
|
|
|
|
|
for preview in TimelineItemPlainStylerView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineItemStyler() {
|
|
|
|
|
for preview in TimelineItemStyler_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineReactionView() {
|
|
|
|
|
for preview in TimelineReactionView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineReadReceiptsView() {
|
|
|
|
|
for preview in TimelineReadReceiptsView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineReplyView() {
|
|
|
|
|
for preview in TimelineReplyView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineStartRoomTimelineView() {
|
|
|
|
|
for preview in TimelineStartRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_timelineView() {
|
|
|
|
|
for preview in TimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_uITimelineView() {
|
|
|
|
|
for preview in UITimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_unsupportedRoomTimelineView() {
|
|
|
|
|
for preview in UnsupportedRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_userDetailsEditScreen() {
|
|
|
|
|
for preview in UserDetailsEditScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_userIndicatorModalView() {
|
|
|
|
|
for preview in UserIndicatorModalView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_userIndicatorToastView() {
|
|
|
|
|
for preview in UserIndicatorToastView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_userProfileCell() {
|
|
|
|
|
for preview in UserProfileCell_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_videoRoomTimelineView() {
|
|
|
|
|
for preview in VideoRoomTimelineView_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_waitingDialog() {
|
|
|
|
|
for preview in WaitingDialog_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_waitlistScreen() {
|
|
|
|
|
for preview in WaitlistScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func test_welcomeScreen() {
|
|
|
|
|
for preview in WelcomeScreen_Previews._allPreviews {
|
|
|
|
|
assertSnapshots(matching: preview)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: Private
|
|
|
|
|
|
|
|
|
|
private func assertSnapshots(matching preview: _Preview, testName: String = #function) {
|
|
|
|
|
let isScreen = preview.layout == .device
|
|
|
|
|
let device = preview.device?.snapshotDevice() ?? deviceConfig
|
|
|
|
|
var delay: TimeInterval = 1.0
|
|
|
|
|
var precision: Float = 0.99
|
|
|
|
|
|
|
|
|
|
let view = preview.content
|
|
|
|
|
.onPreferenceChange(DelayPreferenceKey.self) { delay = $0 }
|
|
|
|
|
.onPreferenceChange(PrecisionPreferenceKey.self) { precision = $0 }
|
|
|
|
|
|
|
|
|
|
let matchingView = isScreen ? AnyView(view) : AnyView(view
|
|
|
|
|
.frame(width: device.size?.width)
|
|
|
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
assertSnapshot(
|
|
|
|
|
matching: matchingView,
|
|
|
|
|
as: .prefireImage(precision: { precision }, duration: { delay }, layout: isScreen ? .device(config: device) : .sizeThatFits),
|
|
|
|
|
named: preview.displayName,
|
|
|
|
|
testName: testName
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
#if canImport(AccessibilitySnapshot)
|
|
|
|
|
let vc = UIHostingController(rootView: matchingView)
|
|
|
|
|
vc.view.frame = UIScreen.main.bounds
|
|
|
|
|
assertSnapshot(
|
|
|
|
|
matching: vc,
|
|
|
|
|
as: .wait(for: delay, on: .accessibilityImage(showActivationPoints: .always)),
|
|
|
|
|
named: preview.displayName.map { $0 + ".accessibility" },
|
|
|
|
|
testName: testName
|
|
|
|
|
)
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Check environments to avoid problems with snapshots on different devices or OS.
|
|
|
|
|
private func checkEnvironments() {
|
|
|
|
|
let deviceModel = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"]
|
|
|
|
|
let osVersion = ProcessInfo().operatingSystemVersion
|
|
|
|
|
guard deviceModel?.contains(simulatorDevice) ?? false else {
|
|
|
|
|
fatalError("Switch to using \(simulatorDevice) for these tests.")
|
|
|
|
|
}
|
|
|
|
|
guard osVersion.majorVersion == requiredOSVersion else {
|
|
|
|
|
fatalError("Switch to iOS \(requiredOSVersion) for these tests.")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: - SnapshotTesting + Extensions
|
|
|
|
|
|
|
|
|
|
private extension PreviewDevice {
|
|
|
|
|
func snapshotDevice() -> ViewImageConfig? {
|
|
|
|
|
switch rawValue {
|
|
|
|
|
case "iPhone 14", "iPhone 13", "iPhone 12", "iPhone 11", "iPhone 10":
|
|
|
|
|
return .iPhoneX
|
|
|
|
|
case "iPhone 6", "iPhone 6s", "iPhone 7", "iPhone 8":
|
|
|
|
|
return .iPhone8
|
|
|
|
|
case "iPhone 6 Plus", "iPhone 6s Plus", "iPhone 8 Plus":
|
|
|
|
|
return .iPhone8Plus
|
|
|
|
|
case "iPhone SE (1st generation)", "iPhone SE (2nd generation)":
|
|
|
|
|
return .iPhoneSe
|
|
|
|
|
default: return nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private extension Snapshotting where Value: SwiftUI.View, Format == UIImage {
|
|
|
|
|
static func prefireImage(
|
|
|
|
|
drawHierarchyInKeyWindow: Bool = false,
|
|
|
|
|
precision: @escaping () -> Float,
|
|
|
|
|
duration: @escaping () -> TimeInterval,
|
|
|
|
|
layout: SwiftUISnapshotLayout = .sizeThatFits,
|
|
|
|
|
traits: UITraitCollection = .init()
|
|
|
|
|
) -> Snapshotting {
|
|
|
|
|
let config: ViewImageConfig
|
|
|
|
|
|
|
|
|
|
switch layout {
|
|
|
|
|
#if os(iOS) || os(tvOS)
|
|
|
|
|
case let .device(config: deviceConfig):
|
|
|
|
|
config = deviceConfig
|
|
|
|
|
#endif
|
|
|
|
|
case .sizeThatFits:
|
|
|
|
|
config = .init(safeArea: .zero, size: nil, traits: traits)
|
|
|
|
|
case let .fixed(width: width, height: height):
|
|
|
|
|
let size = CGSize(width: width, height: height)
|
|
|
|
|
config = .init(safeArea: .zero, size: size, traits: traits)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SimplySnapshotting<UIImage>(pathExtension: "png", diffing: .prefireImage(precision: precision, scale: traits.displayScale))
|
|
|
|
|
.asyncPullback { view in
|
|
|
|
|
var config = config
|
|
|
|
|
|
|
|
|
|
let controller: UIViewController
|
|
|
|
|
|
|
|
|
|
if config.size != nil {
|
|
|
|
|
controller = UIHostingController(rootView: view)
|
|
|
|
|
} else {
|
|
|
|
|
let hostingController = UIHostingController(rootView: view)
|
|
|
|
|
|
|
|
|
|
let maxSize = CGSize.zero
|
|
|
|
|
config.size = hostingController.sizeThatFits(in: maxSize)
|
|
|
|
|
|
|
|
|
|
controller = hostingController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Async<UIImage> { callback in
|
|
|
|
|
let strategy = snapshotView(
|
|
|
|
|
config: config,
|
|
|
|
|
drawHierarchyInKeyWindow: drawHierarchyInKeyWindow,
|
|
|
|
|
traits: traits,
|
|
|
|
|
view: controller.view,
|
|
|
|
|
viewController: controller
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
let duration = duration()
|
|
|
|
|
if duration != .zero {
|
|
|
|
|
let expectation = XCTestExpectation(description: "Wait")
|
|
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + duration) {
|
|
|
|
|
expectation.fulfill()
|
|
|
|
|
}
|
|
|
|
|
_ = XCTWaiter.wait(for: [expectation], timeout: duration + 1)
|
|
|
|
|
}
|
|
|
|
|
strategy.run(callback)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private extension Diffing where Value == UIImage {
|
|
|
|
|
static func prefireImage(precision: @escaping () -> Float, scale: CGFloat?) -> Diffing {
|
|
|
|
|
lazy var originalDiffing = Diffing.image(precision: precision(), perceptualPrecision: 0.98, scale: scale)
|
|
|
|
|
return Diffing(
|
|
|
|
|
toData: { originalDiffing.toData($0) },
|
|
|
|
|
fromData: { originalDiffing.fromData($0) },
|
|
|
|
|
diff: { originalDiffing.diff($0, $1) }
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// swiftlint:enable all
|
|
|
|
|
// swiftformat:enable all
|