Replace Prefire with a very similar but simpler and more direct approach (#3232)

* Replace Prefire with a very similar but simpler and more direct approach

* Move PreviewTest snapshots to their new location (snapshotting default, mirrors UITests)

* Update acknowledgements

* Switch snapshot configuration extensions to a custom version

* Exclude snapshots from the PreviewTests target

* Fix acknowledgements

* Rename snapshotting preference keys

* Remove `skipPackagePluginValidation`
This commit is contained in:
Stefan Ceriu 2024-09-09 15:07:41 +03:00 committed by GitHub
parent a4166de502
commit 2f6fea29f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1196 changed files with 1416 additions and 116 deletions

2
.gitattributes vendored
View File

@ -1,4 +1,4 @@
UITests/Sources/__Snapshots__/** filter=lfs diff=lfs merge=lfs -text
UnitTests/Resources/** filter=lfs diff=lfs merge=lfs -text
UnitTests/__Snapshots__/** filter=lfs diff=lfs merge=lfs -text
PreviewTests/__Snapshots__/** filter=lfs diff=lfs merge=lfs -text
PreviewTests/Sources/__Snapshots__/** filter=lfs diff=lfs merge=lfs -text

View File

@ -73,7 +73,7 @@
0CF81807BE5FBFC9E2BBCECF /* PollFormScreenUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3368395F06AA180138E185B6 /* PollFormScreenUITests.swift */; };
0D4EB2ABAA5FE8CB10FDBCB8 /* TimelineItemFactoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AA3AF94A06D319BB37E52DA /* TimelineItemFactoryTests.swift */; };
0DC815CA24E1BD7F408F37D3 /* CollapsibleTimelineItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C4EA55DA62F9D0F984A2AE /* CollapsibleTimelineItem.swift */; };
0E08BB72B2258652CF501A8B /* Prefire in Frameworks */ = {isa = PBXBuildFile; productRef = 9B68DE8678BF67D4612BCC16 /* Prefire */; };
0E08BB72B2258652CF501A8B /* Version in Frameworks */ = {isa = PBXBuildFile; productRef = 2B9ACE4FCACB5A8812154424 /* Version */; };
0E3A2787C6AEC761A81A938A /* AuthenticationStartScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8609BE4CA71C30D1FCE3AF9B /* AuthenticationStartScreenModels.swift */; };
0E8C480700870BB34A2A360F /* DeviceKit in Frameworks */ = {isa = PBXBuildFile; productRef = 4003BC24B24C9E63D3304177 /* DeviceKit */; };
0EA6537A07E2DC882AEA5962 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 187853A7E643995EE49FAD43 /* Localizable.stringsdict */; };
@ -242,10 +242,9 @@
36CD6E11B37396E14F032CB6 /* Version in Frameworks */ = {isa = PBXBuildFile; productRef = A05AF81DDD14AD58CB0E1B9B /* Version */; };
36DE961B784087D5E18EF9BA /* LogViewerScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A07692536D66E3DA32C4964 /* LogViewerScreen.swift */; };
370AF5BFCD4384DD455479B6 /* ElementCallWidgetDriverProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6C11AD9813045E44F950410 /* ElementCallWidgetDriverProtocol.swift */; };
377980ABF16525114E72DDE2 /* Version in Frameworks */ = {isa = PBXBuildFile; productRef = 2B9ACE4FCACB5A8812154424 /* Version */; };
37906355E207DB5703754675 /* AppLockSetupBiometricsScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F893F4A111CB7BA5C96949 /* AppLockSetupBiometricsScreenViewModel.swift */; };
37D789F24199B32E3FD1AA7B /* FileRoomTimelineItemContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 216F0DDC98F2A2C162D09C28 /* FileRoomTimelineItemContent.swift */; };
37E47F5101C0C036289D3807 /* SwiftOGG in Frameworks */ = {isa = PBXBuildFile; productRef = 391D11F92DFC91666AA1503F /* SwiftOGG */; };
37E47F5101C0C036289D3807 /* DSWaveformImageViews in Frameworks */ = {isa = PBXBuildFile; productRef = 2A4106A0A96DC4C273128AA5 /* DSWaveformImageViews */; };
384D6B9A7DFD7260139D6852 /* UITestsNotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBEB8D9F4940E161B18FE4BC /* UITestsNotificationCenter.swift */; };
38546A6010A2CF240EC9AF73 /* BindableState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EA1D2CBAEA5D0BD00B90D1B /* BindableState.swift */; };
386720B603F87D156DB01FB2 /* VoiceMessageMediaManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40076C770A5FB83325252973 /* VoiceMessageMediaManager.swift */; };
@ -303,7 +302,6 @@
454311EAC17D778E19F46592 /* NotificationPermissionsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91868EB98818044E6FEBE532 /* NotificationPermissionsScreenCoordinator.swift */; };
454F8DDC4442C0DE54094902 /* LABiometryType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3F219838588C62198E726E3 /* LABiometryType.swift */; };
4557192F5B15A8D9BB920232 /* AdvancedSettingsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E492690C8B27A892C194CC4 /* AdvancedSettingsScreenCoordinator.swift */; };
4610C57A4785FFF5E67F0C6D /* DSWaveformImageViews in Frameworks */ = {isa = PBXBuildFile; productRef = 2A4106A0A96DC4C273128AA5 /* DSWaveformImageViews */; };
46562110EE202E580A5FFD9C /* RoomScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93CF7B19FFCF8EFBE0A8696A /* RoomScreenViewModelTests.swift */; };
4681820102DAC8BA586357D4 /* VoiceMessageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAB8D7926A5684E18196B538 /* VoiceMessageCache.swift */; };
46A183C6125A669AEB005699 /* UserProfileScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = F134D2D91DFF732FB75B2CB7 /* UserProfileScreenViewModelProtocol.swift */; };
@ -750,7 +748,7 @@
A816F7087C495D85048AC50E /* RoomMemberDetailsScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B6E30BB748F3F480F077969 /* RoomMemberDetailsScreenModels.swift */; };
A851635B3255C6DC07034A12 /* RoomScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8108C8F0ACF6A7EB72D0117 /* RoomScreenCoordinator.swift */; };
A8FA7671948E3DF27F320026 /* BugReportFlowCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7367B3B9A8CAF902220F31D1 /* BugReportFlowCoordinator.swift */; };
A93661C962B12942C08864B6 /* Prefire in Frameworks */ = {isa = PBXBuildFile; productRef = 2629CF48B33643CD5F69C612 /* Prefire */; };
A93661C962B12942C08864B6 /* SwiftOGG in Frameworks */ = {isa = PBXBuildFile; productRef = 391D11F92DFC91666AA1503F /* SwiftOGG */; };
A9482B967FC85DA611514D35 /* VoiceMessageRoomPlaybackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CCD41CD67DB5DA0D436BFE9 /* VoiceMessageRoomPlaybackView.swift */; };
A969147E0EEE0E27EE226570 /* MediaUploadPreviewScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47F29139BC2A804CE5E0757E /* MediaUploadPreviewScreenViewModel.swift */; };
A975D60EA49F6AF73308809F /* RoomMembersListScreenMemberCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC03209FDE8CE0810617BFFF /* RoomMembersListScreenMemberCell.swift */; };
@ -895,7 +893,6 @@
CBA9EDF305036039166E76FF /* StartChatScreenUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA2AEC1AB349A341FE13DEC1 /* StartChatScreenUITests.swift */; };
CBB4F39A1309F7281AE7AA8E /* test_voice_message.m4a in Resources */ = {isa = PBXBuildFile; fileRef = 0392E3FDE372C9B56FEEED8B /* test_voice_message.m4a */; };
CBD2ABE4C1A47ECD99E1488E /* NotificationSettingsScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 421FA93BCC2840E66E4F306F /* NotificationSettingsScreenViewModelProtocol.swift */; };
CBFF4F1BFA90B46241B8106C /* Strings+SAS.swift in Sources */ = {isa = PBXBuildFile; fileRef = B172057567E049007A5C4D92 /* Strings+SAS.swift */; };
CC0D088F505F33A20DC5590F /* RoomStateEventStringBuilderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEEAFB646E583655652C3D04 /* RoomStateEventStringBuilderTests.swift */; };
CC1C948F67A5510A340FD7F0 /* SessionDirectoriesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0825EAFD47332DD459DE893F /* SessionDirectoriesTests.swift */; };
CC961529F9F1854BEC3272C9 /* LayoutMocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC8AA23D4F37CC26564F63C5 /* LayoutMocks.swift */; };
@ -1033,8 +1030,8 @@
EBE13FAB4E29738AC41BD3E5 /* InfoPlistReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A580295A56B55A856CC4084 /* InfoPlistReader.swift */; };
EC280623A42904341363EAAF /* Collections in Frameworks */ = {isa = PBXBuildFile; productRef = A20EA00CCB9DBE0FFB17DD09 /* Collections */; };
EC3320639828BED8B3E5F2C6 /* EncryptionResetScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5875F7C0A2398E9F134B1284 /* EncryptionResetScreenViewModel.swift */; };
ECA636DAF071C611FDC2BB57 /* Strings+Untranslated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A18F6CE4D694D21E4EA9B25 /* Strings+Untranslated.swift */; };
ED564C8C7C43CF5F67000368 /* PlatformViewVersionPredicate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D26813CCE39221FE30BF22CD /* PlatformViewVersionPredicate.swift */; };
ED635D7F00FA07E94D3CE1E8 /* PreviewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9B796D347E53631576F631C /* PreviewTests.swift */; };
ED90A59F068FD0CA27E602ED /* UserProfileListRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = E10DA51DBC8C7E1460DBCCBD /* UserProfileListRow.swift */; };
EDF8919F15DE0FF00EF99E70 /* DocumentPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F5567A7EF6F2AB9473236F6 /* DocumentPicker.swift */; };
EE4E2C1922BBF5169E213555 /* PillAttachmentViewProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B53D6C5C0D14B04D3AB3F6E /* PillAttachmentViewProvider.swift */; };
@ -1052,6 +1049,7 @@
F0570F1ECD70C4C851FB2052 /* SecureBackupRecoveryKeyScreenViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93E7304F5ECB4CB11CB10E60 /* SecureBackupRecoveryKeyScreenViewModelProtocol.swift */; };
F06CE9132855E81EBB6DDC32 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 940C605265DD82DA0C655E23 /* Kingfisher */; };
F07D88421A9BC4D03D4A5055 /* VideoRoomTimelineItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F348B5F2C12F9D4F4B4D3884 /* VideoRoomTimelineItem.swift */; };
F08F7BC07CA9AEF5CD157918 /* Snapshotting.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF17EA323AD0205A6AB621AA /* Snapshotting.swift */; };
F0A26CD502C3A5868353B0FA /* ServerConfirmationScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24DEE0682C95F897B6C7CB0D /* ServerConfirmationScreenViewModel.swift */; };
F0DACC95F24128A54CD537E4 /* GlobalSearchScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24B8177BD2AF45A286F5DA31 /* GlobalSearchScreen.swift */; };
F0F82C3C848C865C3098AA52 /* SnapshotTesting in Frameworks */ = {isa = PBXBuildFile; productRef = 21C83087604B154AA30E9A8F /* SnapshotTesting */; };
@ -2116,6 +2114,7 @@
DE7C80EF77AD102053D3646E /* RoundedLabelItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundedLabelItem.swift; sourceTree = "<group>"; };
DEC1D382565A4E9CAC2F14EA /* MediaFileHandleProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaFileHandleProxy.swift; sourceTree = "<group>"; };
DF05DA24F71B455E8EFEBC3B /* SessionVerificationViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionVerificationViewModelTests.swift; sourceTree = "<group>"; };
DF17EA323AD0205A6AB621AA /* Snapshotting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Snapshotting.swift; sourceTree = "<group>"; };
DF3D25B3EDB283B5807EADCF /* ReadMarkerRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadMarkerRoomTimelineItem.swift; sourceTree = "<group>"; };
DFFB0E7C6D8E190AFA0176DC /* uz */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = uz; path = uz.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
E062C1750EFC8627DE4CAB8E /* MapTilerAuthorization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapTilerAuthorization.swift; sourceTree = "<group>"; };
@ -2165,6 +2164,7 @@
E96ED747FF90332EA1333C22 /* RoomTimelineItemFixtures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomTimelineItemFixtures.swift; sourceTree = "<group>"; };
E992D7B8BE54B2AB454613AF /* XCUIElement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCUIElement.swift; sourceTree = "<group>"; };
E9A3D3CFA199FA7897364547 /* CallInviteRoomTimelineItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallInviteRoomTimelineItem.swift; sourceTree = "<group>"; };
E9B796D347E53631576F631C /* PreviewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewTests.swift; sourceTree = "<group>"; };
E9D059BFE329BE09B6D96A9F /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ro; path = ro.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
EA4D639E27D5882A6A71AECF /* GlobalSearchScreenViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalSearchScreenViewModelTests.swift; sourceTree = "<group>"; };
EA551A98778CEE7366838CE2 /* QRCodeLoginScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeLoginScreenCoordinator.swift; sourceTree = "<group>"; };
@ -2283,8 +2283,7 @@
DF05F9C9D3D977EB77E13692 /* DeviceKit in Frameworks */,
93A549135E6C027A0D823BFE /* DTCoreText in Frameworks */,
6F26CBC84AE87EB4068D398B /* LRUCache in Frameworks */,
0E08BB72B2258652CF501A8B /* Prefire in Frameworks */,
377980ABF16525114E72DDE2 /* Version in Frameworks */,
0E08BB72B2258652CF501A8B /* Version in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2342,9 +2341,8 @@
36CD6E11B37396E14F032CB6 /* Version in Frameworks */,
A0D7E5BD0298A97DCBDCE40B /* Emojibase in Frameworks */,
44F0E1B576C7599DF8022071 /* WysiwygComposer in Frameworks */,
A93661C962B12942C08864B6 /* Prefire in Frameworks */,
37E47F5101C0C036289D3807 /* SwiftOGG in Frameworks */,
4610C57A4785FFF5E67F0C6D /* DSWaveformImageViews in Frameworks */,
A93661C962B12942C08864B6 /* SwiftOGG in Frameworks */,
37E47F5101C0C036289D3807 /* DSWaveformImageViews in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2594,6 +2592,7 @@
1803CD2B96BF06009334BB61 /* PreviewTests */ = {
isa = PBXGroup;
children = (
21E5BB69FC9058BED96B9EFD /* Sources */,
A0D745ADE5568E50270F70EF /* SupportingFiles */,
);
path = PreviewTests;
@ -2627,6 +2626,14 @@
path = View;
sourceTree = "<group>";
};
21E5BB69FC9058BED96B9EFD /* Sources */ = {
isa = PBXGroup;
children = (
E9B796D347E53631576F631C /* PreviewTests.swift */,
);
path = Sources;
sourceTree = "<group>";
};
22F9F1514B91803BB4B88894 /* AppHooks */ = {
isa = PBXGroup;
children = (
@ -3188,6 +3195,7 @@
1DFE0E493FB55E5A62E7852A /* ProposedViewSize.swift */,
7310D8DFE01AF45F0689C3AA /* Publisher.swift */,
584A61D9C459FAFEF038A7C0 /* Section.swift */,
DF17EA323AD0205A6AB621AA /* Snapshotting.swift */,
40B21E611DADDEF00307E7AC /* String.swift */,
A40C19719687984FD9478FBE /* Task.swift */,
287FC98AF2664EAD79C0D902 /* UIDevice.swift */,
@ -5457,7 +5465,6 @@
);
dependencies = (
8E24DC048A099AAFEE13B4F5 /* PBXTargetDependency */,
E4E4D88701DC0E48B9F02526 /* PBXTargetDependency */,
);
name = PreviewTests;
packageProductDependencies = (
@ -5472,7 +5479,8 @@
buildConfigurationList = B15427F8699AD5A5FC75C17E /* Build configuration list for PBXNativeTarget "ElementX" */;
buildPhases = (
A7130911BCB2DF3D249A1836 /* 🛠 SwiftGen */,
0A22FE50601CA6623A443513 /* 🧙 Sourcery */,
7F26850DA7BC749F6FC41586 /* 🧙 Sourcery - Generate mocks */,
024F73AD10ACB163505ABE1E /* 🧙 Sourcery - Generate preview tests */,
9797D588420FCBBC228A63C9 /* Sources */,
215E1D91B98672C856F559D0 /* Resources */,
EE878EAA342710DB973E0A87 /* Frameworks */,
@ -5508,7 +5516,6 @@
A05AF81DDD14AD58CB0E1B9B /* Version */,
C05729B1684C331F5FFE9232 /* Emojibase */,
CA07D57389DACE18AEB6A5E2 /* WysiwygComposer */,
2629CF48B33643CD5F69C612 /* Prefire */,
391D11F92DFC91666AA1503F /* SwiftOGG */,
2A4106A0A96DC4C273128AA5 /* DSWaveformImageViews */,
);
@ -5567,7 +5574,6 @@
385D4C28F9DC5CF53BD9ECDB /* DeviceKit */,
593FBBF394712F2963E98A0B /* DTCoreText */,
78B28D75FF7AF8E6146DEE2A /* LRUCache */,
9B68DE8678BF67D4612BCC16 /* Prefire */,
2B9ACE4FCACB5A8812154424 /* Version */,
);
productName = NSE;
@ -5660,7 +5666,6 @@
0CBF57301AA172C21F76CE86 /* XCRemoteSwiftPackageReference "maplibre-gl-native-distribution" */,
6FC4820D8D4559CEECA064D7 /* XCRemoteSwiftPackageReference "matrix-rust-components-swift" */,
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */,
22E7BA2ED466B74739AB8567 /* XCRemoteSwiftPackageReference "Prefire" */,
A08925A9D5E3770DEB9D8509 /* XCRemoteSwiftPackageReference "sentry-cocoa" */,
E9C4F3A12AA1F65C13A8C8EB /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */,
E2F3DA35D462724CCC61DE2C /* XCRemoteSwiftPackageReference "swift-ogg" */,
@ -5755,7 +5760,7 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
0A22FE50601CA6623A443513 /* 🧙 Sourcery */ = {
024F73AD10ACB163505ABE1E /* 🧙 Sourcery - Generate preview tests */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
@ -5765,14 +5770,14 @@
);
inputPaths = (
);
name = "🧙 Sourcery";
name = "🧙 Sourcery - Generate preview tests";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which sourcery >/dev/null; then\n sourcery --config Tools/Sourcery/sourcery_automockable_config.yml\nelse\n echo \"warning: Sourcery not installed, run swift run tools setup-project\"\nfi\n";
shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which sourcery >/dev/null; then\n sourcery --config Tools/Sourcery/PreviewTestsConfig.yml\nelse\n echo \"warning: Sourcery not installed, run swift run tools setup-project\"\nfi\n";
};
23C8392ACDCF25131DAF6F9B /* Scan */ = {
isa = PBXShellScriptBuildPhase;
@ -5793,6 +5798,25 @@
shellPath = /bin/sh;
shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nperiphery scan --format xcode\n";
};
7F26850DA7BC749F6FC41586 /* 🧙 Sourcery - Generate mocks */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "🧙 Sourcery - Generate mocks";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export PATH=\"$PATH:/opt/homebrew/bin\"\nif which sourcery >/dev/null; then\n sourcery --config Tools/Sourcery/AutoMockableConfig.yml\nelse\n echo \"warning: Sourcery not installed, run swift run tools setup-project\"\nfi\n";
};
98CA896D84BFD53B2554E891 /* ⚠️ SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
@ -5907,8 +5931,6 @@
7354D094A4C59B555F407FA1 /* RustTracing.swift in Sources */,
7573D682F089205F7F1D96CF /* SessionDirectories.swift in Sources */,
422E8D182CA688D4565CD1E1 /* String.swift in Sources */,
CBFF4F1BFA90B46241B8106C /* Strings+SAS.swift in Sources */,
ECA636DAF071C611FDC2BB57 /* Strings+Untranslated.swift in Sources */,
6EC7A40A537CFB3D526A111C /* Strings.swift in Sources */,
719E7AAD1F8E68F68F30FECD /* Task.swift in Sources */,
E0FB26262689F04D66A949D7 /* TestablePreview.swift in Sources */,
@ -6052,6 +6074,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ED635D7F00FA07E94D3CE1E8 /* PreviewTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -6713,6 +6736,7 @@
1C8BC70A18060677E295A846 /* ShareToMapsAppActivity.swift in Sources */,
274CE3C986841D15FD530BF5 /* ShimmerModifier.swift in Sources */,
77920AFA8091AC6B9F190C90 /* Signposter.swift in Sources */,
F08F7BC07CA9AEF5CD157918 /* Snapshotting.swift in Sources */,
8BC8EF6705A78946C1F22891 /* SoftLogoutScreen.swift in Sources */,
A3A7A05E8F9B7EB0E1A09A2A /* SoftLogoutScreenCoordinator.swift in Sources */,
F86102DC2C68BBBB0521BAAE /* SoftLogoutScreenModels.swift in Sources */,
@ -6933,10 +6957,6 @@
target = C0FAEB81CFD9776CD78CE489 /* ElementX */;
targetProxy = 889C131F86E6415074D382B9 /* PBXContainerItemProxy */;
};
E4E4D88701DC0E48B9F02526 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = 7D8AF269E16478B19C7F7613 /* PrefireTestsPlugin */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
@ -7574,14 +7594,6 @@
minimumVersion = 5.13.0;
};
};
22E7BA2ED466B74739AB8567 /* XCRemoteSwiftPackageReference "Prefire" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/BarredEwe/Prefire";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 2.8.0;
};
};
395DE6AE429B7ACC7C7FE31D /* XCRemoteSwiftPackageReference "KZFileWatchers" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/krzysztofzablocki/KZFileWatchers";
@ -7801,11 +7813,6 @@
package = E9C4F3A12AA1F65C13A8C8EB /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */;
productName = SnapshotTesting;
};
2629CF48B33643CD5F69C612 /* Prefire */ = {
isa = XCSwiftPackageProductDependency;
package = 22E7BA2ED466B74739AB8567 /* XCRemoteSwiftPackageReference "Prefire" */;
productName = Prefire;
};
290FDEDA4D764B9F7EBE55A9 /* Algorithms */ = {
isa = XCSwiftPackageProductDependency;
package = E025F19D013D9BA6C58B37F4 /* XCRemoteSwiftPackageReference "swift-algorithms" */;
@ -7926,11 +7933,6 @@
package = E9C4F3A12AA1F65C13A8C8EB /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */;
productName = SnapshotTesting;
};
7D8AF269E16478B19C7F7613 /* PrefireTestsPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 22E7BA2ED466B74739AB8567 /* XCRemoteSwiftPackageReference "Prefire" */;
productName = "plugin:PrefireTestsPlugin";
};
800631D7250B7F93195035F1 /* KeychainAccess */ = {
isa = XCSwiftPackageProductDependency;
package = 61916C63E3F5BD900F08DA0C /* XCRemoteSwiftPackageReference "KeychainAccess" */;
@ -7961,11 +7963,6 @@
package = 701C7BEF8F70F7A83E852DCC /* XCRemoteSwiftPackageReference "GZIP" */;
productName = GZIP;
};
9B68DE8678BF67D4612BCC16 /* Prefire */ = {
isa = XCSwiftPackageProductDependency;
package = 22E7BA2ED466B74739AB8567 /* XCRemoteSwiftPackageReference "Prefire" */;
productName = Prefire;
};
9C73F37731C9FDED1BB24C1C /* Collections */ = {
isa = XCSwiftPackageProductDependency;
package = F76A08D0EA29A07A54F4EB4D /* XCRemoteSwiftPackageReference "swift-collections" */;

View File

@ -1,5 +1,5 @@
{
"originHash" : "1b1fb14b1ac1438c44ffd2f0151af65c83018d71b8674cd7f13ec21abeb31bcd",
"originHash" : "52385e2a478cc9455693d0b93dc33b988ac1d4742acceeaee288944dff8b78e0",
"pins" : [
{
"identity" : "compound-design-tokens",

View File

@ -0,0 +1,58 @@
//
// Copyright 2024 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import SwiftUI
public struct SnapshotDelayPreferenceKey: PreferenceKey {
public static var defaultValue: TimeInterval = 0.0
public static func reduce(value: inout TimeInterval, nextValue: () -> TimeInterval) {
value = nextValue()
}
}
public struct SnapshotPrecisionPreferenceKey: PreferenceKey {
public static var defaultValue: Float = 1.0
public static func reduce(value: inout Float, nextValue: () -> Float) {
value = nextValue()
}
}
public struct SnapshotPerceptualPrecisionPreferenceKey: PreferenceKey {
public static var defaultValue: Float = 1.0
public static func reduce(value: inout Float, nextValue: () -> Float) {
value = nextValue()
}
}
public extension SwiftUI.View {
/// Use this modifier when you want to apply snapshot-specific preferences,
/// like delay and precision, to the view.
/// These preferences can then be retrieved and used elsewhere in your view hierarchy.
///
/// - Parameters:
/// - delay: The delay time in seconds that you want to set as a preference to the View.
/// - precision: The percentage of pixels that must match.
/// - perceptualPrecision: The percentage a pixel must match the source pixel to be considered a match. 98-99% mimics the precision of the human eye.
@inlinable
func snapshotPreferences(delay: TimeInterval = .zero, precision: Float = 1.0, perceptualPrecision: Float = 1.0) -> some SwiftUI.View {
preference(key: SnapshotDelayPreferenceKey.self, value: delay)
.preference(key: SnapshotPrecisionPreferenceKey.self, value: precision)
.preference(key: SnapshotPerceptualPrecisionPreferenceKey.self, value: perceptualPrecision)
}
}

View File

@ -7,6 +7,4 @@
import SwiftUI
import Prefire
protocol TestablePreview: PrefireProvider { }
protocol TestablePreview { }

View File

@ -86,7 +86,7 @@ struct EmojiPickerScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
EmojiPickerScreen(context: viewModel.context, selectedEmojis: ["😀", "😄"])
.previewDisplayName("Screen")
.snapshot(delay: 0.5)
.snapshotPreferences(delay: 0.5)
}
}

View File

@ -202,13 +202,13 @@ struct HomeScreen_Previews: PreviewProvider, TestablePreview {
HomeScreen(context: emptyViewModel.context)
}
.previewDisplayName("Empty")
.snapshot(delay: 4.0)
.snapshotPreferences(delay: 4.0)
NavigationStack {
HomeScreen(context: loadedViewModel.context)
}
.previewDisplayName("Loaded")
.snapshot(delay: 4.0)
.snapshotPreferences(delay: 4.0)
}
static func viewModel(_ mode: HomeScreenRoomListMode) -> HomeScreenViewModel {

View File

@ -111,25 +111,25 @@ struct JoinRoomScreen_Previews: PreviewProvider, TestablePreview {
JoinRoomScreen(context: unknownViewModel.context)
}
.previewDisplayName("Unknown")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
NavigationStack {
JoinRoomScreen(context: knockViewModel.context)
}
.previewDisplayName("Knock")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
NavigationStack {
JoinRoomScreen(context: joinViewModel.context)
}
.previewDisplayName("Join")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
NavigationStack {
JoinRoomScreen(context: inviteViewModel.context)
}
.previewDisplayName("Invite")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
}
static func makeViewModel(mode: JoinRoomScreenInteractionMode) -> JoinRoomScreenViewModel {

View File

@ -113,7 +113,7 @@ struct IdentityConfirmationScreen_Previews: PreviewProvider, TestablePreview {
NavigationStack {
IdentityConfirmationScreen(context: viewModel.context)
}
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
}
private static var viewModel: IdentityConfirmationScreenViewModel {

View File

@ -172,12 +172,12 @@ struct RoomDetailsEditScreen_Previews: PreviewProvider, TestablePreview {
RoomDetailsEditScreen(context: readOnlyViewModel.context)
}
.previewDisplayName("Read only")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
NavigationStack {
RoomDetailsEditScreen(context: editableViewModel.context)
}
.previewDisplayName("Editable")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
}
}

View File

@ -392,12 +392,12 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
RoomDetailsScreen(context: simpleRoomViewModel.context)
.previewDisplayName("Simple Room")
.snapshot(delay: 2)
.snapshotPreferences(delay: 2)
RoomDetailsScreen(context: dmRoomViewModel.context)
.previewDisplayName("DM Room")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
RoomDetailsScreen(context: genericRoomViewModel.context)
.previewDisplayName("Generic Room")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
}
}

