From 16557bb97dd84eb4df3e87d50f92c3f26b59b24c Mon Sep 17 00:00:00 2001 From: Igor Kravchenko Date: Wed, 26 Jul 2023 16:58:50 +0300 Subject: [PATCH] Add snapshot test for bubble window Ensure that BubbleView has correct layout in BubbleWindow after PureLayout removal. MOB-2348 --- GliaWidgets.xcodeproj/project.pbxproj | 4 ++++ SnapshotTests/BubbleWindowLayoutTests.swift | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 SnapshotTests/BubbleWindowLayoutTests.swift diff --git a/GliaWidgets.xcodeproj/project.pbxproj b/GliaWidgets.xcodeproj/project.pbxproj index 833397dc3..aeadec944 100644 --- a/GliaWidgets.xcodeproj/project.pbxproj +++ b/GliaWidgets.xcodeproj/project.pbxproj @@ -518,6 +518,7 @@ AF6AB34B2989517100003645 /* FileUploader.Failing.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF6AB34A2989517100003645 /* FileUploader.Failing.swift */; }; AF6AB34D298A9F2500003645 /* SecureConversations.FileUploadListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF6AB34C298A9F2500003645 /* SecureConversations.FileUploadListViewModel.swift */; }; AF6AB34F298AA02400003645 /* SecureConversations.FileUploadListViewModel.Environment.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF6AB34E298AA02400003645 /* SecureConversations.FileUploadListViewModel.Environment.swift */; }; + AF755FDA2A71583900871E36 /* BubbleWindowLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF755FD92A71583900871E36 /* BubbleWindowLayoutTests.swift */; }; AF9DB22E2890571A00A0C442 /* RootCoordinator.Environment.Failing.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF9DB22D2890571A00A0C442 /* RootCoordinator.Environment.Failing.swift */; }; AF9DB23128905A1D00A0C442 /* ViewFactory.Environment.Failing.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF9DB23028905A1D00A0C442 /* ViewFactory.Environment.Failing.swift */; }; AFA2FDEC28907D7C00428E6D /* EngagementCoordinator.Environment.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFA2FDEB28907D7C00428E6D /* EngagementCoordinator.Environment.swift */; }; @@ -1207,6 +1208,7 @@ AF6AB34A2989517100003645 /* FileUploader.Failing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileUploader.Failing.swift; sourceTree = ""; }; AF6AB34C298A9F2500003645 /* SecureConversations.FileUploadListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureConversations.FileUploadListViewModel.swift; sourceTree = ""; }; AF6AB34E298AA02400003645 /* SecureConversations.FileUploadListViewModel.Environment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureConversations.FileUploadListViewModel.Environment.swift; sourceTree = ""; }; + AF755FD92A71583900871E36 /* BubbleWindowLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BubbleWindowLayoutTests.swift; sourceTree = ""; }; AF9DB22D2890571A00A0C442 /* RootCoordinator.Environment.Failing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootCoordinator.Environment.Failing.swift; sourceTree = ""; }; AF9DB23028905A1D00A0C442 /* ViewFactory.Environment.Failing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewFactory.Environment.Failing.swift; sourceTree = ""; }; AFA2FDEB28907D7C00428E6D /* EngagementCoordinator.Environment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EngagementCoordinator.Environment.swift; sourceTree = ""; }; @@ -3175,6 +3177,7 @@ C07FA04E29B0E41A00E9FB7F /* VisitorCodeViewControllerTests.swift */, AF22C8982A61AE930004BF3C /* VisitorCodeViewControllerLayoutTests.swift */, AF03A7C22A6EDF490081887D /* VisitorCodeViewControllerDynamicTypeFontTests.swift */, + AF755FD92A71583900871E36 /* BubbleWindowLayoutTests.swift */, ); path = SnapshotTests; sourceTree = ""; @@ -4609,6 +4612,7 @@ AF22C88D2A6188EF0004BF3C /* ChatViewControllerLayoutTests.swift in Sources */, AF03A7B12A6E96870081887D /* BubbleViewDynamicTypeFontTests.swift in Sources */, AF03A7AF2A6E7DC40081887D /* AlertViewControllerDynamicTypeFontTests.swift in Sources */, + AF755FDA2A71583900871E36 /* BubbleWindowLayoutTests.swift in Sources */, AF22C8992A61AE930004BF3C /* VisitorCodeViewControllerLayoutTests.swift in Sources */, 9AB3401327F71D5D006E0FE2 /* BubbleViewVoiceOverTests.swift in Sources */, AF22C8932A619F5C0004BF3C /* SecureConversationsConfirmationScreenLayoutTests.swift in Sources */, diff --git a/SnapshotTests/BubbleWindowLayoutTests.swift b/SnapshotTests/BubbleWindowLayoutTests.swift new file mode 100644 index 000000000..fc827cc23 --- /dev/null +++ b/SnapshotTests/BubbleWindowLayoutTests.swift @@ -0,0 +1,19 @@ +@testable import GliaWidgets +import SnapshotTesting +import XCTest + +final class BubbleWindowLayoutTests: XCTestCase { + func test_bubbleWindow() { + let bubble = ViewFactory.mock().makeBubbleView() + bubble.frame = .init(origin: .zero, size: .init(width: 50, height: 50)) + let bubbleWindow = BubbleWindow( + bubbleView: bubble, + environment: .init( + uiScreen: .mock, + uiApplication: .mock + ) + ) + bubbleWindow.makeKeyAndVisible() + assertSnapshot(matching: bubbleWindow, as: .image) + } +}