diff --git a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/PPOProjectCardModel.swift b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/PPOProjectCardModel.swift index 0b88bff6eb..4c5b4845ab 100644 --- a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/PPOProjectCardModel.swift +++ b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/PPOProjectCardModel.swift @@ -207,7 +207,7 @@ extension PPOProjectCardModel { alerts: [ .init(type: .warning, icon: .time, message: "Address locks in 8 hours") ], - imageURL: URL(string: "https://placecats.com/400/200")!, + imageURL: Bundle.framework.url(forResource: "snapshot-test-image", withExtension: "png")!, title: "Sugardew Island - Your cozy farm shop let’s pretend this is a way way way longer title", pledge: .init(amount: "50.00", currency: .usd, symbol: "$"), creatorName: "rokaplay truncate if longer than", @@ -228,7 +228,7 @@ extension PPOProjectCardModel { .init(type: .warning, icon: .alert, message: "Survey available"), .init(type: .warning, icon: .time, message: "Address locks in 48 hours") ], - imageURL: URL(string: "https://placecats.com/400/200")!, + imageURL: Bundle.framework.url(forResource: "snapshot-test-image", withExtension: "png")!, title: "Sugardew Island - Your cozy farm shop let’s pretend this is a way way way longer title", pledge: .init(amount: "50.00", currency: .usd, symbol: "$"), creatorName: "rokaplay truncate if longer than", @@ -248,7 +248,7 @@ extension PPOProjectCardModel { message: "Pledge will be dropped in 6 days" ) ], - imageURL: URL(string: "https://placecats.com/400/200")!, + imageURL: Bundle.framework.url(forResource: "snapshot-test-image", withExtension: "png")!, title: "Sugardew Island - Your cozy farm shop let’s pretend this is a way way way longer title", pledge: .init(amount: "50.00", currency: .usd, symbol: "$"), creatorName: "rokaplay truncate if longer than", @@ -268,7 +268,7 @@ extension PPOProjectCardModel { message: "Pledge will be dropped in 6 days" ) ], - imageURL: URL(string: "https://placecats.com/400/200")!, + imageURL: Bundle.framework.url(forResource: "snapshot-test-image", withExtension: "png")!, title: "Sugardew Island - Your cozy farm shop let’s pretend this is a way way way longer title", pledge: .init(amount: "50.00", currency: .usd, symbol: "$"), creatorName: "rokaplay truncate if longer than", @@ -283,7 +283,7 @@ extension PPOProjectCardModel { alerts: [ .init(type: .warning, icon: .alert, message: "Survey available") ], - imageURL: URL(string: "https://placecats.com/400/200")!, + imageURL: Bundle.framework.url(forResource: "snapshot-test-image", withExtension: "png")!, title: "Sugardew Island - Your cozy farm shop let’s pretend this is a way way way longer title", pledge: .init(amount: "50.00", currency: .usd, symbol: "$"), creatorName: "rokaplay truncate if longer than", diff --git a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/PPOProjectCardTests.swift b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/PPOProjectCardTests.swift index 32fa9c8d3a..faf736791a 100644 --- a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/PPOProjectCardTests.swift +++ b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/PPOProjectCardTests.swift @@ -6,7 +6,9 @@ import XCTest final class PPOProjectCardTests: TestCase { let size = CGSize(width: 375, height: 700) - func testAddressLocks() { + + @MainActor + func testAddressLocks() async { let card = VStack { PPOProjectCard(viewModel: PPOProjectCardViewModel( @@ -16,10 +18,12 @@ final class PPOProjectCardTests: TestCase { .frame(maxHeight: .infinity) .padding() }.frame(height: 500) + try? await Task.sleep(nanoseconds: 10_000_000) assertSnapshot(matching: card, as: .image, named: "addressLocks") } - func testSurveyAvailableAddressLocks() { + @MainActor + func testSurveyAvailableAddressLocks() async { let card = VStack { PPOProjectCard(viewModel: PPOProjectCardViewModel( card: .addressLockTemplate @@ -28,10 +32,12 @@ final class PPOProjectCardTests: TestCase { .frame(maxHeight: .infinity) .padding() }.frame(height: 500) + try? await Task.sleep(nanoseconds: 10_000_000) assertSnapshot(matching: card, as: .image, named: "surveyAvailableAddressLocks") } - func testPaymentFailedPledgeDropped() { + @MainActor + func testPaymentFailedPledgeDropped() async { let card = VStack { PPOProjectCard(viewModel: PPOProjectCardViewModel( card: .fixPaymentTemplate @@ -40,10 +46,12 @@ final class PPOProjectCardTests: TestCase { .frame(maxHeight: .infinity) .padding() }.frame(height: 500) + try? await Task.sleep(nanoseconds: 10_000_000) assertSnapshot(matching: card, as: .image, named: "paymentFailedPledgeDropped") } - func testCardAuthPledgeDropped() { + @MainActor + func testCardAuthPledgeDropped() async { let card = VStack { PPOProjectCard(viewModel: PPOProjectCardViewModel( card: .authenticateCardTemplate @@ -52,10 +60,12 @@ final class PPOProjectCardTests: TestCase { .frame(maxHeight: .infinity) .padding() }.frame(height: 500) + try? await Task.sleep(nanoseconds: 10_000_000) assertSnapshot(matching: card, as: .image, named: "cardAuthPledgeDropped") } - func testSurveyAvailable() { + @MainActor + func testSurveyAvailable() async { let card = VStack { PPOProjectCard(viewModel: PPOProjectCardViewModel( card: .completeSurveyTemplate @@ -64,6 +74,7 @@ final class PPOProjectCardTests: TestCase { .frame(maxHeight: .infinity) .padding() }.frame(height: 500) + try? await Task.sleep(nanoseconds: 10_000_000) assertSnapshot(matching: card, as: .image, named: "surveyAvailable") } } diff --git a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testAddressLocks.addressLocks.png b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testAddressLocks.addressLocks.png index 9a4d5db5f5..9ea5a84c36 100644 Binary files a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testAddressLocks.addressLocks.png and b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testAddressLocks.addressLocks.png differ diff --git a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testCardAuthPledgeDropped.cardAuthPledgeDropped.png b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testCardAuthPledgeDropped.cardAuthPledgeDropped.png index 3475e55804..0d047f5bb8 100644 Binary files a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testCardAuthPledgeDropped.cardAuthPledgeDropped.png and b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testCardAuthPledgeDropped.cardAuthPledgeDropped.png differ diff --git a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testPaymentFailedPledgeDropped.paymentFailedPledgeDropped.png b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testPaymentFailedPledgeDropped.paymentFailedPledgeDropped.png index f70f39b358..c74d7ff5b1 100644 Binary files a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testPaymentFailedPledgeDropped.paymentFailedPledgeDropped.png and b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testPaymentFailedPledgeDropped.paymentFailedPledgeDropped.png differ diff --git a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testSurveyAvailable.surveyAvailable.png b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testSurveyAvailable.surveyAvailable.png index 68a84fde57..928fdec176 100644 Binary files a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testSurveyAvailable.surveyAvailable.png and b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testSurveyAvailable.surveyAvailable.png differ diff --git a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testSurveyAvailableAddressLocks.surveyAvailableAddressLocks.png b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testSurveyAvailableAddressLocks.surveyAvailableAddressLocks.png index bc02c87d0f..a04e254ca8 100644 Binary files a/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testSurveyAvailableAddressLocks.surveyAvailableAddressLocks.png and b/Kickstarter-iOS/Features/PledgedProjectsOverview/CardView/__Snapshots__/PPOProjectCardTests/testSurveyAvailableAddressLocks.surveyAvailableAddressLocks.png differ diff --git a/Kickstarter-iOS/TestHelpers/snapshot-test-image.png b/Kickstarter-iOS/TestHelpers/snapshot-test-image.png new file mode 100644 index 0000000000..2ca459477a Binary files /dev/null and b/Kickstarter-iOS/TestHelpers/snapshot-test-image.png differ diff --git a/Kickstarter.xcodeproj/project.pbxproj b/Kickstarter.xcodeproj/project.pbxproj index fce949ed32..572b35c1c5 100644 --- a/Kickstarter.xcodeproj/project.pbxproj +++ b/Kickstarter.xcodeproj/project.pbxproj @@ -1137,6 +1137,7 @@ A7F6F0C11DC7EBF7002C118C /* DateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7F6F0C01DC7EBF7002C118C /* DateProtocol.swift */; }; A7FC8C061C8F1DEA00C3B49B /* CircleAvatarImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7FC8C051C8F1DEA00C3B49B /* CircleAvatarImageView.swift */; }; AA1023E42CABD2AE007800B5 /* PPOContainerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA1023E32CABD2AE007800B5 /* PPOContainerViewModel.swift */; }; + AA1844CA2CD2A9E9008B0FEC /* snapshot-test-image.png in Resources */ = {isa = PBXBuildFile; fileRef = AA1844C92CD2A9E8008B0FEC /* snapshot-test-image.png */; }; AA645E972C770D620034705A /* DesignSystemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6049D0102A9CF6840015BB0D /* DesignSystemViewController.swift */; }; AA645E9C2C7725FB0034705A /* PagedContainerViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA645E9A2C7725FB0034705A /* PagedContainerViewModelTests.swift */; }; AA645E9E2C772C650034705A /* PagedTabBarTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA645E9D2C772C650034705A /* PagedTabBarTests.swift */; }; @@ -2804,6 +2805,7 @@ A7F761761C85FACB005405ED /* LoginToutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = LoginToutViewController.swift; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.swift; }; A7FC8C051C8F1DEA00C3B49B /* CircleAvatarImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CircleAvatarImageView.swift; sourceTree = ""; }; AA1023E32CABD2AE007800B5 /* PPOContainerViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PPOContainerViewModel.swift; sourceTree = ""; }; + AA1844C92CD2A9E8008B0FEC /* snapshot-test-image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "snapshot-test-image.png"; sourceTree = ""; }; AA645E9A2C7725FB0034705A /* PagedContainerViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PagedContainerViewModelTests.swift; sourceTree = ""; }; AA645E9D2C772C650034705A /* PagedTabBarTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PagedTabBarTests.swift; sourceTree = ""; }; AA6682222CB86EEB00C8522E /* PPOProjectCardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PPOProjectCardModel.swift; sourceTree = ""; }; @@ -6445,6 +6447,7 @@ A7ED20201E83237F00BFFA01 /* TestHelpers */ = { isa = PBXGroup; children = ( + AA1844C92CD2A9E8008B0FEC /* snapshot-test-image.png */, A7ED20211E83237F00BFFA01 /* Combos.swift */, 37096C3122BC23AD003D1F40 /* MockAppEnvironment.swift */, 37096C2F22BC238C003D1F40 /* MockFeedbackGenerator.swift */, @@ -7604,6 +7607,7 @@ 014D629D1E6E5B070033D2BD /* BackerDashboardEmptyStateCell.xib in Resources */, D6C3845C210B9AC400ADB671 /* SettingsNewslettersTopCell.xib in Resources */, 77FD8B44216D6167000A95AC /* LoadingBarButtonItemView.xib in Resources */, + AA1844CA2CD2A9E9008B0FEC /* snapshot-test-image.png in Resources */, D6A7AB401FDAF3EC007B20AE /* ThanksCategoryCell.xib in Resources */, 59673C8B1D50EC920035AFD9 /* Video.storyboard in Resources */, 77F9A9B22135FC9B0082A11E /* FindFriendsCell.xib in Resources */,