View File

@ -98,6 +98,6 @@ struct RoomDirectorySearchScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
RoomDirectorySearchScreen(context: viewModel.context)
.snapshot(delay: 1.0)
.snapshotPreferences(delay: 1.0)
}
}

View File

@ -124,13 +124,13 @@ struct RoomMemberDetailsScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
RoomMemberDetailsScreen(context: otherUserViewModel.context)
.previewDisplayName("Other User")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
RoomMemberDetailsScreen(context: accountOwnerViewModel.context)
.previewDisplayName("Account Owner")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
RoomMemberDetailsScreen(context: ignoredUserViewModel.context)
.previewDisplayName("Ignored User")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
}
static func makeViewModel(member: RoomMemberProxyMock) -> RoomMemberDetailsScreenViewModel {

View File

@ -72,13 +72,13 @@ struct RoomMembersListManageMemberSheet_Previews: PreviewProvider, TestablePrevi
actions: [.kick, .ban],
context: viewModel.context)
.previewDisplayName("Joined")
.snapshot(delay: 0.2)
.snapshotPreferences(delay: 0.2)
RoomMembersListManageMemberSheet(member: .init(withProxy: RoomMemberProxyMock.mockBanned[3]),
actions: [],
context: viewModel.context)
.previewDisplayName("Banned")
.snapshot(delay: 0.2)
.snapshotPreferences(delay: 0.2)
}
}

