diff --git a/GliaWidgets.xcodeproj/project.pbxproj b/GliaWidgets.xcodeproj/project.pbxproj index 5122861e1..c7d57bb93 100644 --- a/GliaWidgets.xcodeproj/project.pbxproj +++ b/GliaWidgets.xcodeproj/project.pbxproj @@ -296,8 +296,8 @@ 75C48498299AC71F003EC223 /* Header+Playbook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C48497299AC71F003EC223 /* Header+Playbook.swift */; }; 75CF8D6129B3F1E400CB1524 /* Configuration+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75CF8D6029B3F1E400CB1524 /* Configuration+Mock.swift */; }; 75CF8D6329B7DD8300CB1524 /* SecureConversations+ConfirmationStyle+RemoteConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75CF8D6229B7DD8300CB1524 /* SecureConversations+ConfirmationStyle+RemoteConfig.swift */; }; - 75CF8D9129C3A85C00CB1524 /* SecureConversationsWelcomeScreenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75CF8D9029C3A85C00CB1524 /* SecureConversationsWelcomeScreenTests.swift */; }; - 75CF8DAD29C8F2B500CB1524 /* SecureConversationsConfirmationScreenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75CF8DAC29C8F2B500CB1524 /* SecureConversationsConfirmationScreenTests.swift */; }; + 75CF8D9129C3A85C00CB1524 /* SecureConversationsWelcomeScreenVoiceOverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75CF8D9029C3A85C00CB1524 /* SecureConversationsWelcomeScreenVoiceOverTests.swift */; }; + 75CF8DAD29C8F2B500CB1524 /* SecureConversationsConfirmationScreenVoiceOverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75CF8DAC29C8F2B500CB1524 /* SecureConversationsConfirmationScreenVoiceOverTests.swift */; }; 75F58EE127E7D5300065BA2D /* Survey.ViewController.Props.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75F58EE027E7D5300065BA2D /* Survey.ViewController.Props.swift */; }; 75FF151427F3A2D600FE7BE2 /* Theme+Survey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75FF151327F3A2D600FE7BE2 /* Theme+Survey.swift */; }; 75FF151727F4E13900FE7BE2 /* Theme.Survey.BooleanQuestion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75FF151627F4E13900FE7BE2 /* Theme.Survey.BooleanQuestion.swift */; }; @@ -368,7 +368,7 @@ 846A5C3E29D1C7B00049B29F /* CallVisualizerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846A5C3D29D1C7B00049B29F /* CallVisualizerTests.swift */; }; 846A5C4029ED83C50049B29F /* CallVisualizer.Coordinator.DelegateEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846A5C3F29ED83C50049B29F /* CallVisualizer.Coordinator.DelegateEvent.swift */; }; 846A5C4529F6BEFA0049B29F /* GliaTests+StartEngagement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846A5C4429F6BEFA0049B29F /* GliaTests+StartEngagement.swift */; }; - 846E822828996A5C008EFBF0 /* AlertViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846E822728996A5C008EFBF0 /* AlertViewControllerTests.swift */; }; + 846E822828996A5C008EFBF0 /* AlertViewControllerVoiceOverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 846E822728996A5C008EFBF0 /* AlertViewControllerVoiceOverTests.swift */; }; 847A7643285A1914004044D1 /* FileUploadListViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847A7642285A1914004044D1 /* FileUploadListViewModelTests.swift */; }; 8491AF002A6FB44200CC3E72 /* GvaGalleryCardCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8491AEFF2A6FB44200CC3E72 /* GvaGalleryCardCell.swift */; }; 8491AF022A6FBBBA00CC3E72 /* GvaGalleryListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8491AF012A6FBBBA00CC3E72 /* GvaGalleryListView.swift */; }; @@ -599,13 +599,15 @@ C06A7586296ECC57006B69A2 /* VisitorCodeStyle.Accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = C06A7585296ECC57006B69A2 /* VisitorCodeStyle.Accessibility.swift */; }; C06A7588296ECD75006B69A2 /* Theme+VisitorCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = C06A7587296ECD75006B69A2 /* Theme+VisitorCode.swift */; }; C07F62462ABC322B003EFC97 /* OrientationManager.Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07F62452ABC322B003EFC97 /* OrientationManager.Mock.swift */; }; + C07F62772AC1BA2B003EFC97 /* UIViewController+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07F62762AC1BA2B003EFC97 /* UIViewController+Extensions.swift */; }; + C07F62832AC33BB9003EFC97 /* UIView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07F62822AC33BB9003EFC97 /* UIView+Extensions.swift */; }; C07FA04029AF542A00E9FB7F /* ScreenSharingViewStyle+Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84265E0B298AECBA00D65842 /* ScreenSharingViewStyle+Mock.swift */; }; C07FA04329AF551D00E9FB7F /* ScreenSharingView.Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04129AF550500E9FB7F /* ScreenSharingView.Mock.swift */; }; C07FA04629AF560A00E9FB7F /* ScreenSharingViewController.Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04429AF55F600E9FB7F /* ScreenSharingViewController.Mock.swift */; }; C07FA04B29AF83B900E9FB7F /* ActionButton.Mock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04929AF83A400E9FB7F /* ActionButton.Mock.swift */; }; - C07FA04F29B0E41A00E9FB7F /* ScreenShareViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04C29B0E41A00E9FB7F /* ScreenShareViewControllerTests.swift */; }; - C07FA05029B0E41A00E9FB7F /* VideoCallViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04D29B0E41A00E9FB7F /* VideoCallViewControllerTests.swift */; }; - C07FA05129B0E41A00E9FB7F /* VisitorCodeViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04E29B0E41A00E9FB7F /* VisitorCodeViewControllerTests.swift */; }; + C07FA04F29B0E41A00E9FB7F /* ScreenShareViewControllerVoiceOverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04C29B0E41A00E9FB7F /* ScreenShareViewControllerVoiceOverTests.swift */; }; + C07FA05029B0E41A00E9FB7F /* VideoCallViewControllerVoiceOverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04D29B0E41A00E9FB7F /* VideoCallViewControllerVoiceOverTests.swift */; }; + C07FA05129B0E41A00E9FB7F /* VisitorCodeViewControllerVoiceOverTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07FA04E29B0E41A00E9FB7F /* VisitorCodeViewControllerVoiceOverTests.swift */; }; C0857DE528D470C1008D171D /* Theme+Shadow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0857DE428D470C1008D171D /* Theme+Shadow.swift */; }; C0857DE728D470F2008D171D /* Theme+Layer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0857DE628D470F2008D171D /* Theme+Layer.swift */; }; C0857DEB28D482D0008D171D /* Theme+Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0857DEA28D482D0008D171D /* Theme+Button.swift */; }; @@ -1028,8 +1030,8 @@ 75C48497299AC71F003EC223 /* Header+Playbook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Header+Playbook.swift"; sourceTree = ""; }; 75CF8D6029B3F1E400CB1524 /* Configuration+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Configuration+Mock.swift"; sourceTree = ""; }; 75CF8D6229B7DD8300CB1524 /* SecureConversations+ConfirmationStyle+RemoteConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SecureConversations+ConfirmationStyle+RemoteConfig.swift"; sourceTree = ""; }; - 75CF8D9029C3A85C00CB1524 /* SecureConversationsWelcomeScreenTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureConversationsWelcomeScreenTests.swift; sourceTree = ""; }; - 75CF8DAC29C8F2B500CB1524 /* SecureConversationsConfirmationScreenTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureConversationsConfirmationScreenTests.swift; sourceTree = ""; }; + 75CF8D9029C3A85C00CB1524 /* SecureConversationsWelcomeScreenVoiceOverTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureConversationsWelcomeScreenVoiceOverTests.swift; sourceTree = ""; }; + 75CF8DAC29C8F2B500CB1524 /* SecureConversationsConfirmationScreenVoiceOverTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureConversationsConfirmationScreenVoiceOverTests.swift; sourceTree = ""; }; 75F58EE027E7D5300065BA2D /* Survey.ViewController.Props.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Survey.ViewController.Props.swift; sourceTree = ""; }; 75FF151327F3A2D600FE7BE2 /* Theme+Survey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Theme+Survey.swift"; sourceTree = ""; }; 75FF151627F4E13900FE7BE2 /* Theme.Survey.BooleanQuestion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.Survey.BooleanQuestion.swift; sourceTree = ""; }; @@ -1102,7 +1104,7 @@ 846A5C3D29D1C7B00049B29F /* CallVisualizerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallVisualizerTests.swift; sourceTree = ""; }; 846A5C3F29ED83C50049B29F /* CallVisualizer.Coordinator.DelegateEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallVisualizer.Coordinator.DelegateEvent.swift; sourceTree = ""; }; 846A5C4429F6BEFA0049B29F /* GliaTests+StartEngagement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GliaTests+StartEngagement.swift"; sourceTree = ""; }; - 846E822728996A5C008EFBF0 /* AlertViewControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertViewControllerTests.swift; sourceTree = ""; }; + 846E822728996A5C008EFBF0 /* AlertViewControllerVoiceOverTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertViewControllerVoiceOverTests.swift; sourceTree = ""; }; 847A7642285A1914004044D1 /* FileUploadListViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileUploadListViewModelTests.swift; sourceTree = ""; }; 8491AEFF2A6FB44200CC3E72 /* GvaGalleryCardCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GvaGalleryCardCell.swift; sourceTree = ""; }; 8491AF012A6FBBBA00CC3E72 /* GvaGalleryListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GvaGalleryListView.swift; sourceTree = ""; }; @@ -1338,12 +1340,14 @@ C06A7585296ECC57006B69A2 /* VisitorCodeStyle.Accessibility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VisitorCodeStyle.Accessibility.swift; sourceTree = ""; }; C06A7587296ECD75006B69A2 /* Theme+VisitorCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Theme+VisitorCode.swift"; sourceTree = ""; }; C07F62452ABC322B003EFC97 /* OrientationManager.Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrientationManager.Mock.swift; sourceTree = ""; }; + C07F62762AC1BA2B003EFC97 /* UIViewController+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Extensions.swift"; sourceTree = ""; }; + C07F62822AC33BB9003EFC97 /* UIView+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Extensions.swift"; sourceTree = ""; }; C07FA04129AF550500E9FB7F /* ScreenSharingView.Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenSharingView.Mock.swift; sourceTree = ""; }; C07FA04429AF55F600E9FB7F /* ScreenSharingViewController.Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenSharingViewController.Mock.swift; sourceTree = ""; }; C07FA04929AF83A400E9FB7F /* ActionButton.Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionButton.Mock.swift; sourceTree = ""; }; - C07FA04C29B0E41A00E9FB7F /* ScreenShareViewControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScreenShareViewControllerTests.swift; sourceTree = ""; }; - C07FA04D29B0E41A00E9FB7F /* VideoCallViewControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoCallViewControllerTests.swift; sourceTree = ""; }; - C07FA04E29B0E41A00E9FB7F /* VisitorCodeViewControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VisitorCodeViewControllerTests.swift; sourceTree = ""; }; + C07FA04C29B0E41A00E9FB7F /* ScreenShareViewControllerVoiceOverTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScreenShareViewControllerVoiceOverTests.swift; sourceTree = ""; }; + C07FA04D29B0E41A00E9FB7F /* VideoCallViewControllerVoiceOverTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoCallViewControllerVoiceOverTests.swift; sourceTree = ""; }; + C07FA04E29B0E41A00E9FB7F /* VisitorCodeViewControllerVoiceOverTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VisitorCodeViewControllerVoiceOverTests.swift; sourceTree = ""; }; C0857DE428D470C1008D171D /* Theme+Shadow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Theme+Shadow.swift"; sourceTree = ""; }; C0857DE628D470F2008D171D /* Theme+Layer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Theme+Layer.swift"; sourceTree = ""; }; C0857DEA28D482D0008D171D /* Theme+Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Theme+Button.swift"; sourceTree = ""; }; @@ -3342,7 +3346,8 @@ 9A1992CE27D61F5400161AAE /* SnapshotTests */ = { isa = PBXGroup; children = ( - 846E822728996A5C008EFBF0 /* AlertViewControllerTests.swift */, + C07F62752AC1BA0E003EFC97 /* extensions */, + 846E822728996A5C008EFBF0 /* AlertViewControllerVoiceOverTests.swift */, AF22C8842A6154780004BF3C /* AlertViewControllerLayoutTests.swift */, AF03A7AE2A6E7DC40081887D /* AlertViewControllerDynamicTypeFontTests.swift */, 9AB3401227F71D5D006E0FE2 /* BubbleViewVoiceOverTests.swift */, @@ -3357,23 +3362,23 @@ 9A1992D627D61F8100161AAE /* ChatViewControllerVoiceOverTests.swift */, AF22C88C2A6188EF0004BF3C /* ChatViewControllerLayoutTests.swift */, AF03A7B62A6EAFBA0081887D /* ChatViewControllerDynamicTypeFontTests.swift */, - C07FA04C29B0E41A00E9FB7F /* ScreenShareViewControllerTests.swift */, + C07FA04C29B0E41A00E9FB7F /* ScreenShareViewControllerVoiceOverTests.swift */, AF22C88E2A618B9D0004BF3C /* ScreenShareViewControllerLayoutTests.swift */, AF03A7B82A6ED1240081887D /* ScreenShareViewControllerDynamicTypeFontTests.swift */, - 75CF8D9029C3A85C00CB1524 /* SecureConversationsWelcomeScreenTests.swift */, + 75CF8D9029C3A85C00CB1524 /* SecureConversationsWelcomeScreenVoiceOverTests.swift */, AF22C8902A6198FF0004BF3C /* SecureConversationsWelcomeScreenLayoutTests.swift */, AF03A7BA2A6ED73E0081887D /* SecureConversationsWelcomeScreenDynamicTypeFontTests.swift */, - 75CF8DAC29C8F2B500CB1524 /* SecureConversationsConfirmationScreenTests.swift */, + 75CF8DAC29C8F2B500CB1524 /* SecureConversationsConfirmationScreenVoiceOverTests.swift */, AF22C8922A619F5C0004BF3C /* SecureConversationsConfirmationScreenLayoutTests.swift */, AF03A7BC2A6EDACF0081887D /* SecureConversationsConfirmationScreenDynamicTypeFontTests.swift */, 9A1992D727D61F8100161AAE /* SnapshotTestCase.swift */, 8458769E2823FD18007AC3DF /* SurveyViewControllerVoiceOverTests.swift */, AF22C8942A61A6B80004BF3C /* SurveyViewControllerLayoutTests.swift */, AF03A7BE2A6EDCBF0081887D /* SurveyViewControllerDynamicTypeFontTests.swift */, - C07FA04D29B0E41A00E9FB7F /* VideoCallViewControllerTests.swift */, + C07FA04D29B0E41A00E9FB7F /* VideoCallViewControllerVoiceOverTests.swift */, AF22C8962A61A9BF0004BF3C /* VideoCallViewControllerLayoutTests.swift */, AF03A7C02A6EDE190081887D /* VideoCallViewControllerDynamicTypeFontTests.swift */, - C07FA04E29B0E41A00E9FB7F /* VisitorCodeViewControllerTests.swift */, + C07FA04E29B0E41A00E9FB7F /* VisitorCodeViewControllerVoiceOverTests.swift */, AF22C8982A61AE930004BF3C /* VisitorCodeViewControllerLayoutTests.swift */, AF03A7C22A6EDF490081887D /* VisitorCodeViewControllerDynamicTypeFontTests.swift */, AF755FD92A71583900871E36 /* BubbleWindowLayoutTests.swift */, @@ -3572,6 +3577,15 @@ path = OrientationManager; sourceTree = ""; }; + C07F62752AC1BA0E003EFC97 /* extensions */ = { + isa = PBXGroup; + children = ( + C07F62762AC1BA2B003EFC97 /* UIViewController+Extensions.swift */, + C07F62822AC33BB9003EFC97 /* UIView+Extensions.swift */, + ); + path = extensions; + sourceTree = ""; + }; C096B408297EBCEB00F0C552 /* CallVisualizer */ = { isa = PBXGroup; children = ( @@ -4938,18 +4952,20 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 846E822828996A5C008EFBF0 /* AlertViewControllerTests.swift in Sources */, + 846E822828996A5C008EFBF0 /* AlertViewControllerVoiceOverTests.swift in Sources */, AF03A7BB2A6ED73E0081887D /* SecureConversationsWelcomeScreenDynamicTypeFontTests.swift in Sources */, - 75CF8D9129C3A85C00CB1524 /* SecureConversationsWelcomeScreenTests.swift in Sources */, + 75CF8D9129C3A85C00CB1524 /* SecureConversationsWelcomeScreenVoiceOverTests.swift in Sources */, AF22C8972A61A9BF0004BF3C /* VideoCallViewControllerLayoutTests.swift in Sources */, + C07F62772AC1BA2B003EFC97 /* UIViewController+Extensions.swift in Sources */, AF03A7BD2A6EDACF0081887D /* SecureConversationsConfirmationScreenDynamicTypeFontTests.swift in Sources */, AF03A7B92A6ED1240081887D /* ScreenShareViewControllerDynamicTypeFontTests.swift in Sources */, + C07F62832AC33BB9003EFC97 /* UIView+Extensions.swift in Sources */, 9AE9E4B527E0EE2E00BFE239 /* CallViewControllerVoiceOverTests.swift in Sources */, AF03A7BF2A6EDCBF0081887D /* SurveyViewControllerDynamicTypeFontTests.swift in Sources */, AF22C8852A6154780004BF3C /* AlertViewControllerLayoutTests.swift in Sources */, AF22C8872A6182AF0004BF3C /* BubbleViewLayoutTests.swift in Sources */, AF03A7C12A6EDE190081887D /* VideoCallViewControllerDynamicTypeFontTests.swift in Sources */, - C07FA05029B0E41A00E9FB7F /* VideoCallViewControllerTests.swift in Sources */, + C07FA05029B0E41A00E9FB7F /* VideoCallViewControllerVoiceOverTests.swift in Sources */, AF22C88D2A6188EF0004BF3C /* ChatViewControllerLayoutTests.swift in Sources */, AF03A7B12A6E96870081887D /* BubbleViewDynamicTypeFontTests.swift in Sources */, AF03A7AF2A6E7DC40081887D /* AlertViewControllerDynamicTypeFontTests.swift in Sources */, @@ -4961,10 +4977,10 @@ 9A1992D827D61F8100161AAE /* ChatViewControllerVoiceOverTests.swift in Sources */, AF22C8892A6184C50004BF3C /* CallViewControllerLayoutTests.swift in Sources */, 8458769F2823FD18007AC3DF /* SurveyViewControllerVoiceOverTests.swift in Sources */, - C07FA05129B0E41A00E9FB7F /* VisitorCodeViewControllerTests.swift in Sources */, - 75CF8DAD29C8F2B500CB1524 /* SecureConversationsConfirmationScreenTests.swift in Sources */, + C07FA05129B0E41A00E9FB7F /* VisitorCodeViewControllerVoiceOverTests.swift in Sources */, + 75CF8DAD29C8F2B500CB1524 /* SecureConversationsConfirmationScreenVoiceOverTests.swift in Sources */, 9AB3402928002422006E0FE2 /* ChatCallUpgradeViewVoiceOverTests.swift in Sources */, - C07FA04F29B0E41A00E9FB7F /* ScreenShareViewControllerTests.swift in Sources */, + C07FA04F29B0E41A00E9FB7F /* ScreenShareViewControllerVoiceOverTests.swift in Sources */, AF22C8952A61A6B80004BF3C /* SurveyViewControllerLayoutTests.swift in Sources */, 9A1992D927D61F8100161AAE /* SnapshotTestCase.swift in Sources */, AF03A7B52A6EAA950081887D /* ChatCallUpgradeViewDynamicTypeFontTests.swift in Sources */, diff --git a/SnapshotTests/AlertViewControllerDynamicTypeFontTests.swift b/SnapshotTests/AlertViewControllerDynamicTypeFontTests.swift index eb9ea34a0..bfad7fd7d 100644 --- a/SnapshotTests/AlertViewControllerDynamicTypeFontTests.swift +++ b/SnapshotTests/AlertViewControllerDynamicTypeFontTests.swift @@ -10,16 +10,8 @@ final class AlertViewControllerDynamicTypeFontTests: SnapshotTestCase { accepted: {}, declined: {} )) - assertSnapshot( - matching: alert, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: alert, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + alert.assertSnapshot(as: .extra3LargeFont, in: .portrait) + alert.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_mediaUpgradeOffer_extra3Large() { @@ -28,16 +20,8 @@ final class AlertViewControllerDynamicTypeFontTests: SnapshotTestCase { accepted: {}, declined: {} )) - assertSnapshot( - matching: alert, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: alert, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + alert.assertSnapshot(as: .extra3LargeFont, in: .portrait) + alert.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_messageAlert_extra3Large() { @@ -46,16 +30,8 @@ final class AlertViewControllerDynamicTypeFontTests: SnapshotTestCase { accessibilityIdentifier: nil, dismissed: {} )) - assertSnapshot( - matching: alert, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: alert, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + alert.assertSnapshot(as: .extra3LargeFont, in: .portrait) + alert.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_singleAction_extra3Large() { @@ -64,16 +40,8 @@ final class AlertViewControllerDynamicTypeFontTests: SnapshotTestCase { accessibilityIdentifier: "mocked-accessibility-identifier", actionTapped: {} )) - assertSnapshot( - matching: alert, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: alert, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + alert.assertSnapshot(as: .extra3LargeFont, in: .portrait) + alert.assertSnapshot(as: .extra3LargeFont, in: .landscape) } private func alert(ofKind kind: AlertViewController.Kind) -> AlertViewController { @@ -81,7 +49,6 @@ final class AlertViewControllerDynamicTypeFontTests: SnapshotTestCase { kind: kind, viewFactory: .mock() ) - viewController.view.frame = UIScreen.main.bounds return viewController } } diff --git a/SnapshotTests/AlertViewControllerLayoutTests.swift b/SnapshotTests/AlertViewControllerLayoutTests.swift index 390a08cc2..683507736 100644 --- a/SnapshotTests/AlertViewControllerLayoutTests.swift +++ b/SnapshotTests/AlertViewControllerLayoutTests.swift @@ -9,16 +9,8 @@ final class AlertViewControllerLayoutTests: SnapshotTestCase { accepted: {}, declined: {} )) - assertSnapshot( - matching: alert, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: alert, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + alert.assertSnapshot(as: .image, in: .portrait) + alert.assertSnapshot(as: .image, in: .landscape) } func test_mediaUpgradeOffer() { @@ -27,16 +19,8 @@ final class AlertViewControllerLayoutTests: SnapshotTestCase { accepted: {}, declined: {} )) - assertSnapshot( - matching: alert, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: alert, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + alert.assertSnapshot(as: .image, in: .portrait) + alert.assertSnapshot(as: .image, in: .landscape) } func test_messageAlert() { @@ -45,16 +29,8 @@ final class AlertViewControllerLayoutTests: SnapshotTestCase { accessibilityIdentifier: nil, dismissed: {} )) - assertSnapshot( - matching: alert, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: alert, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + alert.assertSnapshot(as: .image, in: .portrait) + alert.assertSnapshot(as: .image, in: .landscape) } func test_singleAction() { @@ -63,16 +39,8 @@ final class AlertViewControllerLayoutTests: SnapshotTestCase { accessibilityIdentifier: "mocked-accessibility-identifier", actionTapped: {} )) - assertSnapshot( - matching: alert, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: alert, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + alert.assertSnapshot(as: .image, in: .portrait) + alert.assertSnapshot(as: .image, in: .landscape) } private func alert(ofKind kind: AlertViewController.Kind) -> AlertViewController { @@ -80,7 +48,6 @@ final class AlertViewControllerLayoutTests: SnapshotTestCase { kind: kind, viewFactory: .mock() ) - viewController.view.frame = UIScreen.main.bounds return viewController } } diff --git a/SnapshotTests/AlertViewControllerTests.swift b/SnapshotTests/AlertViewControllerVoiceOverTests.swift similarity index 58% rename from SnapshotTests/AlertViewControllerTests.swift rename to SnapshotTests/AlertViewControllerVoiceOverTests.swift index 0522cb041..c39ae40fe 100644 --- a/SnapshotTests/AlertViewControllerTests.swift +++ b/SnapshotTests/AlertViewControllerVoiceOverTests.swift @@ -3,18 +3,14 @@ import AccessibilitySnapshot import SnapshotTesting import XCTest -final class AlertViewControllerTests: SnapshotTestCase { +final class AlertViewControllerVoiceOverTests: SnapshotTestCase { func test_screenSharingOffer() { let alert = alert(ofKind: .screenShareOffer( .mock(), accepted: {}, declined: {} )) - assertSnapshot( - matching: alert, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + alert.assertSnapshot(as: .accessibilityImage) } func test_mediaUpgradeOffer() { @@ -23,11 +19,7 @@ final class AlertViewControllerTests: SnapshotTestCase { accepted: {}, declined: {} )) - assertSnapshot( - matching: alert, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + alert.assertSnapshot(as: .accessibilityImage) } func test_messageAlert() { @@ -36,11 +28,7 @@ final class AlertViewControllerTests: SnapshotTestCase { accessibilityIdentifier: nil, dismissed: {} )) - assertSnapshot( - matching: alert, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + alert.assertSnapshot(as: .accessibilityImage) } func test_singleAction() { @@ -49,11 +37,7 @@ final class AlertViewControllerTests: SnapshotTestCase { accessibilityIdentifier: "mocked-accessibility-identifier", actionTapped: {} )) - assertSnapshot( - matching: alert, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + alert.assertSnapshot(as: .accessibilityImage) } private func alert(ofKind kind: AlertViewController.Kind) -> AlertViewController { @@ -61,7 +45,6 @@ final class AlertViewControllerTests: SnapshotTestCase { kind: kind, viewFactory: .mock() ) - viewController.view.frame = UIScreen.main.bounds return viewController } } diff --git a/SnapshotTests/BubbleViewDynamicTypeFontTests.swift b/SnapshotTests/BubbleViewDynamicTypeFontTests.swift index e3f65d375..89bfab933 100644 --- a/SnapshotTests/BubbleViewDynamicTypeFontTests.swift +++ b/SnapshotTests/BubbleViewDynamicTypeFontTests.swift @@ -7,14 +7,7 @@ final class BubbleViewDynamicTypeFontTests: SnapshotTestCase { func test_bubble_extra3Large() { let bubble = ViewFactory.mock().makeBubbleView() bubble.frame = .init(origin: .zero, size: .init(width: 50, height: 50)) - assertSnapshot( - matching: bubble, - as: .extra3LargeFontStrategy - ) - assertSnapshot( - matching: bubble, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + bubble.assertSnapshot(as: .extra3LargeFont, in: .portrait) + bubble.assertSnapshot(as: .extra3LargeFont, in: .landscape) } } diff --git a/SnapshotTests/BubbleViewLayoutTests.swift b/SnapshotTests/BubbleViewLayoutTests.swift index d3237b534..d18734882 100644 --- a/SnapshotTests/BubbleViewLayoutTests.swift +++ b/SnapshotTests/BubbleViewLayoutTests.swift @@ -6,14 +6,7 @@ final class BubbleViewLayoutTests: SnapshotTestCase { func test_bubble() { let bubble = ViewFactory.mock().makeBubbleView() bubble.frame = .init(origin: .zero, size: .init(width: 50, height: 50)) - assertSnapshot( - matching: bubble, - as: .image - ) - assertSnapshot( - matching: bubble, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + bubble.assertSnapshot(as: .image, in: .portrait) + bubble.assertSnapshot(as: .image, in: .landscape) } } diff --git a/SnapshotTests/BubbleViewVoiceOverTests.swift b/SnapshotTests/BubbleViewVoiceOverTests.swift index 6214c5e43..9bda941f6 100644 --- a/SnapshotTests/BubbleViewVoiceOverTests.swift +++ b/SnapshotTests/BubbleViewVoiceOverTests.swift @@ -7,6 +7,6 @@ final class BubbleViewVoiceOverTests: SnapshotTestCase { func test_bubble() { let bubble = ViewFactory.mock().makeBubbleView() bubble.frame = .init(origin: .zero, size: .init(width: 50, height: 50)) - assertSnapshot(matching: bubble, as: .accessibilityImage(precision: SnapshotTestCase.possiblePrecision)) + bubble.assertSnapshot(as: .accessibilityImage) } } diff --git a/SnapshotTests/BubbleWindowLayoutTests.swift b/SnapshotTests/BubbleWindowLayoutTests.swift index fc827cc23..5640e3413 100644 --- a/SnapshotTests/BubbleWindowLayoutTests.swift +++ b/SnapshotTests/BubbleWindowLayoutTests.swift @@ -14,6 +14,7 @@ final class BubbleWindowLayoutTests: XCTestCase { ) ) bubbleWindow.makeKeyAndVisible() - assertSnapshot(matching: bubbleWindow, as: .image) + bubbleWindow.assertSnapshot(as: .image, in: .portrait) + bubbleWindow.assertSnapshot(as: .image, in: .landscape) } } diff --git a/SnapshotTests/CallViewControllerDynamicTypeFontTests.swift b/SnapshotTests/CallViewControllerDynamicTypeFontTests.swift index 6498c88ea..7d3dbcd41 100644 --- a/SnapshotTests/CallViewControllerDynamicTypeFontTests.swift +++ b/SnapshotTests/CallViewControllerDynamicTypeFontTests.swift @@ -5,91 +5,37 @@ import XCTest final class CallViewControllerDynamicTypeFontTests: SnapshotTestCase { func test_audioCallQueueState_extra3Large() throws { let viewController = try CallViewController.mockAudioCallQueueState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_audioCallConnectingState_extra3Large() throws { let viewController = try CallViewController.mockAudioCallConnectingState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_audioCallConnectedState_extra3Large() throws { let viewController = try CallViewController.mockAudioCallConnectedState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_mockVideoCallConnectingState_extra3Large() throws { let viewController = try CallViewController.mockVideoCallConnectingState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_mockVideoCallQueueState_extra3Large() throws { let viewController = try CallViewController.mockVideoCallQueueState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_mockVideoCallConnectedState_extra3Large() throws { let viewController = try CallViewController.mockVideoCallConnectedState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } } diff --git a/SnapshotTests/CallViewControllerLayoutTests.swift b/SnapshotTests/CallViewControllerLayoutTests.swift index 7ad4f789a..922f102d0 100644 --- a/SnapshotTests/CallViewControllerLayoutTests.swift +++ b/SnapshotTests/CallViewControllerLayoutTests.swift @@ -5,91 +5,37 @@ import XCTest final class CallViewControllerLayoutTests: SnapshotTestCase { func test_audioCallQueueState() throws { let viewController = try CallViewController.mockAudioCallQueueState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_audioCallConnectingState() throws { let viewController = try CallViewController.mockAudioCallConnectingState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_audioCallConnectedState() throws { let viewController = try CallViewController.mockAudioCallConnectedState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_mockVideoCallConnectingState() throws { let viewController = try CallViewController.mockVideoCallConnectingState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_mockVideoCallQueueState() throws { let viewController = try CallViewController.mockVideoCallQueueState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_mockVideoCallConnectedState() throws { let viewController = try CallViewController.mockVideoCallConnectedState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } } diff --git a/SnapshotTests/CallViewControllerVoiceOverTests.swift b/SnapshotTests/CallViewControllerVoiceOverTests.swift index e6a365781..2fab3b6ad 100644 --- a/SnapshotTests/CallViewControllerVoiceOverTests.swift +++ b/SnapshotTests/CallViewControllerVoiceOverTests.swift @@ -6,61 +6,31 @@ import XCTest final class CallViewControllerVoiceOverTests: SnapshotTestCase { func test_audioCallQueueState() throws { let viewController = try CallViewController.mockAudioCallQueueState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_audioCallConnectingState() throws { let viewController = try CallViewController.mockAudioCallConnectingState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_audioCallConnectedState() throws { let viewController = try CallViewController.mockAudioCallConnectedState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_mockVideoCallConnectingState() throws { let viewController = try CallViewController.mockVideoCallConnectingState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_mockVideoCallQueueState() throws { let viewController = try CallViewController.mockVideoCallQueueState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_mockVideoCallConnectedState() throws { let viewController = try CallViewController.mockVideoCallConnectedState() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } } diff --git a/SnapshotTests/ChatCallUpgradeViewDynamicTypeFontTests.swift b/SnapshotTests/ChatCallUpgradeViewDynamicTypeFontTests.swift index 295477e13..e968e7125 100644 --- a/SnapshotTests/ChatCallUpgradeViewDynamicTypeFontTests.swift +++ b/SnapshotTests/ChatCallUpgradeViewDynamicTypeFontTests.swift @@ -6,28 +6,14 @@ final class ChatCallUpgradeViewDynamicTypeFontTests: SnapshotTestCase { func test_chatCallUpgradeViewToAudio_extra3Large() { let upgradeView = ChatCallUpgradeView(with: Theme.mock().chat.audioUpgrade, duration: .init(with: .zero)) upgradeView.frame = .init(origin: .zero, size: .init(width: 300, height: 160)) - assertSnapshot( - matching: upgradeView, - as: .extra3LargeFontStrategy - ) - assertSnapshot( - matching: upgradeView, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + upgradeView.assertSnapshot(as: .extra3LargeFont, in: .portrait) + upgradeView.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_chatCallUpgradeViewToVideo_extra3Large() { let upgradeView = ChatCallUpgradeView(with: Theme.mock().chat.videoUpgrade, duration: .init(with: .zero)) upgradeView.frame = .init(origin: .zero, size: .init(width: 300, height: 160)) - assertSnapshot( - matching: upgradeView, - as: .extra3LargeFontStrategy - ) - assertSnapshot( - matching: upgradeView, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + upgradeView.assertSnapshot(as: .extra3LargeFont, in: .portrait) + upgradeView.assertSnapshot(as: .extra3LargeFont, in: .landscape) } } diff --git a/SnapshotTests/ChatCallUpgradeViewLayoutTests.swift b/SnapshotTests/ChatCallUpgradeViewLayoutTests.swift index da552c62b..161d4a1ff 100644 --- a/SnapshotTests/ChatCallUpgradeViewLayoutTests.swift +++ b/SnapshotTests/ChatCallUpgradeViewLayoutTests.swift @@ -6,28 +6,14 @@ final class ChatCallUpgradeViewLayoutTests: SnapshotTestCase { func test_chatCallUpgradeViewToAudio() { let upgradeView = ChatCallUpgradeView(with: Theme.mock().chat.audioUpgrade, duration: .init(with: .zero)) upgradeView.frame = .init(origin: .zero, size: .init(width: 300, height: 120)) - assertSnapshot( - matching: upgradeView, - as: .image - ) - assertSnapshot( - matching: upgradeView, - as: .image, - named: nameForDevice(.landscape) - ) + upgradeView.assertSnapshot(as: .image, in: .portrait) + upgradeView.assertSnapshot(as: .image, in: .landscape) } func test_chatCallUpgradeViewToVideo() { let upgradeView = ChatCallUpgradeView(with: Theme.mock().chat.videoUpgrade, duration: .init(with: .zero)) upgradeView.frame = .init(origin: .zero, size: .init(width: 300, height: 120)) - assertSnapshot( - matching: upgradeView, - as: .image - ) - assertSnapshot( - matching: upgradeView, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + upgradeView.assertSnapshot(as: .image, in: .portrait) + upgradeView.assertSnapshot(as: .image, in: .landscape) } } diff --git a/SnapshotTests/ChatCallUpgradeViewVoiceOverTests.swift b/SnapshotTests/ChatCallUpgradeViewVoiceOverTests.swift index 5dd76d736..e7a74981d 100644 --- a/SnapshotTests/ChatCallUpgradeViewVoiceOverTests.swift +++ b/SnapshotTests/ChatCallUpgradeViewVoiceOverTests.swift @@ -7,18 +7,12 @@ final class ChatCallUpgradeViewVoiceOverTests: SnapshotTestCase { func test_chatCallUpgradeViewToAudio() { let upgradeView = ChatCallUpgradeView(with: Theme.mock().chat.audioUpgrade, duration: .init(with: .zero)) upgradeView.frame = .init(origin: .zero, size: .init(width: 300, height: 120)) - assertSnapshot( - matching: upgradeView, - as: .accessibilityImage(precision: SnapshotTestCase.possiblePrecision) - ) + upgradeView.assertSnapshot(as: .accessibilityImage) } func test_chatCallUpgradeViewToVideo() { let upgradeView = ChatCallUpgradeView(with: Theme.mock().chat.videoUpgrade, duration: .init(with: .zero)) upgradeView.frame = .init(origin: .zero, size: .init(width: 300, height: 120)) - assertSnapshot( - matching: upgradeView, - as: .accessibilityImage(precision: SnapshotTestCase.possiblePrecision) - ) + upgradeView.assertSnapshot(as: .accessibilityImage) } } diff --git a/SnapshotTests/ChatViewControllerDynamicTypeFontTests.swift b/SnapshotTests/ChatViewControllerDynamicTypeFontTests.swift index c694b1d81..62b3b34b4 100644 --- a/SnapshotTests/ChatViewControllerDynamicTypeFontTests.swift +++ b/SnapshotTests/ChatViewControllerDynamicTypeFontTests.swift @@ -5,47 +5,20 @@ import XCTest final class ChatViewControllerDynamicTypeFontTests: SnapshotTestCase { func test_messagesFromHistory_extra3Large() { let viewController = ChatViewController.mockHistoryMessagesScreen() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_visitorUploadedFileStates_extra3Large() throws { let viewController = try ChatViewController.mockVisitorFileUploadStates() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_choiceCard_extra3Large() throws { let viewController = try ChatViewController.mockChoiceCard() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_visitorFileDownloadStates_extra3Large() throws { @@ -61,15 +34,7 @@ final class ChatViewControllerDynamicTypeFontTests: SnapshotTestCase { chatMessages[1].downloads[0].state.value = .downloading(progress: .init(with: 0.5)) chatMessages[2].downloads[0].state.value = .downloaded(.mock()) chatMessages[3].downloads[0].state.value = .error(.deleted) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } } diff --git a/SnapshotTests/ChatViewControllerLayoutTests.swift b/SnapshotTests/ChatViewControllerLayoutTests.swift index cfb016713..10480549a 100644 --- a/SnapshotTests/ChatViewControllerLayoutTests.swift +++ b/SnapshotTests/ChatViewControllerLayoutTests.swift @@ -5,92 +5,38 @@ import XCTest final class ChatViewControllerLayoutTests: SnapshotTestCase { func test_messagesFromHistory() { let viewController = ChatViewController.mockHistoryMessagesScreen() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_visitorUploadedFileStates() throws { let viewController = try ChatViewController.mockVisitorFileUploadStates() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_choiceCard() throws { let viewController = try ChatViewController.mockChoiceCard() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_gvaPersistentButton() throws { let viewController = try ChatViewController.mockGvaPersistentButton() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_gvaResponseText() throws { let viewController = try ChatViewController.mockGvaResponseText() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_gvaGalleryCard() throws { let viewController = try ChatViewController.mockGvaGalleryCards() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_gvaQuickReply() throws { @@ -106,16 +52,8 @@ final class ChatViewControllerLayoutTests: SnapshotTestCase { ) view.frame = .init(origin: .zero, size: .init(width: 350, height: 200)) view.collectionView.heightAnchor.constraint(equalToConstant: 200).isActive = true - assertSnapshot( - matching: view, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: view, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + view.assertSnapshot(as: .image, in: .portrait) + view.assertSnapshot(as: .image, in: .landscape) } func test_visitorFileDownloadStates() throws { @@ -131,15 +69,7 @@ final class ChatViewControllerLayoutTests: SnapshotTestCase { chatMessages[1].downloads[0].state.value = .downloading(progress: .init(with: 0.5)) chatMessages[2].downloads[0].state.value = .downloaded(.mock()) chatMessages[3].downloads[0].state.value = .error(.deleted) - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } } diff --git a/SnapshotTests/ChatViewControllerVoiceOverTests.swift b/SnapshotTests/ChatViewControllerVoiceOverTests.swift index 40fa87f20..c08c7a92a 100644 --- a/SnapshotTests/ChatViewControllerVoiceOverTests.swift +++ b/SnapshotTests/ChatViewControllerVoiceOverTests.swift @@ -6,32 +6,17 @@ import XCTest final class ChatViewControllerVoiceOverTests: SnapshotTestCase { func test_messagesFromHistory() { let viewController = ChatViewController.mockHistoryMessagesScreen() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_visitorUploadedFileStates() throws { let viewController = try ChatViewController.mockVisitorFileUploadStates() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_choiceCard() throws { let viewController = try ChatViewController.mockChoiceCard() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_visitorFileDownloadStates() throws { @@ -47,41 +32,22 @@ final class ChatViewControllerVoiceOverTests: SnapshotTestCase { chatMessages[1].downloads[0].state.value = .downloading(progress: .init(with: 0.5)) chatMessages[2].downloads[0].state.value = .downloaded(.mock()) chatMessages[3].downloads[0].state.value = .error(.deleted) - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: self.nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_gvaPersistentButton() throws { let viewController = try ChatViewController.mockGvaPersistentButton() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_gvaResponseText() throws { let viewController = try ChatViewController.mockGvaResponseText() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_gvaGalleryCard() throws { let viewController = try ChatViewController.mockGvaGalleryCards() - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_gvaQuickReply() throws { @@ -97,10 +63,6 @@ final class ChatViewControllerVoiceOverTests: SnapshotTestCase { ) view.frame = .init(origin: .zero, size: .init(width: 350, height: 200)) view.collectionView.heightAnchor.constraint(equalToConstant: 200).isActive = true - assertSnapshot( - matching: view, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: self.nameForDevice() - ) + view.assertSnapshot(as: .accessibilityImage) } } diff --git a/SnapshotTests/ScreenShareViewControllerDynamicTypeFontTests.swift b/SnapshotTests/ScreenShareViewControllerDynamicTypeFontTests.swift index 88ebc2db7..4ffcbab25 100644 --- a/SnapshotTests/ScreenShareViewControllerDynamicTypeFontTests.swift +++ b/SnapshotTests/ScreenShareViewControllerDynamicTypeFontTests.swift @@ -21,18 +21,8 @@ final class ScreenShareViewControllerDynamicTypeFontTests: SnapshotTestCase { ) ) let screenShareViewController = CallVisualizer.ScreenSharingViewController(props: props) - screenShareViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: screenShareViewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: screenShareViewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + screenShareViewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + screenShareViewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } } // swiftlint:enable type_name diff --git a/SnapshotTests/ScreenShareViewControllerLayoutTests.swift b/SnapshotTests/ScreenShareViewControllerLayoutTests.swift index 857fe9128..dd64fab18 100644 --- a/SnapshotTests/ScreenShareViewControllerLayoutTests.swift +++ b/SnapshotTests/ScreenShareViewControllerLayoutTests.swift @@ -20,17 +20,7 @@ final class ScreenShareViewControllerLayoutTests: SnapshotTestCase { ) ) let screenShareViewController = CallVisualizer.ScreenSharingViewController(props: props) - screenShareViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: screenShareViewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: screenShareViewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + screenShareViewController.assertSnapshot(as: .image, in: .portrait) + screenShareViewController.assertSnapshot(as: .image, in: .landscape) } } diff --git a/SnapshotTests/ScreenShareViewControllerTests.swift b/SnapshotTests/ScreenShareViewControllerVoiceOverTests.swift similarity index 73% rename from SnapshotTests/ScreenShareViewControllerTests.swift rename to SnapshotTests/ScreenShareViewControllerVoiceOverTests.swift index 319343539..5ca81ba33 100644 --- a/SnapshotTests/ScreenShareViewControllerTests.swift +++ b/SnapshotTests/ScreenShareViewControllerVoiceOverTests.swift @@ -3,7 +3,7 @@ import AccessibilitySnapshot import SnapshotTesting import XCTest -final class ScreenShareViewControllerTests: SnapshotTestCase { +final class ScreenShareViewControllerVoiceOverTests: SnapshotTestCase { func testScreenShareViewController() { let theme = Theme() let font = theme.font @@ -21,12 +21,6 @@ final class ScreenShareViewControllerTests: SnapshotTestCase { ) ) let screenShareViewController = CallVisualizer.ScreenSharingViewController(props: props) - screenShareViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: screenShareViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + screenShareViewController.assertSnapshot(as: .accessibilityImage) } } diff --git a/SnapshotTests/SecureConversationsConfirmationScreenDynamicTypeFontTests.swift b/SnapshotTests/SecureConversationsConfirmationScreenDynamicTypeFontTests.swift index a81d37442..9f11b5123 100644 --- a/SnapshotTests/SecureConversationsConfirmationScreenDynamicTypeFontTests.swift +++ b/SnapshotTests/SecureConversationsConfirmationScreenDynamicTypeFontTests.swift @@ -15,18 +15,8 @@ final class SecureConversationsConfirmationScreenDynamicTypeFontTests: SnapshotT delegate: nil ) let viewController = SecureConversations.ConfirmationViewController(model: model) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController.view, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } } // swiftlint:enable type_name diff --git a/SnapshotTests/SecureConversationsConfirmationScreenLayoutTests.swift b/SnapshotTests/SecureConversationsConfirmationScreenLayoutTests.swift index 87c7ac6db..2fef40481 100644 --- a/SnapshotTests/SecureConversationsConfirmationScreenLayoutTests.swift +++ b/SnapshotTests/SecureConversationsConfirmationScreenLayoutTests.swift @@ -14,17 +14,7 @@ final class SecureConversationsConfirmationScreenLayoutTests: SnapshotTestCase { delegate: nil ) let viewController = SecureConversations.ConfirmationViewController(model: model) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } } diff --git a/SnapshotTests/SecureConversationsConfirmationScreenTests.swift b/SnapshotTests/SecureConversationsConfirmationScreenVoiceOverTests.swift similarity index 63% rename from SnapshotTests/SecureConversationsConfirmationScreenTests.swift rename to SnapshotTests/SecureConversationsConfirmationScreenVoiceOverTests.swift index 2a144d8b3..577760d73 100644 --- a/SnapshotTests/SecureConversationsConfirmationScreenTests.swift +++ b/SnapshotTests/SecureConversationsConfirmationScreenVoiceOverTests.swift @@ -3,7 +3,7 @@ import AccessibilitySnapshot import SnapshotTesting import XCTest -final class SecureConversationsConfirmationScreenTests: SnapshotTestCase { +final class SecureConversationsConfirmationScreenVoiceOverTests: SnapshotTestCase { let theme = Theme.mock() func test_confirmationView() { @@ -15,12 +15,6 @@ final class SecureConversationsConfirmationScreenTests: SnapshotTestCase { delegate: nil ) let viewController = SecureConversations.ConfirmationViewController(model: model) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: self.nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } } diff --git a/SnapshotTests/SecureConversationsWelcomeScreenDynamicTypeFontTests.swift b/SnapshotTests/SecureConversationsWelcomeScreenDynamicTypeFontTests.swift index 59f707f78..2c693f8db 100644 --- a/SnapshotTests/SecureConversationsWelcomeScreenDynamicTypeFontTests.swift +++ b/SnapshotTests/SecureConversationsWelcomeScreenDynamicTypeFontTests.swift @@ -16,18 +16,8 @@ final class SecureConversationsWelcomeScreenDynamicTypeFontTests: SnapshotTestCa props: .welcome(props), environment: .init(gcd: .live, uiScreen: .mock, notificationCenter: .mock) ) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController.view, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_welcomeWithAttachments_extra3Large() { @@ -43,18 +33,8 @@ final class SecureConversationsWelcomeScreenDynamicTypeFontTests: SnapshotTestCa props: .welcome(props), environment: .init(gcd: .live, uiScreen: .mock, notificationCenter: .mock) ) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController.view, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_welcomeViewController_withValidationError_extra3Large() { @@ -64,18 +44,8 @@ final class SecureConversationsWelcomeScreenDynamicTypeFontTests: SnapshotTestCa props: .welcome(props), environment: .init(gcd: .live, uiScreen: .mock, notificationCenter: .mock) ) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController.view, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } // MARK: - Helpers diff --git a/SnapshotTests/SecureConversationsWelcomeScreenLayoutTests.swift b/SnapshotTests/SecureConversationsWelcomeScreenLayoutTests.swift index 6c3d40a32..3ad2d23c5 100644 --- a/SnapshotTests/SecureConversationsWelcomeScreenLayoutTests.swift +++ b/SnapshotTests/SecureConversationsWelcomeScreenLayoutTests.swift @@ -15,18 +15,8 @@ final class SecureConversationsWelcomeScreenLayoutTests: SnapshotTestCase { props: .welcome(props), environment: .init(gcd: .live, uiScreen: .mock, notificationCenter: .mock) ) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController.view, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_welcomeWithAttachments() { @@ -42,18 +32,8 @@ final class SecureConversationsWelcomeScreenLayoutTests: SnapshotTestCase { props: .welcome(props), environment: .init(gcd: .live, uiScreen: .mock, notificationCenter: .mock) ) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController.view, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_welcomeViewController_withValidationError() { @@ -63,18 +43,8 @@ final class SecureConversationsWelcomeScreenLayoutTests: SnapshotTestCase { props: .welcome(props), environment: .init(gcd: .live, uiScreen: .mock, notificationCenter: .mock) ) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController.view, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } // MARK: - Helpers diff --git a/SnapshotTests/SecureConversationsWelcomeScreenTests.swift b/SnapshotTests/SecureConversationsWelcomeScreenVoiceOverTests.swift similarity index 82% rename from SnapshotTests/SecureConversationsWelcomeScreenTests.swift rename to SnapshotTests/SecureConversationsWelcomeScreenVoiceOverTests.swift index 4d97ae2c6..0461fe44b 100644 --- a/SnapshotTests/SecureConversationsWelcomeScreenTests.swift +++ b/SnapshotTests/SecureConversationsWelcomeScreenVoiceOverTests.swift @@ -3,7 +3,7 @@ import AccessibilitySnapshot import SnapshotTesting import XCTest -final class SecureConversationsWelcomeScreenTests: SnapshotTestCase { +final class SecureConversationsWelcomeScreenVoiceOverTests: SnapshotTestCase { let theme = Theme.mock() func test_welcomeView() { @@ -16,13 +16,7 @@ final class SecureConversationsWelcomeScreenTests: SnapshotTestCase { props: .welcome(props), environment: .init(gcd: .live, uiScreen: .mock, notificationCenter: .mock) ) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: self.nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_welcomeWithAttachments() { @@ -38,13 +32,7 @@ final class SecureConversationsWelcomeScreenTests: SnapshotTestCase { props: .welcome(props), environment: .init(gcd: .live, uiScreen: .mock, notificationCenter: .mock) ) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: self.nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_welcomeViewController_withValidationError() { @@ -54,13 +42,7 @@ final class SecureConversationsWelcomeScreenTests: SnapshotTestCase { props: .welcome(props), environment: .init(gcd: .live, uiScreen: .mock, notificationCenter: .mock) ) - viewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: viewController.view, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: self.nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } // MARK: - Helpers diff --git a/SnapshotTests/SurveyViewControllerDynamicTypeFontTests.swift b/SnapshotTests/SurveyViewControllerDynamicTypeFontTests.swift index 37f98c751..0ff909f11 100644 --- a/SnapshotTests/SurveyViewControllerDynamicTypeFontTests.swift +++ b/SnapshotTests/SurveyViewControllerDynamicTypeFontTests.swift @@ -9,17 +9,8 @@ final class SurveyViewControllerDynamicTypeFontTests: SnapshotTestCase { environment: .init(notificationCenter: .mock), props: .emptyPropsMock() ) - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_filledSurvey_extra3Large() { @@ -28,17 +19,8 @@ final class SurveyViewControllerDynamicTypeFontTests: SnapshotTestCase { environment: .init(notificationCenter: .mock), props: .filledPropsMock() ) - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func test_emptySurveyErrorState_extra3Large() { @@ -47,16 +29,7 @@ final class SurveyViewControllerDynamicTypeFontTests: SnapshotTestCase { environment: .init(notificationCenter: .mock), props: .errorPropsMock() ) - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } } diff --git a/SnapshotTests/SurveyViewControllerLayoutTests.swift b/SnapshotTests/SurveyViewControllerLayoutTests.swift index 23961a2c2..58f85c817 100644 --- a/SnapshotTests/SurveyViewControllerLayoutTests.swift +++ b/SnapshotTests/SurveyViewControllerLayoutTests.swift @@ -9,17 +9,8 @@ final class SurveyViewControllerLayoutTests: SnapshotTestCase { environment: .init(notificationCenter: .mock), props: .emptyPropsMock() ) - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_filledSurvey() { @@ -28,17 +19,8 @@ final class SurveyViewControllerLayoutTests: SnapshotTestCase { environment: .init(notificationCenter: .mock), props: .filledPropsMock() ) - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func test_emptySurveyErrorState() { @@ -47,16 +29,7 @@ final class SurveyViewControllerLayoutTests: SnapshotTestCase { environment: .init(notificationCenter: .mock), props: .errorPropsMock() ) - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: viewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } } diff --git a/SnapshotTests/SurveyViewControllerVoiceOverTests.swift b/SnapshotTests/SurveyViewControllerVoiceOverTests.swift index 4d06d1def..1a41f6403 100644 --- a/SnapshotTests/SurveyViewControllerVoiceOverTests.swift +++ b/SnapshotTests/SurveyViewControllerVoiceOverTests.swift @@ -10,12 +10,7 @@ final class SurveyViewControllerVoiceOverTests: SnapshotTestCase { environment: .init(notificationCenter: .mock), props: .emptyPropsMock() ) - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_filledSurvey() { @@ -24,12 +19,7 @@ final class SurveyViewControllerVoiceOverTests: SnapshotTestCase { environment: .init(notificationCenter: .mock), props: .filledPropsMock() ) - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } func test_emptySurveyErrorState() { @@ -38,11 +28,6 @@ final class SurveyViewControllerVoiceOverTests: SnapshotTestCase { environment: .init(notificationCenter: .mock), props: .errorPropsMock() ) - viewController.view.frame = UIScreen.main.bounds - assertSnapshot( - matching: viewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + viewController.assertSnapshot(as: .accessibilityImage) } } diff --git a/SnapshotTests/VideoCallViewControllerDynamicTypeFontTests.swift b/SnapshotTests/VideoCallViewControllerDynamicTypeFontTests.swift index aa0b8b9bc..cf0b80b3e 100644 --- a/SnapshotTests/VideoCallViewControllerDynamicTypeFontTests.swift +++ b/SnapshotTests/VideoCallViewControllerDynamicTypeFontTests.swift @@ -48,19 +48,9 @@ final class VideoCallViewControllerDynamicTypeFontTests: SnapshotTestCase { ) let props: CallVisualizer.VideoCallViewController.Props = .init(videoCallViewProps: videoCallViewProps) - let videoCallViewController: CallVisualizer.VideoCallViewController = .mock(props: props) - videoCallViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: videoCallViewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: videoCallViewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + let viewController: CallVisualizer.VideoCallViewController = .mock(props: props) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } } // swiftlint:enable type_name diff --git a/SnapshotTests/VideoCallViewControllerLayoutTests.swift b/SnapshotTests/VideoCallViewControllerLayoutTests.swift index f49b05fda..387ed0249 100644 --- a/SnapshotTests/VideoCallViewControllerLayoutTests.swift +++ b/SnapshotTests/VideoCallViewControllerLayoutTests.swift @@ -47,18 +47,8 @@ final class VideoCallViewControllerLayoutTests: SnapshotTestCase { ) let props: CallVisualizer.VideoCallViewController.Props = .init(videoCallViewProps: videoCallViewProps) - let videoCallViewController: CallVisualizer.VideoCallViewController = .mock(props: props) - videoCallViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: videoCallViewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: videoCallViewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + let viewController: CallVisualizer.VideoCallViewController = .mock(props: props) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } } diff --git a/SnapshotTests/VideoCallViewControllerTests.swift b/SnapshotTests/VideoCallViewControllerVoiceOverTests.swift similarity index 84% rename from SnapshotTests/VideoCallViewControllerTests.swift rename to SnapshotTests/VideoCallViewControllerVoiceOverTests.swift index a0c19b532..a407f8d4b 100644 --- a/SnapshotTests/VideoCallViewControllerTests.swift +++ b/SnapshotTests/VideoCallViewControllerVoiceOverTests.swift @@ -3,7 +3,7 @@ import AccessibilitySnapshot import SnapshotTesting import XCTest -final class VideoCallViewControllerTests: SnapshotTestCase { +final class VideoCallViewControllerVoiceOverTests: SnapshotTestCase { func testVideoCallViewController() { let videoCallViewProps: CallVisualizer.VideoCallView.Props = .mock( buttonBarProps: .mock( @@ -48,13 +48,7 @@ final class VideoCallViewControllerTests: SnapshotTestCase { ) let props: CallVisualizer.VideoCallViewController.Props = .init(videoCallViewProps: videoCallViewProps) - let videoCallViewController: CallVisualizer.VideoCallViewController = .mock(props: props) - videoCallViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: videoCallViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) + let viewController: CallVisualizer.VideoCallViewController = .mock(props: props) + viewController.assertSnapshot(as: .accessibilityImage) } } diff --git a/SnapshotTests/VisitorCodeViewControllerDynamicTypeFontTests.swift b/SnapshotTests/VisitorCodeViewControllerDynamicTypeFontTests.swift index 14a1bcbe1..313fa03fa 100644 --- a/SnapshotTests/VisitorCodeViewControllerDynamicTypeFontTests.swift +++ b/SnapshotTests/VisitorCodeViewControllerDynamicTypeFontTests.swift @@ -11,19 +11,9 @@ final class VisitorCodeViewControllerDynamicTypeFontTests: SnapshotTestCase { viewState: .loading ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func testVisitorCodeAlertWhenError() { @@ -33,19 +23,9 @@ final class VisitorCodeViewControllerDynamicTypeFontTests: SnapshotTestCase { viewState: .error(refreshTap: .nop) ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func testVisitorCodeAlertWhenSuccess() { @@ -55,19 +35,9 @@ final class VisitorCodeViewControllerDynamicTypeFontTests: SnapshotTestCase { viewState: .success(visitorCode: "12345") ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func testVisitorCodeEmbeddedWhenLoading() { @@ -77,19 +47,9 @@ final class VisitorCodeViewControllerDynamicTypeFontTests: SnapshotTestCase { viewState: .loading ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func testVisitorCodeEmbeddedWhenError() { @@ -99,19 +59,9 @@ final class VisitorCodeViewControllerDynamicTypeFontTests: SnapshotTestCase { viewState: .error(refreshTap: .nop) ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } func testVisitorCodeEmbeddedWhenSuccess() { let props: CallVisualizer.VisitorCodeViewController.Props = .init( @@ -120,19 +70,9 @@ final class VisitorCodeViewControllerDynamicTypeFontTests: SnapshotTestCase { viewState: .success(visitorCode: "12345") ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategy, - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .extra3LargeFontStrategyLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .extra3LargeFont, in: .portrait) + viewController.assertSnapshot(as: .extra3LargeFont, in: .landscape) } } // swiftlint:enable type_name diff --git a/SnapshotTests/VisitorCodeViewControllerLayoutTests.swift b/SnapshotTests/VisitorCodeViewControllerLayoutTests.swift index 0ce24ebfa..08189628d 100644 --- a/SnapshotTests/VisitorCodeViewControllerLayoutTests.swift +++ b/SnapshotTests/VisitorCodeViewControllerLayoutTests.swift @@ -10,19 +10,9 @@ final class VisitorCodeViewControllerLayoutTests: SnapshotTestCase { viewState: .loading ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .image, - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func testVisitorCodeAlertWhenError() { @@ -32,19 +22,9 @@ final class VisitorCodeViewControllerLayoutTests: SnapshotTestCase { viewState: .error(refreshTap: .nop) ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func testVisitorCodeAlertWhenSuccess() { @@ -54,19 +34,9 @@ final class VisitorCodeViewControllerLayoutTests: SnapshotTestCase { viewState: .success(visitorCode: "12345") ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func testVisitorCodeEmbeddedWhenLoading() { @@ -76,19 +46,9 @@ final class VisitorCodeViewControllerLayoutTests: SnapshotTestCase { viewState: .loading ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func testVisitorCodeEmbeddedWhenError() { @@ -98,19 +58,9 @@ final class VisitorCodeViewControllerLayoutTests: SnapshotTestCase { viewState: .error(refreshTap: .nop) ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } func testVisitorCodeEmbeddedWhenSuccess() { let props: CallVisualizer.VisitorCodeViewController.Props = .init( @@ -119,18 +69,8 @@ final class VisitorCodeViewControllerLayoutTests: SnapshotTestCase { viewState: .success(visitorCode: "12345") ) ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - assertSnapshot( - matching: visitorCodeViewController, - as: .imageLandscape, - named: nameForDevice(.landscape) - ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .image, in: .portrait) + viewController.assertSnapshot(as: .image, in: .landscape) } } diff --git a/SnapshotTests/VisitorCodeViewControllerTests.swift b/SnapshotTests/VisitorCodeViewControllerTests.swift deleted file mode 100644 index da52ad845..000000000 --- a/SnapshotTests/VisitorCodeViewControllerTests.swift +++ /dev/null @@ -1,107 +0,0 @@ -import AccessibilitySnapshot -@testable import GliaWidgets -import SnapshotTesting -import XCTest - -final class VisitorCodeViewControllerTests: SnapshotTestCase { - func testVisitorCodeAlertWhenLoading() { - let props: CallVisualizer.VisitorCodeViewController.Props = .init( - visitorCodeViewProps: .init( - viewType: .alert(closeButtonTap: .nop), - viewState: .loading - ) - ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - } - - func testVisitorCodeAlertWhenError() { - let props: CallVisualizer.VisitorCodeViewController.Props = .init( - visitorCodeViewProps: .init( - viewType: .alert(closeButtonTap: .nop), - viewState: .error(refreshTap: .nop) - ) - ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - } - - func testVisitorCodeAlertWhenSuccess() { - let props: CallVisualizer.VisitorCodeViewController.Props = .init( - visitorCodeViewProps: .init( - viewType: .alert(closeButtonTap: .nop), - viewState: .success(visitorCode: "12345") - ) - ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - } - - func testVisitorCodeEmbeddedWhenLoading() { - let props: CallVisualizer.VisitorCodeViewController.Props = .init( - visitorCodeViewProps: .init( - viewType: .embedded, - viewState: .loading - ) - ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - } - - func testVisitorCodeEmbeddedWhenError() { - let props: CallVisualizer.VisitorCodeViewController.Props = .init( - visitorCodeViewProps: .init( - viewType: .embedded, - viewState: .error(refreshTap: .nop) - ) - ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - } - func testVisitorCodeEmbeddedWhenSuccess() { - let props: CallVisualizer.VisitorCodeViewController.Props = .init( - visitorCodeViewProps: .init( - viewType: .embedded, - viewState: .success(visitorCode: "12345") - ) - ) - let visitorCodeViewController = CallVisualizer.VisitorCodeViewController(props: props) - visitorCodeViewController.view.frame = UIScreen.main.bounds - - assertSnapshot( - matching: visitorCodeViewController, - as: .accessibilityImage(precision: Self.possiblePrecision), - named: nameForDevice() - ) - } -} diff --git a/SnapshotTests/VisitorCodeViewControllerVoiceOverTests.swift b/SnapshotTests/VisitorCodeViewControllerVoiceOverTests.swift new file mode 100644 index 000000000..8f8cbe0d1 --- /dev/null +++ b/SnapshotTests/VisitorCodeViewControllerVoiceOverTests.swift @@ -0,0 +1,71 @@ +import AccessibilitySnapshot +@testable import GliaWidgets +import SnapshotTesting +import XCTest + +final class VisitorCodeViewControllerVoiceOverTests: SnapshotTestCase { + func testVisitorCodeAlertWhenLoading() { + let props: CallVisualizer.VisitorCodeViewController.Props = .init( + visitorCodeViewProps: .init( + viewType: .alert(closeButtonTap: .nop), + viewState: .loading + ) + ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .accessibilityImage) + } + + func testVisitorCodeAlertWhenError() { + let props: CallVisualizer.VisitorCodeViewController.Props = .init( + visitorCodeViewProps: .init( + viewType: .alert(closeButtonTap: .nop), + viewState: .error(refreshTap: .nop) + ) + ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .accessibilityImage) + } + + func testVisitorCodeAlertWhenSuccess() { + let props: CallVisualizer.VisitorCodeViewController.Props = .init( + visitorCodeViewProps: .init( + viewType: .alert(closeButtonTap: .nop), + viewState: .success(visitorCode: "12345") + ) + ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .accessibilityImage) + } + + func testVisitorCodeEmbeddedWhenLoading() { + let props: CallVisualizer.VisitorCodeViewController.Props = .init( + visitorCodeViewProps: .init( + viewType: .embedded, + viewState: .loading + ) + ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .accessibilityImage) + } + + func testVisitorCodeEmbeddedWhenError() { + let props: CallVisualizer.VisitorCodeViewController.Props = .init( + visitorCodeViewProps: .init( + viewType: .embedded, + viewState: .error(refreshTap: .nop) + ) + ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .accessibilityImage) + } + func testVisitorCodeEmbeddedWhenSuccess() { + let props: CallVisualizer.VisitorCodeViewController.Props = .init( + visitorCodeViewProps: .init( + viewType: .embedded, + viewState: .success(visitorCode: "12345") + ) + ) + let viewController = CallVisualizer.VisitorCodeViewController(props: props) + viewController.assertSnapshot(as: .accessibilityImage) + } +} diff --git a/SnapshotTests/extensions/UIView+Extensions.swift b/SnapshotTests/extensions/UIView+Extensions.swift new file mode 100644 index 000000000..efc142e2b --- /dev/null +++ b/SnapshotTests/extensions/UIView+Extensions.swift @@ -0,0 +1,66 @@ +import UIKit +import SnapshotTesting + +extension UIView { + func assertSnapshot( + as mode: SnapshotMode, + in orientation: SnapshotOrientation = .portrait, + named name: String? = nil, + record recording: Bool = false, + file: StaticString = #file, + functionName: String = #function, + line: UInt = #line + ) { + let snapshotting: Snapshotting + switch mode { + case .accessibilityImage: + snapshotting = .accessibilityImage(precision: SnapshotTestCase.possiblePrecision) + case .image: + snapshotting = orientation == .portrait ? .image : .imageLandscape + case .extra3LargeFont: + snapshotting = orientation == .portrait ? .extra3LargeFontStrategy : .extra3LargeFontStrategyLandscape + } + let snapshotName = snapshotName(name, orientation: orientation) + SnapshotTesting.assertSnapshot( + matching: self, + as: snapshotting, + named: snapshotName, + record: recording, + file: file, + testName: functionName, + line: line + ) + } + + func snapshotName( + _ baseName: String? = nil, + orientation: SnapshotOrientation + ) -> String { + let size = UIScreen.main.bounds.size + let scale = UIScreen.main.scale + let version = UIDevice.current.systemVersion + let deviceName = "\(Int(size.width))x\(Int(size.height))-\(version)-\(Int(scale))x" + + switch orientation { + case .portrait: + return [baseName, deviceName] + .compactMap { $0 } + .joined(separator: "-") + case .landscape: + return [baseName, deviceName, "landscape"] + .compactMap { $0 } + .joined(separator: "-") + } + } + + enum SnapshotOrientation { + case portrait + case landscape + } + + enum SnapshotMode { + case accessibilityImage + case image + case extra3LargeFont + } +} diff --git a/SnapshotTests/extensions/UIViewController+Extensions.swift b/SnapshotTests/extensions/UIViewController+Extensions.swift new file mode 100644 index 000000000..c5c81f345 --- /dev/null +++ b/SnapshotTests/extensions/UIViewController+Extensions.swift @@ -0,0 +1,68 @@ +import UIKit +import SnapshotTesting + +extension UIViewController { + func assertSnapshot( + as mode: SnapshotMode, + in orientation: SnapshotOrientation = .portrait, + bounds: CGRect = UIScreen.main.bounds, + named name: String? = nil, + record recording: Bool = false, + file: StaticString = #file, + functionName: String = #function, + line: UInt = #line + ) { + self.view.bounds = bounds + let snapshotting: Snapshotting + switch mode { + case .accessibilityImage: + snapshotting = .accessibilityImage(precision: SnapshotTestCase.possiblePrecision) + case .image: + snapshotting = orientation == .portrait ? .image : .imageLandscape + case .extra3LargeFont: + snapshotting = orientation == .portrait ? .extra3LargeFontStrategy : .extra3LargeFontStrategyLandscape + } + let snapshotName = snapshotName(name, orientation: orientation) + SnapshotTesting.assertSnapshot( + matching: self, + as: snapshotting, + named: snapshotName, + record: recording, + file: file, + testName: functionName, + line: line + ) + } + + func snapshotName( + _ baseName: String? = nil, + orientation: SnapshotOrientation + ) -> String { + let size = UIScreen.main.bounds.size + let scale = UIScreen.main.scale + let version = UIDevice.current.systemVersion + let deviceName = "\(Int(size.width))x\(Int(size.height))-\(version)-\(Int(scale))x" + + switch orientation { + case .portrait: + return [baseName, deviceName] + .compactMap { $0 } + .joined(separator: "-") + case .landscape: + return [baseName, deviceName, "landscape"] + .compactMap { $0 } + .joined(separator: "-") + } + } + + enum SnapshotOrientation { + case portrait + case landscape + } + + enum SnapshotMode { + case accessibilityImage + case image + case extra3LargeFont + } +}