mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +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:
parent
365797c8b7
commit
536f01abbd
@ -115,6 +115,7 @@
|
|||||||
13C77FDF17C4C6627CFFC205 /* RoomTimelineItemFactoryProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D25A35764C7B3DB78954AB5 /* RoomTimelineItemFactoryProtocol.swift */; };
|
13C77FDF17C4C6627CFFC205 /* RoomTimelineItemFactoryProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D25A35764C7B3DB78954AB5 /* RoomTimelineItemFactoryProtocol.swift */; };
|
||||||
13CBC470FB619A6393A21908 /* RoomNotificationSettingsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8296D6FB451E25CEC0767BBA /* RoomNotificationSettingsScreenCoordinator.swift */; };
|
13CBC470FB619A6393A21908 /* RoomNotificationSettingsScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8296D6FB451E25CEC0767BBA /* RoomNotificationSettingsScreenCoordinator.swift */; };
|
||||||
14343C2F9AD2BFEA92CA28FF /* MapTilerStyleBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7AE92E7BFF71797BDE1D261 /* MapTilerStyleBuilder.swift */; };
|
14343C2F9AD2BFEA92CA28FF /* MapTilerStyleBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7AE92E7BFF71797BDE1D261 /* MapTilerStyleBuilder.swift */; };
|
||||||
|
1443CEEE42491CF7CD8A146A /* XCTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85A1941B874A3BE9CDDF43EF /* XCTestCase.swift */; };
|
||||||
1471A080552631358D152C18 /* AudioPlayerState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDB3E65A79779EDA5D33D8A /* AudioPlayerState.swift */; };
|
1471A080552631358D152C18 /* AudioPlayerState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BDB3E65A79779EDA5D33D8A /* AudioPlayerState.swift */; };
|
||||||
147597951DB07123A87AA1D1 /* landscape_test_image.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 96CE9D6642DD487D8CC90C9C /* landscape_test_image.jpg */; };
|
147597951DB07123A87AA1D1 /* landscape_test_image.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 96CE9D6642DD487D8CC90C9C /* landscape_test_image.jpg */; };
|
||||||
149D1942DC005D0485FB8D93 /* LoggingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DC1943ADE6A62ED5129D7C8 /* LoggingTests.swift */; };
|
149D1942DC005D0485FB8D93 /* LoggingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3DC1943ADE6A62ED5129D7C8 /* LoggingTests.swift */; };
|
||||||
@ -252,7 +253,6 @@
|
|||||||
30CC4F796B27BE8B1DFDBF5A /* NSEUserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEAA2832D93EC7D2608703FB /* NSEUserSession.swift */; };
|
30CC4F796B27BE8B1DFDBF5A /* NSEUserSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEAA2832D93EC7D2608703FB /* NSEUserSession.swift */; };
|
||||||
30E5628F74AD3C27A061BF25 /* QRCodeLoginScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BC1B7CB061C9865B2B91B56 /* QRCodeLoginScreenViewModel.swift */; };
|
30E5628F74AD3C27A061BF25 /* QRCodeLoginScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BC1B7CB061C9865B2B91B56 /* QRCodeLoginScreenViewModel.swift */; };
|
||||||
3113065AABBC14CEAE6843FA /* UserSessionFlowCoordinatorStateMachine.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8774CF614849664B5B3C2A1 /* UserSessionFlowCoordinatorStateMachine.swift */; };
|
3113065AABBC14CEAE6843FA /* UserSessionFlowCoordinatorStateMachine.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8774CF614849664B5B3C2A1 /* UserSessionFlowCoordinatorStateMachine.swift */; };
|
||||||
3116693C5EB476E028990416 /* XCTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74611A4182DCF5F4D42696EC /* XCTestCase.swift */; };
|
|
||||||
3118D9ABFD4BE5A3492FF88A /* ElementCallConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC437C491EA6996513B1CEAB /* ElementCallConfiguration.swift */; };
|
3118D9ABFD4BE5A3492FF88A /* ElementCallConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC437C491EA6996513B1CEAB /* ElementCallConfiguration.swift */; };
|
||||||
32B7891D937377A59606EDFC /* UserFlowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21DD8599815136EFF5B73F38 /* UserFlowTests.swift */; };
|
32B7891D937377A59606EDFC /* UserFlowTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21DD8599815136EFF5B73F38 /* UserFlowTests.swift */; };
|
||||||
339BC18777912E1989F2F17D /* Section.swift in Sources */ = {isa = PBXBuildFile; fileRef = 584A61D9C459FAFEF038A7C0 /* Section.swift */; };
|
339BC18777912E1989F2F17D /* Section.swift in Sources */ = {isa = PBXBuildFile; fileRef = 584A61D9C459FAFEF038A7C0 /* Section.swift */; };
|
||||||
@ -529,6 +529,7 @@
|
|||||||
69DE29C3E3180BB17D840690 /* ProgressCursorModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97C8E13A1FBA717B0C277ECC /* ProgressCursorModifier.swift */; };
|
69DE29C3E3180BB17D840690 /* ProgressCursorModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97C8E13A1FBA717B0C277ECC /* ProgressCursorModifier.swift */; };
|
||||||
6A0E7551E0D1793245F34CDD /* ClientError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A267106B9585D3D0CFC0D /* ClientError.swift */; };
|
6A0E7551E0D1793245F34CDD /* ClientError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09A267106B9585D3D0CFC0D /* ClientError.swift */; };
|
||||||
6A54F52443EC52AC5CD772C0 /* JoinRoomScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 869A8A4632E511351BFE2EC4 /* JoinRoomScreen.swift */; };
|
6A54F52443EC52AC5CD772C0 /* JoinRoomScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 869A8A4632E511351BFE2EC4 /* JoinRoomScreen.swift */; };
|
||||||
|
6A916606A8B92FE8A990A219 /* XCTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85A1941B874A3BE9CDDF43EF /* XCTestCase.swift */; };
|
||||||
6AD722DD92E465E56D2885AB /* BugReportScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA919F521E9F0EE3638AFC85 /* BugReportScreen.swift */; };
|
6AD722DD92E465E56D2885AB /* BugReportScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA919F521E9F0EE3638AFC85 /* BugReportScreen.swift */; };
|
||||||
6AEB650311F694A5702255C9 /* UserProfileScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B4932E4EFBC8FAC10972CD /* UserProfileScreenCoordinator.swift */; };
|
6AEB650311F694A5702255C9 /* UserProfileScreenCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B4932E4EFBC8FAC10972CD /* UserProfileScreenCoordinator.swift */; };
|
||||||
6B31508C6334C617360C2EAB /* RoomMemberDetailsViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC589E641AE46EFB2962534D /* RoomMemberDetailsViewModelTests.swift */; };
|
6B31508C6334C617360C2EAB /* RoomMemberDetailsViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC589E641AE46EFB2962534D /* RoomMemberDetailsViewModelTests.swift */; };
|
||||||
@ -1044,7 +1045,6 @@
|
|||||||
D33AC79A50DFC26D2498DD28 /* FileRoomTimelineItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5098DA7799946A61E34A2373 /* FileRoomTimelineItem.swift */; };
|
D33AC79A50DFC26D2498DD28 /* FileRoomTimelineItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5098DA7799946A61E34A2373 /* FileRoomTimelineItem.swift */; };
|
||||||
D34E328E9E65904358248FDD /* GlobalSearchScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 436A0D98D372B17EAE9AA999 /* GlobalSearchScreenModels.swift */; };
|
D34E328E9E65904358248FDD /* GlobalSearchScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 436A0D98D372B17EAE9AA999 /* GlobalSearchScreenModels.swift */; };
|
||||||
D3FD96913D2B1AAA3149DAC7 /* CreateRoomViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69D42EE0102D2857933625DD /* CreateRoomViewModelTests.swift */; };
|
D3FD96913D2B1AAA3149DAC7 /* CreateRoomViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69D42EE0102D2857933625DD /* CreateRoomViewModelTests.swift */; };
|
||||||
D415764645491F10344FC6AC /* Publisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60F18AECC9D38C2B6D85F99C /* Publisher.swift */; };
|
|
||||||
D43F0503EF2CBC55272538FE /* SDKGeneratedMocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F079B5DBD0D85FEA687AAE /* SDKGeneratedMocks.swift */; };
|
D43F0503EF2CBC55272538FE /* SDKGeneratedMocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F079B5DBD0D85FEA687AAE /* SDKGeneratedMocks.swift */; };
|
||||||
D46C33F8B61B55F0C8C2D15F /* LocationRoomTimelineItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B2AC540DE619B36832A5DB5 /* LocationRoomTimelineItem.swift */; };
|
D46C33F8B61B55F0C8C2D15F /* LocationRoomTimelineItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B2AC540DE619B36832A5DB5 /* LocationRoomTimelineItem.swift */; };
|
||||||
D4CB979EB4FE26AAD9F9A72B /* UserProfileScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 604A69C081B935D6A38DE6D8 /* UserProfileScreenModels.swift */; };
|
D4CB979EB4FE26AAD9F9A72B /* UserProfileScreenModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 604A69C081B935D6A38DE6D8 /* UserProfileScreenModels.swift */; };
|
||||||
@ -1110,6 +1110,7 @@
|
|||||||
E3AC72E3E58F364EF15C1CC7 /* NotificationSettingsScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 514363244AE7D68080D44C6F /* NotificationSettingsScreenViewModelTests.swift */; };
|
E3AC72E3E58F364EF15C1CC7 /* NotificationSettingsScreenViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 514363244AE7D68080D44C6F /* NotificationSettingsScreenViewModelTests.swift */; };
|
||||||
E3CA565A4B9704F191B191F0 /* JoinedRoomSize+MemberCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF9AEA706926DD0DA2B954C /* JoinedRoomSize+MemberCount.swift */; };
|
E3CA565A4B9704F191B191F0 /* JoinedRoomSize+MemberCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF9AEA706926DD0DA2B954C /* JoinedRoomSize+MemberCount.swift */; };
|
||||||
E3E1E255DC8CB34BD8573E0D /* UserIndicatorControllerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A12D3B1BCF920880CA8BBB6B /* UserIndicatorControllerProtocol.swift */; };
|
E3E1E255DC8CB34BD8573E0D /* UserIndicatorControllerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A12D3B1BCF920880CA8BBB6B /* UserIndicatorControllerProtocol.swift */; };
|
||||||
|
E3EBC3BF7CE3960B41757BAA /* Publisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7310D8DFE01AF45F0689C3AA /* Publisher.swift */; };
|
||||||
E45C9FA22BC13B477FD3B4AC /* EmojiDetection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D99730313BEBF08CDE81EE3 /* EmojiDetection.swift */; };
|
E45C9FA22BC13B477FD3B4AC /* EmojiDetection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D99730313BEBF08CDE81EE3 /* EmojiDetection.swift */; };
|
||||||
E468CC731C3F4D678499E52F /* LAContextMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BA5A62DA4B543827FF82354 /* LAContextMock.swift */; };
|
E468CC731C3F4D678499E52F /* LAContextMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BA5A62DA4B543827FF82354 /* LAContextMock.swift */; };
|
||||||
E481C8FDCB6C089963C95344 /* DeviceKit in Frameworks */ = {isa = PBXBuildFile; productRef = BC01130651CB23340B899032 /* DeviceKit */; };
|
E481C8FDCB6C089963C95344 /* DeviceKit in Frameworks */ = {isa = PBXBuildFile; productRef = BC01130651CB23340B899032 /* DeviceKit */; };
|
||||||
@ -1793,7 +1794,6 @@
|
|||||||
6033779EB37259F27F938937 /* ClientProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientProxyProtocol.swift; sourceTree = "<group>"; };
|
6033779EB37259F27F938937 /* ClientProxyProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientProxyProtocol.swift; sourceTree = "<group>"; };
|
||||||
604A69C081B935D6A38DE6D8 /* UserProfileScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileScreenModels.swift; sourceTree = "<group>"; };
|
604A69C081B935D6A38DE6D8 /* UserProfileScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileScreenModels.swift; sourceTree = "<group>"; };
|
||||||
60C9BAE9F9436B14E4E22E8F /* PinnedItemsBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinnedItemsBannerView.swift; sourceTree = "<group>"; };
|
60C9BAE9F9436B14E4E22E8F /* PinnedItemsBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinnedItemsBannerView.swift; sourceTree = "<group>"; };
|
||||||
60F18AECC9D38C2B6D85F99C /* Publisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Publisher.swift; sourceTree = "<group>"; };
|
|
||||||
61B33F23681660E940BA57F4 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/SAS.strings; sourceTree = "<group>"; };
|
61B33F23681660E940BA57F4 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/SAS.strings; sourceTree = "<group>"; };
|
||||||
622D09D4ECE759189009AEAF /* MapLibreMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapLibreMapView.swift; sourceTree = "<group>"; };
|
622D09D4ECE759189009AEAF /* MapLibreMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapLibreMapView.swift; sourceTree = "<group>"; };
|
||||||
624244C398804ADC885239AA /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Localizable.strings; sourceTree = "<group>"; };
|
624244C398804ADC885239AA /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
@ -1870,7 +1870,6 @@
|
|||||||
7367B3B9A8CAF902220F31D1 /* BugReportFlowCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BugReportFlowCoordinator.swift; sourceTree = "<group>"; };
|
7367B3B9A8CAF902220F31D1 /* BugReportFlowCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BugReportFlowCoordinator.swift; sourceTree = "<group>"; };
|
||||||
73A5C3F7C9C1DA10CAEC6A98 /* VoiceMessageRecordingComposer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceMessageRecordingComposer.swift; sourceTree = "<group>"; };
|
73A5C3F7C9C1DA10CAEC6A98 /* VoiceMessageRecordingComposer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceMessageRecordingComposer.swift; sourceTree = "<group>"; };
|
||||||
7447C0AD7EF302CD027D6230 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/SAS.strings; sourceTree = "<group>"; };
|
7447C0AD7EF302CD027D6230 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/SAS.strings; sourceTree = "<group>"; };
|
||||||
74611A4182DCF5F4D42696EC /* XCTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCTestCase.swift; sourceTree = "<group>"; };
|
|
||||||
7463464054DDF194C54F0B04 /* LogViewerScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewerScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
7463464054DDF194C54F0B04 /* LogViewerScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewerScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||||
74653BE903970C0E36867D46 /* GlobalSearchScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalSearchScreenCoordinator.swift; sourceTree = "<group>"; };
|
74653BE903970C0E36867D46 /* GlobalSearchScreenCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalSearchScreenCoordinator.swift; sourceTree = "<group>"; };
|
||||||
7475C5AE20BA896930907EA8 /* AudioRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioRoomTimelineItemContent.swift; sourceTree = "<group>"; };
|
7475C5AE20BA896930907EA8 /* AudioRoomTimelineItemContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioRoomTimelineItemContent.swift; sourceTree = "<group>"; };
|
||||||
@ -1955,6 +1954,7 @@
|
|||||||
85666E40F7E817809B4FD787 /* ComposerToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposerToolbar.swift; sourceTree = "<group>"; };
|
85666E40F7E817809B4FD787 /* ComposerToolbar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposerToolbar.swift; sourceTree = "<group>"; };
|
||||||
8585C636A10B8141A7AE909F /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
8585C636A10B8141A7AE909F /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||||
858DA81F2ACF484B7CAD6AE4 /* KnockedRoomProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KnockedRoomProxy.swift; sourceTree = "<group>"; };
|
858DA81F2ACF484B7CAD6AE4 /* KnockedRoomProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KnockedRoomProxy.swift; sourceTree = "<group>"; };
|
||||||
|
85A1941B874A3BE9CDDF43EF /* XCTestCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCTestCase.swift; sourceTree = "<group>"; };
|
||||||
85EB16E7FE59A947CA441531 /* MediaProviderProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaProviderProtocol.swift; sourceTree = "<group>"; };
|
85EB16E7FE59A947CA441531 /* MediaProviderProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaProviderProtocol.swift; sourceTree = "<group>"; };
|
||||||
8609BE4CA71C30D1FCE3AF9B /* AuthenticationStartScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationStartScreenModels.swift; sourceTree = "<group>"; };
|
8609BE4CA71C30D1FCE3AF9B /* AuthenticationStartScreenModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationStartScreenModels.swift; sourceTree = "<group>"; };
|
||||||
8610C1D21565C950BCA6A454 /* AppLockSetupSettingsScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockSetupSettingsScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
8610C1D21565C950BCA6A454 /* AppLockSetupSettingsScreenViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockSetupSettingsScreenViewModelProtocol.swift; sourceTree = "<group>"; };
|
||||||
@ -3562,6 +3562,7 @@
|
|||||||
2BFDCA5A09EE70BC17F2EFA7 /* URLComponents.swift */,
|
2BFDCA5A09EE70BC17F2EFA7 /* URLComponents.swift */,
|
||||||
AE40D4A5DD857AC16EED945A /* URLSession.swift */,
|
AE40D4A5DD857AC16EED945A /* URLSession.swift */,
|
||||||
897DF5E9A70CE05A632FC8AF /* UTType.swift */,
|
897DF5E9A70CE05A632FC8AF /* UTType.swift */,
|
||||||
|
85A1941B874A3BE9CDDF43EF /* XCTestCase.swift */,
|
||||||
E992D7B8BE54B2AB454613AF /* XCUIElement.swift */,
|
E992D7B8BE54B2AB454613AF /* XCUIElement.swift */,
|
||||||
);
|
);
|
||||||
path = Extensions;
|
path = Extensions;
|
||||||
@ -4075,15 +4076,6 @@
|
|||||||
path = Settings;
|
path = Settings;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
70C5B842301AC281DF374E41 /* Extensions */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
60F18AECC9D38C2B6D85F99C /* Publisher.swift */,
|
|
||||||
74611A4182DCF5F4D42696EC /* XCTestCase.swift */,
|
|
||||||
);
|
|
||||||
path = Extensions;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
70CC0CDA4AFDF8299C56ADE7 /* QRCode */ = {
|
70CC0CDA4AFDF8299C56ADE7 /* QRCode */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -4221,7 +4213,6 @@
|
|||||||
D93C94C30E3135BC9290DE13 /* VoiceMessageRecorderTests.swift */,
|
D93C94C30E3135BC9290DE13 /* VoiceMessageRecorderTests.swift */,
|
||||||
53280D2292E6C9C7821773FD /* UserSession */,
|
53280D2292E6C9C7821773FD /* UserSession */,
|
||||||
9613851C68D8C01EABFB3569 /* AppLock */,
|
9613851C68D8C01EABFB3569 /* AppLock */,
|
||||||
70C5B842301AC281DF374E41 /* Extensions */,
|
|
||||||
A6AA0A048CAE428A5CA4CBBB /* LayoutTests */,
|
A6AA0A048CAE428A5CA4CBBB /* LayoutTests */,
|
||||||
7583EAC171059A86B767209F /* MediaProvider */,
|
7583EAC171059A86B767209F /* MediaProvider */,
|
||||||
7DBC911559934065993A5FF4 /* NotificationManager */,
|
7DBC911559934065993A5FF4 /* NotificationManager */,
|
||||||
@ -6629,7 +6620,7 @@
|
|||||||
3982E60F9C126437D5E488A3 /* PillContextTests.swift in Sources */,
|
3982E60F9C126437D5E488A3 /* PillContextTests.swift in Sources */,
|
||||||
2D2D8A53B35BE8D8A01449C6 /* PinnedEventsBannerStateTests.swift in Sources */,
|
2D2D8A53B35BE8D8A01449C6 /* PinnedEventsBannerStateTests.swift in Sources */,
|
||||||
FF7E8ECC8E7E1D1851517536 /* PollFormScreenViewModelTests.swift in Sources */,
|
FF7E8ECC8E7E1D1851517536 /* PollFormScreenViewModelTests.swift in Sources */,
|
||||||
D415764645491F10344FC6AC /* Publisher.swift in Sources */,
|
E3EBC3BF7CE3960B41757BAA /* Publisher.swift in Sources */,
|
||||||
BDC4EB54CC3036730475CB8B /* QRCodeLoginScreenViewModelTests.swift in Sources */,
|
BDC4EB54CC3036730475CB8B /* QRCodeLoginScreenViewModelTests.swift in Sources */,
|
||||||
D53B80EF02C1062E68659EDD /* ReportContentViewModelTests.swift in Sources */,
|
D53B80EF02C1062E68659EDD /* ReportContentViewModelTests.swift in Sources */,
|
||||||
09D3D7D115318CAD131B4FE7 /* ResolveVerifiedUserSendFailureScreenViewModelTests.swift in Sources */,
|
09D3D7D115318CAD131B4FE7 /* ResolveVerifiedUserSendFailureScreenViewModelTests.swift in Sources */,
|
||||||
@ -6685,7 +6676,7 @@
|
|||||||
21AFEFB8CEFE56A3811A1F5B /* VoiceMessageCacheTests.swift in Sources */,
|
21AFEFB8CEFE56A3811A1F5B /* VoiceMessageCacheTests.swift in Sources */,
|
||||||
44BDD670FF9095ACE240A3A2 /* VoiceMessageMediaManagerTests.swift in Sources */,
|
44BDD670FF9095ACE240A3A2 /* VoiceMessageMediaManagerTests.swift in Sources */,
|
||||||
A3D7110C1E75E7B4A73BE71C /* VoiceMessageRecorderTests.swift in Sources */,
|
A3D7110C1E75E7B4A73BE71C /* VoiceMessageRecorderTests.swift in Sources */,
|
||||||
3116693C5EB476E028990416 /* XCTestCase.swift in Sources */,
|
1443CEEE42491CF7CD8A146A /* XCTestCase.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -6695,6 +6686,7 @@
|
|||||||
files = (
|
files = (
|
||||||
038AB2E86960FD240231D4C2 /* GeneratedPreviewTests.swift in Sources */,
|
038AB2E86960FD240231D4C2 /* GeneratedPreviewTests.swift in Sources */,
|
||||||
ED635D7F00FA07E94D3CE1E8 /* PreviewTests.swift in Sources */,
|
ED635D7F00FA07E94D3CE1E8 /* PreviewTests.swift in Sources */,
|
||||||
|
6A916606A8B92FE8A990A219 /* XCTestCase.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -36,3 +36,17 @@ extension Publisher where Output == String, Failure == Never {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension Published.Publisher {
|
||||||
|
/// Returns the next output from the publisher skipping the current value stored into it (which is readable from the @Published property itself).
|
||||||
|
/// - Returns: the next output from the publisher
|
||||||
|
var nextValue: Output? {
|
||||||
|
get async {
|
||||||
|
var iterator = values.makeAsyncIterator()
|
||||||
|
|
||||||
|
// skips the publisher's current value
|
||||||
|
_ = await iterator.next()
|
||||||
|
return await iterator.next()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -14,33 +14,43 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import Combine
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
public struct SnapshotDelayPreferenceKey: PreferenceKey {
|
struct SnapshotPrecisionPreferenceKey: PreferenceKey {
|
||||||
public static var defaultValue: TimeInterval = 0.0
|
static var defaultValue: Float = 1.0
|
||||||
|
|
||||||
public static func reduce(value: inout TimeInterval, nextValue: () -> TimeInterval) {
|
static func reduce(value: inout Float, nextValue: () -> Float) {
|
||||||
value = nextValue()
|
value = nextValue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct SnapshotPrecisionPreferenceKey: PreferenceKey {
|
struct SnapshotPerceptualPrecisionPreferenceKey: PreferenceKey {
|
||||||
public static var defaultValue: Float = 1.0
|
static var defaultValue: Float = 0.98
|
||||||
|
|
||||||
public static func reduce(value: inout Float, nextValue: () -> Float) {
|
static func reduce(value: inout Float, nextValue: () -> Float) {
|
||||||
value = nextValue()
|
value = nextValue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct SnapshotPerceptualPrecisionPreferenceKey: PreferenceKey {
|
struct FulfillmentPublisherEquatableWrapper: Equatable {
|
||||||
public static var defaultValue: Float = 0.98
|
let publisher: AnyPublisher<Bool, Never>?
|
||||||
|
|
||||||
public static func reduce(value: inout Float, nextValue: () -> Float) {
|
// Publisher equatability complicates things but, luckily, we're only interesting in them changing from nil
|
||||||
|
static func == (lhs: FulfillmentPublisherEquatableWrapper, rhs: FulfillmentPublisherEquatableWrapper) -> Bool {
|
||||||
|
lhs.publisher != nil && rhs.publisher != nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct SnapshotFulfillmentPublisherPreferenceKey: PreferenceKey {
|
||||||
|
static var defaultValue: FulfillmentPublisherEquatableWrapper?
|
||||||
|
|
||||||
|
static func reduce(value: inout FulfillmentPublisherEquatableWrapper?, nextValue: () -> FulfillmentPublisherEquatableWrapper?) {
|
||||||
value = nextValue()
|
value = nextValue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public extension SwiftUI.View {
|
extension SwiftUI.View {
|
||||||
/// Use this modifier when you want to apply snapshot-specific preferences,
|
/// Use this modifier when you want to apply snapshot-specific preferences,
|
||||||
/// like delay and precision, to the view.
|
/// like delay and precision, to the view.
|
||||||
/// These preferences can then be retrieved and used elsewhere in your view hierarchy.
|
/// These preferences can then be retrieved and used elsewhere in your view hierarchy.
|
||||||
@ -49,10 +59,11 @@ public extension SwiftUI.View {
|
|||||||
/// - delay: The delay time in seconds that you want to set as a preference to the View.
|
/// - 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.
|
/// - 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.
|
/// - 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(expect fulfillmentPublisher: (any Publisher<Bool, Never>)? = nil,
|
||||||
func snapshotPreferences(delay: TimeInterval = .zero, precision: Float = 1.0, perceptualPrecision: Float = 0.98) -> some SwiftUI.View {
|
precision: Float = 1.0,
|
||||||
preference(key: SnapshotDelayPreferenceKey.self, value: delay)
|
perceptualPrecision: Float = 0.98) -> some SwiftUI.View {
|
||||||
.preference(key: SnapshotPrecisionPreferenceKey.self, value: precision)
|
preference(key: SnapshotPrecisionPreferenceKey.self, value: precision)
|
||||||
.preference(key: SnapshotPerceptualPrecisionPreferenceKey.self, value: perceptualPrecision)
|
.preference(key: SnapshotPerceptualPrecisionPreferenceKey.self, value: perceptualPrecision)
|
||||||
|
.preference(key: SnapshotFulfillmentPublisherPreferenceKey.self, value: FulfillmentPublisherEquatableWrapper(publisher: fulfillmentPublisher?.eraseToAnyPublisher()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,20 +136,23 @@ struct LoginScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
NavigationStack {
|
NavigationStack {
|
||||||
LoginScreen(context: viewModel.context)
|
LoginScreen(context: viewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||||
|
state.homeserver.loginMode == .password
|
||||||
|
})
|
||||||
.previewDisplayName("matrix.org")
|
.previewDisplayName("matrix.org")
|
||||||
.snapshotPreferences(delay: 1)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
LoginScreen(context: credentialsViewModel.context)
|
LoginScreen(context: credentialsViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: credentialsViewModel.context.$viewState.map { state in
|
||||||
|
state.homeserver.loginMode == .password
|
||||||
|
})
|
||||||
.previewDisplayName("Credentials Entered")
|
.previewDisplayName("Credentials Entered")
|
||||||
.snapshotPreferences(delay: 1)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
LoginScreen(context: unconfiguredViewModel.context)
|
LoginScreen(context: unconfiguredViewModel.context)
|
||||||
}
|
}
|
||||||
.previewDisplayName("Unsupported")
|
.previewDisplayName("Unsupported")
|
||||||
.snapshotPreferences(delay: 1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static func makeViewModel(homeserverAddress: String = "matrix.org", withCredentials: Bool = false) -> LoginScreenViewModel {
|
static func makeViewModel(homeserverAddress: String = "matrix.org", withCredentials: Bool = false) -> LoginScreenViewModel {
|
||||||
|
@ -107,7 +107,9 @@ struct ServerSelection_Previews: PreviewProvider, TestablePreview {
|
|||||||
NavigationStack {
|
NavigationStack {
|
||||||
ServerSelectionScreen(context: invalidViewModel.context)
|
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 {
|
static func makeViewModel(for homeserverAddress: String) -> ServerSelectionScreenViewModel {
|
||||||
|
@ -332,12 +332,16 @@ struct CreateRoom_Previews: PreviewProvider, TestablePreview {
|
|||||||
NavigationStack {
|
NavigationStack {
|
||||||
CreateRoomScreen(context: publicRoomInvalidAliasViewModel.context)
|
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")
|
.previewDisplayName("Create Public Room, invalid alias")
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
CreateRoomScreen(context: publicRoomExistingAliasViewModel.context)
|
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")
|
.previewDisplayName("Create Public Room, existing alias")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,9 @@ struct EmojiPickerScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
EmojiPickerScreen(context: viewModel.context, selectedEmojis: ["😀", "😄"])
|
EmojiPickerScreen(context: viewModel.context, selectedEmojis: ["😀", "😄"])
|
||||||
.previewDisplayName("Screen")
|
.previewDisplayName("Screen")
|
||||||
.snapshotPreferences(delay: 0.5)
|
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||||
|
!state.categories.isEmpty
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,16 +152,17 @@ struct TimelineMediaPreviewDetailsView_Previews: PreviewProvider, TestablePrevie
|
|||||||
TimelineMediaPreviewDetailsView(item: viewModel.state.currentItem,
|
TimelineMediaPreviewDetailsView(item: viewModel.state.currentItem,
|
||||||
context: viewModel.context)
|
context: viewModel.context)
|
||||||
.previewDisplayName("Image")
|
.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,
|
TimelineMediaPreviewDetailsView(item: unknownTypeViewModel.state.currentItem,
|
||||||
context: unknownTypeViewModel.context)
|
context: unknownTypeViewModel.context)
|
||||||
.previewDisplayName("Unknown type")
|
.previewDisplayName("Unknown type")
|
||||||
.snapshotPreferences(delay: 0.1)
|
|
||||||
|
|
||||||
TimelineMediaPreviewDetailsView(item: presentedOnRoomViewModel.state.currentItem,
|
TimelineMediaPreviewDetailsView(item: presentedOnRoomViewModel.state.currentItem,
|
||||||
context: presentedOnRoomViewModel.context)
|
context: presentedOnRoomViewModel.context)
|
||||||
.previewDisplayName("Incoming on Room")
|
.previewDisplayName("Incoming on Room")
|
||||||
.snapshotPreferences(delay: 0.1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static func makeViewModel(contentType: UTType? = nil, isOutgoing: Bool = false, isPresentedOnRoomScreen: Bool = false) -> TimelineMediaPreviewViewModel {
|
static func makeViewModel(contentType: UTType? = nil, isOutgoing: Bool = false, isPresentedOnRoomScreen: Bool = false) -> TimelineMediaPreviewViewModel {
|
||||||
|
@ -196,19 +196,26 @@ struct HomeScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
NavigationStack {
|
NavigationStack {
|
||||||
HomeScreen(context: loadingViewModel.context)
|
HomeScreen(context: loadingViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: loadedViewModel.context.$viewState.map { state in
|
||||||
|
state.roomListMode == .skeletons
|
||||||
|
})
|
||||||
.previewDisplayName("Loading")
|
.previewDisplayName("Loading")
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
HomeScreen(context: emptyViewModel.context)
|
HomeScreen(context: emptyViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: emptyViewModel.context.$viewState.map { state in
|
||||||
|
state.roomListMode == .empty
|
||||||
|
})
|
||||||
.previewDisplayName("Empty")
|
.previewDisplayName("Empty")
|
||||||
.snapshotPreferences(delay: 4.0)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
HomeScreen(context: loadedViewModel.context)
|
HomeScreen(context: loadedViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: loadedViewModel.context.$viewState.map { state in
|
||||||
|
state.roomListMode == .rooms
|
||||||
|
})
|
||||||
.previewDisplayName("Loaded")
|
.previewDisplayName("Loaded")
|
||||||
.snapshotPreferences(delay: 4.0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static func viewModel(_ mode: HomeScreenRoomListMode) -> HomeScreenViewModel {
|
static func viewModel(_ mode: HomeScreenRoomListMode) -> HomeScreenViewModel {
|
||||||
|
@ -202,32 +202,42 @@ struct JoinRoomScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
NavigationStack {
|
NavigationStack {
|
||||||
JoinRoomScreen(context: unknownViewModel.context)
|
JoinRoomScreen(context: unknownViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: unknownViewModel.context.$viewState.map { state in
|
||||||
|
state.roomDetails != nil
|
||||||
|
})
|
||||||
.previewDisplayName("Unknown")
|
.previewDisplayName("Unknown")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
JoinRoomScreen(context: knockViewModel.context)
|
JoinRoomScreen(context: knockViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: knockViewModel.context.$viewState.map { state in
|
||||||
|
state.roomDetails != nil
|
||||||
|
})
|
||||||
.previewDisplayName("Knock")
|
.previewDisplayName("Knock")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
JoinRoomScreen(context: joinViewModel.context)
|
JoinRoomScreen(context: joinViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: joinViewModel.context.$viewState.map { state in
|
||||||
|
state.roomDetails != nil
|
||||||
|
})
|
||||||
.previewDisplayName("Join")
|
.previewDisplayName("Join")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
JoinRoomScreen(context: inviteViewModel.context)
|
JoinRoomScreen(context: inviteViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: inviteViewModel.context.$viewState.map { state in
|
||||||
|
state.roomDetails != nil
|
||||||
|
})
|
||||||
.previewDisplayName("Invite")
|
.previewDisplayName("Invite")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
JoinRoomScreen(context: knockedViewModel.context)
|
JoinRoomScreen(context: knockedViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: knockedViewModel.context.$viewState.map { state in
|
||||||
|
state.roomDetails != nil
|
||||||
|
})
|
||||||
.previewDisplayName("Knocked")
|
.previewDisplayName("Knocked")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static func makeViewModel(mode: JoinRoomScreenInteractionMode) -> JoinRoomScreenViewModel {
|
static func makeViewModel(mode: JoinRoomScreenInteractionMode) -> JoinRoomScreenViewModel {
|
||||||
|
@ -127,23 +127,32 @@ struct KnockRequestsListScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
NavigationStack {
|
NavigationStack {
|
||||||
KnockRequestsListScreen(context: viewModel.context)
|
KnockRequestsListScreen(context: viewModel.context)
|
||||||
}
|
}
|
||||||
.snapshotPreferences(delay: 0.2)
|
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||||
|
state.shouldDisplayRequests == true
|
||||||
|
})
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
KnockRequestsListScreen(context: singleRequestViewModel.context)
|
KnockRequestsListScreen(context: singleRequestViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: singleRequestViewModel.context.$viewState.map { state in
|
||||||
|
state.shouldDisplayRequests == true
|
||||||
|
})
|
||||||
.previewDisplayName("Single Request")
|
.previewDisplayName("Single Request")
|
||||||
.snapshotPreferences(delay: 0.2)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
KnockRequestsListScreen(context: emptyViewModel.context)
|
KnockRequestsListScreen(context: emptyViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: emptyViewModel.context.$viewState.map { state in
|
||||||
|
state.shouldDisplayEmptyView == true
|
||||||
|
})
|
||||||
.previewDisplayName("Empty state")
|
.previewDisplayName("Empty state")
|
||||||
.snapshotPreferences(delay: 0.2)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
KnockRequestsListScreen(context: loadingViewModel.context)
|
KnockRequestsListScreen(context: loadingViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: loadingViewModel.context.$viewState.map { state in
|
||||||
|
state.isLoading == true
|
||||||
|
})
|
||||||
.previewDisplayName("Loading state")
|
.previewDisplayName("Loading state")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,9 @@ struct IdentityConfirmationScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
NavigationStack {
|
NavigationStack {
|
||||||
IdentityConfirmationScreen(context: viewModel.context)
|
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 {
|
private static var viewModel: IdentityConfirmationScreenViewModel {
|
||||||
|
@ -174,12 +174,13 @@ struct RoomDetailsEditScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
RoomDetailsEditScreen(context: readOnlyViewModel.context)
|
RoomDetailsEditScreen(context: readOnlyViewModel.context)
|
||||||
}
|
}
|
||||||
.previewDisplayName("Read only")
|
.previewDisplayName("Read only")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
RoomDetailsEditScreen(context: editableViewModel.context)
|
RoomDetailsEditScreen(context: editableViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: editableViewModel.context.$viewState.map { state in
|
||||||
|
state.canEditTopic == true
|
||||||
|
})
|
||||||
.previewDisplayName("Editable")
|
.previewDisplayName("Editable")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,13 +419,21 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
RoomDetailsScreen(context: simpleRoomViewModel.context)
|
RoomDetailsScreen(context: simpleRoomViewModel.context)
|
||||||
|
.snapshotPreferences(expect: simpleRoomViewModel.context.$viewState.map { state in
|
||||||
|
state.shortcuts.contains(.invite)
|
||||||
|
})
|
||||||
.previewDisplayName("Simple Room")
|
.previewDisplayName("Simple Room")
|
||||||
.snapshotPreferences(delay: 2)
|
|
||||||
RoomDetailsScreen(context: dmRoomViewModel.context)
|
RoomDetailsScreen(context: dmRoomViewModel.context)
|
||||||
|
.snapshotPreferences(expect: dmRoomViewModel.context.$viewState.map { state in
|
||||||
|
state.accountOwner != nil
|
||||||
|
})
|
||||||
.previewDisplayName("DM Room")
|
.previewDisplayName("DM Room")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
RoomDetailsScreen(context: genericRoomViewModel.context)
|
RoomDetailsScreen(context: genericRoomViewModel.context)
|
||||||
|
.snapshotPreferences(expect: genericRoomViewModel.context.$viewState.map { state in
|
||||||
|
state.shortcuts.contains(.invite)
|
||||||
|
})
|
||||||
.previewDisplayName("Generic Room")
|
.previewDisplayName("Generic Room")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,5 @@ struct RoomDirectorySearchScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
RoomDirectorySearchScreen(context: viewModel.context)
|
RoomDirectorySearchScreen(context: viewModel.context)
|
||||||
.snapshotPreferences(delay: 1.0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,17 +139,28 @@ struct RoomMemberDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
RoomMemberDetailsScreen(context: verifiedUserViewModel.context)
|
RoomMemberDetailsScreen(context: verifiedUserViewModel.context)
|
||||||
|
.snapshotPreferences(expect: verifiedUserViewModel.context.$viewState.map { state in
|
||||||
|
state.isVerified == true
|
||||||
|
})
|
||||||
.previewDisplayName("Verified User")
|
.previewDisplayName("Verified User")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
RoomMemberDetailsScreen(context: otherUserViewModel.context)
|
RoomMemberDetailsScreen(context: otherUserViewModel.context)
|
||||||
|
.snapshotPreferences(expect: otherUserViewModel.context.$viewState.map { state in
|
||||||
|
state.memberDetails?.role == .user
|
||||||
|
})
|
||||||
.previewDisplayName("Other User")
|
.previewDisplayName("Other User")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
RoomMemberDetailsScreen(context: accountOwnerViewModel.context)
|
RoomMemberDetailsScreen(context: accountOwnerViewModel.context)
|
||||||
|
.snapshotPreferences(expect: accountOwnerViewModel.context.$viewState.map { state in
|
||||||
|
state.isOwnMemberDetails == true
|
||||||
|
})
|
||||||
.previewDisplayName("Account Owner")
|
.previewDisplayName("Account Owner")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
RoomMemberDetailsScreen(context: ignoredUserViewModel.context)
|
RoomMemberDetailsScreen(context: ignoredUserViewModel.context)
|
||||||
|
.snapshotPreferences(expect: ignoredUserViewModel.context.$viewState.map { state in
|
||||||
|
state.memberDetails?.isIgnored ?? false
|
||||||
|
})
|
||||||
.previewDisplayName("Ignored User")
|
.previewDisplayName("Ignored User")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static func makeViewModel(member: RoomMemberProxyMock) -> RoomMemberDetailsScreenViewModel {
|
static func makeViewModel(member: RoomMemberProxyMock) -> RoomMemberDetailsScreenViewModel {
|
||||||
|
@ -72,13 +72,11 @@ struct RoomMembersListManageMemberSheet_Previews: PreviewProvider, TestablePrevi
|
|||||||
actions: [.kick, .ban],
|
actions: [.kick, .ban],
|
||||||
context: viewModel.context)
|
context: viewModel.context)
|
||||||
.previewDisplayName("Joined")
|
.previewDisplayName("Joined")
|
||||||
.snapshotPreferences(delay: 0.2)
|
|
||||||
|
|
||||||
RoomMembersListManageMemberSheet(member: .init(withProxy: RoomMemberProxyMock.mockBanned[3]),
|
RoomMembersListManageMemberSheet(member: .init(withProxy: RoomMemberProxyMock.mockBanned[3]),
|
||||||
actions: [],
|
actions: [],
|
||||||
context: viewModel.context)
|
context: viewModel.context)
|
||||||
.previewDisplayName("Banned")
|
.previewDisplayName("Banned")
|
||||||
.snapshotPreferences(delay: 0.2)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,31 +117,41 @@ struct RoomMembersListScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
NavigationStack {
|
NavigationStack {
|
||||||
RoomMembersListScreen(context: viewModel.context)
|
RoomMembersListScreen(context: viewModel.context)
|
||||||
}
|
}
|
||||||
.snapshotPreferences(delay: 1.0)
|
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||||
|
!state.visibleJoinedMembers.isEmpty
|
||||||
|
})
|
||||||
.previewDisplayName("Member")
|
.previewDisplayName("Member")
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
RoomMembersListScreen(context: invitesViewModel.context)
|
RoomMembersListScreen(context: invitesViewModel.context)
|
||||||
}
|
}
|
||||||
.snapshotPreferences(delay: 1.0)
|
.snapshotPreferences(expect: invitesViewModel.context.$viewState.map { state in
|
||||||
|
!state.visibleJoinedMembers.isEmpty
|
||||||
|
})
|
||||||
.previewDisplayName("Invites")
|
.previewDisplayName("Invites")
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
RoomMembersListScreen(context: adminViewModel.context)
|
RoomMembersListScreen(context: adminViewModel.context)
|
||||||
}
|
}
|
||||||
.snapshotPreferences(delay: 1.0)
|
.snapshotPreferences(expect: adminViewModel.context.$viewState.map { state in
|
||||||
|
state.canBanUsers == true
|
||||||
|
})
|
||||||
.previewDisplayName("Admin: Members")
|
.previewDisplayName("Admin: Members")
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
RoomMembersListScreen(context: bannedViewModel.context)
|
RoomMembersListScreen(context: bannedViewModel.context)
|
||||||
}
|
}
|
||||||
.snapshotPreferences(delay: 1.0)
|
.snapshotPreferences(expect: bannedViewModel.context.$viewState.map { state in
|
||||||
|
state.canBanUsers == true
|
||||||
|
})
|
||||||
.previewDisplayName("Admin: Banned")
|
.previewDisplayName("Admin: Banned")
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
RoomMembersListScreen(context: emptyBannedViewModel.context)
|
RoomMembersListScreen(context: emptyBannedViewModel.context)
|
||||||
}
|
}
|
||||||
.snapshotPreferences(delay: 1.0)
|
.snapshotPreferences(expect: emptyBannedViewModel.context.$viewState.map { state in
|
||||||
|
state.canBanUsers == true
|
||||||
|
})
|
||||||
.previewDisplayName("Admin: Empty Banned")
|
.previewDisplayName("Admin: Empty Banned")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,12 +151,10 @@ struct RoomPollsHistoryScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
RoomPollsHistoryScreen(context: viewModelEmpty.context)
|
RoomPollsHistoryScreen(context: viewModelEmpty.context)
|
||||||
}
|
}
|
||||||
.previewDisplayName("No polls")
|
.previewDisplayName("No polls")
|
||||||
.snapshotPreferences(delay: 1.0)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
RoomPollsHistoryScreen(context: viewModel.context)
|
RoomPollsHistoryScreen(context: viewModel.context)
|
||||||
}
|
}
|
||||||
.previewDisplayName("polls")
|
.previewDisplayName("polls")
|
||||||
.snapshotPreferences(delay: 1.0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ struct SecureBackupRecoveryKeyScreen: View {
|
|||||||
struct SecureBackupRecoveryKeyScreen_Previews: PreviewProvider, TestablePreview {
|
struct SecureBackupRecoveryKeyScreen_Previews: PreviewProvider, TestablePreview {
|
||||||
static let key = "EsTM njec uHYA yHmh dQdW Nj4o bNRU 9jMN XGMc KUNM UFr5 R8GY"
|
static let key = "EsTM njec uHYA yHmh dQdW Nj4o bNRU 9jMN XGMc KUNM UFr5 R8GY"
|
||||||
static let notSetUpViewModel = viewModel(recoveryState: .disabled)
|
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 setupViewModel = viewModel(recoveryState: .enabled, generateKey: true, key: key)
|
||||||
static let incompleteViewModel = viewModel(recoveryState: .incomplete)
|
static let incompleteViewModel = viewModel(recoveryState: .incomplete)
|
||||||
static let unknownViewModel = viewModel(recoveryState: .unknown)
|
static let unknownViewModel = viewModel(recoveryState: .unknown)
|
||||||
@ -239,13 +239,14 @@ struct SecureBackupRecoveryKeyScreen_Previews: PreviewProvider, TestablePreview
|
|||||||
SecureBackupRecoveryKeyScreen(context: generatingViewModel.context)
|
SecureBackupRecoveryKeyScreen(context: generatingViewModel.context)
|
||||||
}
|
}
|
||||||
.previewDisplayName("Generating")
|
.previewDisplayName("Generating")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
SecureBackupRecoveryKeyScreen(context: setupViewModel.context)
|
SecureBackupRecoveryKeyScreen(context: setupViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: setupViewModel.context.$viewState.map { state in
|
||||||
|
state.recoveryKey != nil
|
||||||
|
})
|
||||||
.previewDisplayName("Set up")
|
.previewDisplayName("Set up")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
SecureBackupRecoveryKeyScreen(context: incompleteViewModel.context)
|
SecureBackupRecoveryKeyScreen(context: incompleteViewModel.context)
|
||||||
|
@ -125,29 +125,38 @@ struct SecureBackupScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
static let recoveryIncompleteViewModel = viewModel(keyBackupState: .enabled, recoveryState: .incomplete)
|
static let recoveryIncompleteViewModel = viewModel(keyBackupState: .enabled, recoveryState: .incomplete)
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
Group {
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
SecureBackupScreen(context: bothSetupViewModel.context)
|
SecureBackupScreen(context: bothSetupViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: bothSetupViewModel.context.$viewState.map { state in
|
||||||
|
state.keyBackupState == .enabled
|
||||||
|
})
|
||||||
.previewDisplayName("Both setup")
|
.previewDisplayName("Both setup")
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
SecureBackupScreen(context: onlyKeyBackupSetUpViewModel.context)
|
SecureBackupScreen(context: onlyKeyBackupSetUpViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: onlyKeyBackupSetUpViewModel.context.$viewState.map { state in
|
||||||
|
state.keyBackupState == .enabled
|
||||||
|
})
|
||||||
.previewDisplayName("Only key backup setup")
|
.previewDisplayName("Only key backup setup")
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
SecureBackupScreen(context: keyBackupDisabledViewModel.context)
|
SecureBackupScreen(context: keyBackupDisabledViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: keyBackupDisabledViewModel.context.$viewState.map { state in
|
||||||
|
state.keyBackupState == .unknown
|
||||||
|
})
|
||||||
.previewDisplayName("Key backup disabled")
|
.previewDisplayName("Key backup disabled")
|
||||||
|
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
SecureBackupScreen(context: recoveryIncompleteViewModel.context)
|
SecureBackupScreen(context: recoveryIncompleteViewModel.context)
|
||||||
}
|
}
|
||||||
|
.snapshotPreferences(expect: recoveryIncompleteViewModel.context.$viewState.map { state in
|
||||||
|
state.recoveryState == .incomplete
|
||||||
|
})
|
||||||
.previewDisplayName("Recovery incomplete")
|
.previewDisplayName("Recovery incomplete")
|
||||||
}
|
}
|
||||||
.snapshotPreferences(delay: 1.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
static func viewModel(keyBackupState: SecureBackupKeyBackupState,
|
static func viewModel(keyBackupState: SecureBackupKeyBackupState,
|
||||||
recoveryState: SecureBackupRecoveryState) -> SecureBackupScreenViewModelType {
|
recoveryState: SecureBackupRecoveryState) -> SecureBackupScreenViewModelType {
|
||||||
|
@ -253,9 +253,14 @@ struct NotificationSettingsScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
NotificationSettingsScreen(context: viewModel.context)
|
NotificationSettingsScreen(context: viewModel.context)
|
||||||
.snapshotPreferences(delay: 2.0)
|
.snapshotPreferences(expect: viewModel.context.$viewState.map { state in
|
||||||
|
state.settings != nil
|
||||||
|
})
|
||||||
|
|
||||||
NotificationSettingsScreen(context: viewModelConfigurationMismatch.context)
|
NotificationSettingsScreen(context: viewModelConfigurationMismatch.context)
|
||||||
.snapshotPreferences(delay: 2.0)
|
.snapshotPreferences(expect: viewModelConfigurationMismatch.context.$viewState.map { state in
|
||||||
|
state.settings != nil
|
||||||
|
})
|
||||||
.previewDisplayName("Configuration mismatch")
|
.previewDisplayName("Configuration mismatch")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,9 @@ struct SettingsScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
SettingsScreen(context: viewModel.context)
|
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()
|
.padding()
|
||||||
.environmentObject(viewModel.context)
|
.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)
|
.previewLayout(.sizeThatFits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,14 +355,12 @@ struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview
|
|||||||
.previewDisplayName("Replies")
|
.previewDisplayName("Replies")
|
||||||
threads
|
threads
|
||||||
.previewDisplayName("Thread decorator")
|
.previewDisplayName("Thread decorator")
|
||||||
.snapshotPreferences(delay: 1)
|
|
||||||
.previewLayout(.fixed(width: 390, height: 1700))
|
.previewLayout(.fixed(width: 390, height: 1700))
|
||||||
.padding(.bottom, 20)
|
.padding(.bottom, 20)
|
||||||
encryptionAuthenticity
|
encryptionAuthenticity
|
||||||
.previewDisplayName("Encryption Indicators")
|
.previewDisplayName("Encryption Indicators")
|
||||||
pinned
|
pinned
|
||||||
.previewDisplayName("Pinned messages")
|
.previewDisplayName("Pinned messages")
|
||||||
.snapshotPreferences(delay: 1)
|
|
||||||
.previewLayout(.fixed(width: 390, height: 1150))
|
.previewLayout(.fixed(width: 390, height: 1150))
|
||||||
.padding(.bottom, 20)
|
.padding(.bottom, 20)
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,5 @@ struct FormattedBodyText_Previews: PreviewProvider, TestablePreview {
|
|||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
.previewLayout(.sizeThatFits)
|
.previewLayout(.sizeThatFits)
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,14 +112,22 @@ struct UserProfileScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
UserProfileScreen(context: verifiedUserViewModel.context)
|
UserProfileScreen(context: verifiedUserViewModel.context)
|
||||||
|
.snapshotPreferences(expect: verifiedUserViewModel.context.$viewState.map { state in
|
||||||
|
state.isVerified != nil
|
||||||
|
})
|
||||||
.previewDisplayName("Verified User")
|
.previewDisplayName("Verified User")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
UserProfileScreen(context: otherUserViewModel.context)
|
UserProfileScreen(context: otherUserViewModel.context)
|
||||||
|
.snapshotPreferences(expect: otherUserViewModel.context.$viewState.map { state in
|
||||||
|
state.isVerified != nil
|
||||||
|
})
|
||||||
.previewDisplayName("Other User")
|
.previewDisplayName("Other User")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
UserProfileScreen(context: accountOwnerViewModel.context)
|
UserProfileScreen(context: accountOwnerViewModel.context)
|
||||||
|
.snapshotPreferences(expect: accountOwnerViewModel.context.$viewState.map { state in
|
||||||
|
state.isVerified != nil
|
||||||
|
})
|
||||||
.previewDisplayName("Account Owner")
|
.previewDisplayName("Account Owner")
|
||||||
.snapshotPreferences(delay: 0.25)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static func makeViewModel(userID: String) -> UserProfileScreenViewModel {
|
static func makeViewModel(userID: String) -> UserProfileScreenViewModel {
|
||||||
|
@ -224,6 +224,7 @@ targets:
|
|||||||
sources:
|
sources:
|
||||||
- path: ../Sources
|
- path: ../Sources
|
||||||
excludes:
|
excludes:
|
||||||
|
- Other/Extensions/XCTestCase.swift
|
||||||
- Other/Extensions/XCUIElement.swift
|
- Other/Extensions/XCUIElement.swift
|
||||||
- path: ../Resources
|
- path: ../Resources
|
||||||
- path: ../SupportingFiles
|
- path: ../SupportingFiles
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
|||||||
// Please see LICENSE in the repository root for full details.
|
// Please see LICENSE in the repository root for full details.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import Combine
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
@ -50,21 +51,21 @@ class PreviewTests: XCTestCase {
|
|||||||
|
|
||||||
// MARK: - Snapshots
|
// MARK: - Snapshots
|
||||||
|
|
||||||
func assertSnapshots(matching preview: _Preview, testName: String = #function) {
|
func assertSnapshots(matching preview: _Preview, testName: String = #function) async throws {
|
||||||
let preferences = SnapshotPreferences()
|
let preferences = SnapshotPreferences()
|
||||||
|
|
||||||
let preferenceReadingView = preview.content
|
let preferenceReadingView = preview.content
|
||||||
.onPreferenceChange(SnapshotDelayPreferenceKey.self) { preferences.delay = $0 }
|
|
||||||
.onPreferenceChange(SnapshotPrecisionPreferenceKey.self) { preferences.precision = $0 }
|
.onPreferenceChange(SnapshotPrecisionPreferenceKey.self) { preferences.precision = $0 }
|
||||||
.onPreferenceChange(SnapshotPerceptualPrecisionPreferenceKey.self) { preferences.perceptualPrecision = $0 }
|
.onPreferenceChange(SnapshotPerceptualPrecisionPreferenceKey.self) { preferences.perceptualPrecision = $0 }
|
||||||
|
.onPreferenceChange(SnapshotFulfillmentPublisherPreferenceKey.self) { preferences.fulfillmentPublisher = $0?.publisher }
|
||||||
|
|
||||||
// Render an image of the view in order to trigger the preference updates to occur.
|
// Render an image of the view in order to trigger the preference updates to occur.
|
||||||
let imageRenderer = ImageRenderer(content: preferenceReadingView)
|
let imageRenderer = ImageRenderer(content: preferenceReadingView)
|
||||||
_ = imageRenderer.uiImage
|
_ = imageRenderer.uiImage
|
||||||
|
|
||||||
// Delay the test now - a delay after creating the `snapshotView` results in the underlying view not getting updated for snapshotting.
|
if let fulfillmentPublisher = preferences.fulfillmentPublisher {
|
||||||
if preferences.delay != .zero {
|
let deferred = deferFulfillment(fulfillmentPublisher) { $0 == true }
|
||||||
wait(for: preferences.delay)
|
try await deferred.fulfill()
|
||||||
}
|
}
|
||||||
|
|
||||||
for deviceName in snapshotDevices {
|
for deviceName in snapshotDevices {
|
||||||
@ -133,10 +134,10 @@ class PreviewTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SnapshotPreferences {
|
private class SnapshotPreferences: @unchecked Sendable {
|
||||||
var delay: TimeInterval = 0
|
|
||||||
var precision: Float = 1
|
var precision: Float = 1
|
||||||
var perceptualPrecision: Float = 1
|
var perceptualPrecision: Float = 1
|
||||||
|
var fulfillmentPublisher: AnyPublisher<Bool, Never>?
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - SnapshotTesting + Extensions
|
// MARK: - SnapshotTesting + Extensions
|
||||||
|
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPad-en-GB.Loading.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPad-en-GB.Loading.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPad-en-GB.Migrating.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPad-en-GB.Migrating.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPad-pseudo.Loading.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPad-pseudo.Loading.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPad-pseudo.Migrating.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPad-pseudo.Migrating.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPhone-16-en-GB.Loading.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPhone-16-en-GB.Loading.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPhone-16-en-GB.Migrating.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPhone-16-en-GB.Migrating.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPhone-16-pseudo.Loading.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPhone-16-pseudo.Loading.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPhone-16-pseudo.Migrating.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_homeScreen-iPhone-16-pseudo.Migrating.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchScreen-iPad-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchScreen-iPad-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchScreen-iPad-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchScreen-iPad-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchScreen-iPhone-16-en-GB.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchScreen-iPhone-16-en-GB.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchScreen-iPhone-16-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_roomDirectorySearchScreen-iPhone-16-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_timelineReplyView-iPad-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_timelineReplyView-iPad-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_timelineReplyView-iPhone-16-pseudo.1.png
(Stored with Git LFS)
BIN
PreviewTests/Sources/__Snapshots__/PreviewTests/test_timelineReplyView-iPhone-16-pseudo.1.png
(Stored with Git LFS)
Binary file not shown.
@ -49,3 +49,4 @@ targets:
|
|||||||
excludes:
|
excludes:
|
||||||
- "**/__Snapshots__/**"
|
- "**/__Snapshots__/**"
|
||||||
- path: ../SupportingFiles
|
- path: ../SupportingFiles
|
||||||
|
- path: ../../ElementX/Sources/Other/Extensions/XCTestCase.swift
|
||||||
|
@ -26,9 +26,9 @@ extension PreviewTests {
|
|||||||
// MARK: - PreviewProvider
|
// MARK: - PreviewProvider
|
||||||
|
|
||||||
{% for type in types.types where (type.implements.TestablePreview or type.based.TestablePreview or type|annotated:"TestablePreview") and type.name != "TestablePreview" %}
|
{% for type in types.types where (type.implements.TestablePreview or type.based.TestablePreview or type|annotated:"TestablePreview") and type.name != "TestablePreview" %}
|
||||||
func test_{{ type.name|lowerFirstLetter|replace:"_Previews", "" }}() {
|
func test_{{ type.name|lowerFirstLetter|replace:"_Previews", "" }}() async throws {
|
||||||
for preview in {{ type.name }}._allPreviews {
|
for preview in {{ type.name }}._allPreviews {
|
||||||
assertSnapshots(matching: preview)
|
try await assertSnapshots(matching: preview)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{%- if not forloop.last %}
|
{%- if not forloop.last %}
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright 2023, 2024 New Vector Ltd.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
// Please see LICENSE in the repository root for full details.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Combine
|
|
||||||
|
|
||||||
extension Published.Publisher {
|
|
||||||
/// Returns the next output from the publisher skipping the current value stored into it (which is readable from the @Published property itself).
|
|
||||||
/// - Returns: the next output from the publisher
|
|
||||||
var nextValue: Output? {
|
|
||||||
get async {
|
|
||||||
var iterator = values.makeAsyncIterator()
|
|
||||||
|
|
||||||
// skips the publisher's current value
|
|
||||||
_ = await iterator.next()
|
|
||||||
return await iterator.next()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -46,6 +46,9 @@ targets:
|
|||||||
sources:
|
sources:
|
||||||
- path: ../Sources
|
- path: ../Sources
|
||||||
- path: ../SupportingFiles
|
- path: ../SupportingFiles
|
||||||
|
- path: ../../DevelopmentAssets
|
||||||
|
- path: ../../ElementX/Sources/Other/Extensions/Publisher.swift
|
||||||
|
- path: ../../ElementX/Sources/Other/Extensions/XCTestCase.swift
|
||||||
- path: ../../ElementX/Sources/Other/InfoPlistReader.swift
|
- path: ../../ElementX/Sources/Other/InfoPlistReader.swift
|
||||||
- path: ../../Tools/Scripts/Templates/SimpleScreenExample/Tests/Unit
|
- path: ../../Tools/Scripts/Templates/SimpleScreenExample/Tests/Unit
|
||||||
- path: ../../DevelopmentAssets
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user