View File

@ -117,31 +117,31 @@ struct RoomMembersListScreen_Previews: PreviewProvider, TestablePreview {
NavigationStack {
RoomMembersListScreen(context: viewModel.context)
}
.snapshot(delay: 1.0)
.snapshotPreferences(delay: 1.0)
.previewDisplayName("Member")
NavigationStack {
RoomMembersListScreen(context: invitesViewModel.context)
}
.snapshot(delay: 1.0)
.snapshotPreferences(delay: 1.0)
.previewDisplayName("Invites")
NavigationStack {
RoomMembersListScreen(context: adminViewModel.context)
}
.snapshot(delay: 1.0)
.snapshotPreferences(delay: 1.0)
.previewDisplayName("Admin: Members")
NavigationStack {
RoomMembersListScreen(context: bannedViewModel.context)
}
.snapshot(delay: 1.0)
.snapshotPreferences(delay: 1.0)
.previewDisplayName("Admin: Banned")
NavigationStack {
RoomMembersListScreen(context: emptyBannedViewModel.context)
}
.snapshot(delay: 1.0)
.snapshotPreferences(delay: 1.0)
.previewDisplayName("Admin: Empty Banned")
}

View File

@ -151,12 +151,12 @@ struct RoomPollsHistoryScreen_Previews: PreviewProvider, TestablePreview {
RoomPollsHistoryScreen(context: viewModelEmpty.context)
}
.previewDisplayName("No polls")
.snapshot(delay: 1.0)
.snapshotPreferences(delay: 1.0)
NavigationStack {
RoomPollsHistoryScreen(context: viewModel.context)
}
.previewDisplayName("polls")
.snapshot(delay: 1.0)
.snapshotPreferences(delay: 1.0)
}
}

