Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MBL-1495] [MBL-1502] PPO UI implementation #2186

Merged
merged 19 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
stevestreza-ksr marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import XCTest

final class PPOProjectCardTests: TestCase {
let size = CGSize(width: 375, height: 700)
func testAddressLocks() {

@MainActor
func testAddressLocks() async {
stevestreza-ksr marked this conversation as resolved.
Show resolved Hide resolved
let card =
VStack {
PPOProjectCard(viewModel: PPOProjectCardViewModel(
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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")
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Kickstarter-iOS/TestHelpers/snapshot-test-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Kickstarter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -2804,6 +2805,7 @@
A7F761761C85FACB005405ED /* LoginToutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = LoginToutViewController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
A7FC8C051C8F1DEA00C3B49B /* CircleAvatarImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CircleAvatarImageView.swift; sourceTree = "<group>"; };
AA1023E32CABD2AE007800B5 /* PPOContainerViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PPOContainerViewModel.swift; sourceTree = "<group>"; };
AA1844C92CD2A9E8008B0FEC /* snapshot-test-image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "snapshot-test-image.png"; sourceTree = "<group>"; };
AA645E9A2C7725FB0034705A /* PagedContainerViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PagedContainerViewModelTests.swift; sourceTree = "<group>"; };
AA645E9D2C772C650034705A /* PagedTabBarTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PagedTabBarTests.swift; sourceTree = "<group>"; };
AA6682222CB86EEB00C8522E /* PPOProjectCardModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PPOProjectCardModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6445,6 +6447,7 @@
A7ED20201E83237F00BFFA01 /* TestHelpers */ = {
isa = PBXGroup;
children = (
AA1844C92CD2A9E8008B0FEC /* snapshot-test-image.png */,
A7ED20211E83237F00BFFA01 /* Combos.swift */,
37096C3122BC23AD003D1F40 /* MockAppEnvironment.swift */,
37096C2F22BC238C003D1F40 /* MockFeedbackGenerator.swift */,
Expand Down Expand Up @@ -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 */,
Expand Down