View File

@ -148,7 +148,7 @@ struct SecureBackupScreen_Previews: PreviewProvider, TestablePreview {
}
.previewDisplayName("Recovery incomplete")
}
.snapshot(delay: 1.0)
.snapshotPreferences(delay: 1.0)
}
static func viewModel(keyBackupState: SecureBackupKeyBackupState,

View File

@ -253,9 +253,9 @@ struct NotificationSettingsScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
NotificationSettingsScreen(context: viewModel.context)
.snapshot(delay: 2.0)
.snapshotPreferences(delay: 2.0)
NotificationSettingsScreen(context: viewModelConfigurationMismatch.context)
.snapshot(delay: 2.0)
.snapshotPreferences(delay: 2.0)
.previewDisplayName("Configuration mismatch")
}
}

View File

@ -224,7 +224,7 @@ struct SettingsScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
NavigationStack {
SettingsScreen(context: viewModel.context)
.snapshot(delay: 1.0)
.snapshotPreferences(delay: 1.0)
}
}
}

View File

@ -317,7 +317,7 @@ struct TimelineReplyView_Previews: PreviewProvider, TestablePreview {
.padding()
.environmentObject(viewModel.context)
// Allow member names to load. Reduce precission as the `imageSource` randomly renders slightly differently
.snapshot(delay: 0.2, precision: 0.98)
.snapshotPreferences(delay: 0.2, precision: 0.98)
.previewLayout(.sizeThatFits)
}
}

View File

@ -205,7 +205,7 @@ struct FormattedBodyText_Previews: PreviewProvider, TestablePreview {
.padding()
}
.previewLayout(.sizeThatFits)
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
}
}

View File

@ -97,10 +97,10 @@ struct UserProfileScreen_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
UserProfileScreen(context: otherUserViewModel.context)
.previewDisplayName("Other User")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
UserProfileScreen(context: accountOwnerViewModel.context)
.previewDisplayName("Account Owner")
.snapshot(delay: 0.25)
.snapshotPreferences(delay: 0.25)
}
static func makeViewModel(userID: String) -> UserProfileScreenViewModel {

View File

@ -139,14 +139,26 @@ targets:
else
echo "warning: SwiftGen not installed, download from https://github.com/SwiftGen/SwiftGen"
fi
- name: 🧙 Sourcery
- name: 🧙 Sourcery - Generate mocks
runOnlyWhenInstalling: false
basedOnDependencyAnalysis: false
shell: /bin/sh
script: |
export PATH="$PATH:/opt/homebrew/bin"
if which sourcery >/dev/null; then
sourcery --config Tools/Sourcery/sourcery_automockable_config.yml
sourcery --config Tools/Sourcery/AutoMockableConfig.yml
else
echo "warning: Sourcery not installed, run swift run tools setup-project"
fi
- name: 🧙 Sourcery - Generate preview tests
runOnlyWhenInstalling: false
basedOnDependencyAnalysis: false
shell: /bin/sh
script: |
export PATH="$PATH:/opt/homebrew/bin"
if which sourcery >/dev/null; then
sourcery --config Tools/Sourcery/PreviewTestsConfig.yml
else
echo "warning: Sourcery not installed, run swift run tools setup-project"
fi
@ -202,7 +214,6 @@ targets:
- package: Version
- package: Emojibase
- package: WysiwygComposer
- package: Prefire
- package: SwiftOGG
- package: DSWaveformImage
product: DSWaveformImageViews

View File

@ -40,7 +40,6 @@ targets:
- package: DeviceKit
- package: DTCoreText
- package: LRUCache
- package: Prefire
- package: Version
info:
@ -76,7 +75,8 @@ targets:
- path: ../../ElementX/Sources/AppHooks/AppHooks.swift
- path: ../../ElementX/Sources/AppHooks/Hooks/ClientBuilderHook.swift
- path: ../../ElementX/Sources/Application/AppSettings.swift
- path: ../../ElementX/Sources/Generated
- path: ../../ElementX/Sources/Generated/Assets.swift
- path: ../../ElementX/Sources/Generated/Strings.swift
- path: ../../ElementX/Sources/Other/AvatarSize.swift
- path: ../../ElementX/Sources/Other/CurrentValuePublisher.swift
- path: ../../ElementX/Sources/Other/Extensions/AttributedString.swift

View File

@ -1,7 +0,0 @@
test_configuration:
- template_file_path: PreviewTests.stencil
- simulator_device: "iPhone14,6" # iPhone SE 3rd Generation
- required_os: 17
- snapshot_devices:
- iPhone 15
- iPad

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More