-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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-1197] Show unavailable rewards last #1947
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
68b9fd3
Update rewards tests
ifosli 9d8b245
Sort rewards by unavailable last
ifosli 02be563
Merge branch 'main' into sortRewards
ifosli b24e1c7
Merge branch 'main' into sortRewards
ifosli 5e77d88
Merge branch 'main' into sortRewards
ifosli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,50 +24,47 @@ final class RewardsCollectionViewControllerTests: TestCase { | |
let project = Project.cosmicSurgery | ||
|> Project.lens.state .~ .live | ||
|
||
combos(Language.allLanguages, [Device.phone4_7inch, Device.phone5_8inch, Device.pad]).forEach { | ||
language, device in | ||
withEnvironment(language: language, locale: .init(identifier: language.rawValue)) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: vc) | ||
|
||
assertSnapshot( | ||
matching: parent.view, | ||
as: .image(perceptualPrecision: 0.98), | ||
named: "lang_\(language)_device_\(device)" | ||
) | ||
} | ||
let language = Language.en, device = Device.phone4_7inch | ||
withEnvironment(language: language, locale: .init(identifier: language.rawValue)) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: vc) | ||
|
||
assertSnapshot( | ||
matching: parent.view, | ||
as: .image(perceptualPrecision: 0.98), | ||
named: "lang_\(language)_device_\(device)" | ||
) | ||
} | ||
} | ||
|
||
func testRewards_NonBacker_LiveProject_Landscape() { | ||
let project = Project.cosmicSurgery | ||
|> Project.lens.state .~ .live | ||
|> Project.lens.rewardData.rewards %~ { Array($0[1...3]) } | ||
|
||
let language = Language.de, device = Device.pad | ||
withEnvironment(language: language, locale: .init(identifier: language.rawValue)) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .landscape, child: vc) | ||
|
||
combos(Language.allLanguages, [Device.phone4_7inch, Device.phone5_8inch, Device.pad]).forEach { | ||
language, device in | ||
withEnvironment(language: language, locale: .init(identifier: language.rawValue)) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .landscape, child: vc) | ||
|
||
assertSnapshot( | ||
matching: parent.view, | ||
as: .image(perceptualPrecision: 0.98), | ||
named: "lang_\(language)_device_\(device)" | ||
) | ||
} | ||
assertSnapshot( | ||
matching: parent.view, | ||
as: .image(perceptualPrecision: 0.98), | ||
named: "lang_\(language)_device_\(device)" | ||
) | ||
} | ||
} | ||
|
||
func testRewards_Backer_LiveProject_Landscape() { | ||
let reward = Project.cosmicSurgery.rewards[1] | ||
let reward = Project.cosmicSurgery.rewards[3] | ||
let project = Project.cosmicSurgery | ||
|> Project.lens.state .~ .live | ||
|> Project.lens.personalization.isBacking .~ true | ||
|
@@ -77,24 +74,23 @@ final class RewardsCollectionViewControllerTests: TestCase { | |
|> Backing.lens.rewardId .~ reward.id | ||
|> Backing.lens.shippingAmount .~ 10 | ||
|> Backing.lens.amount .~ 700.0 | ||
|> Backing.lens.addOns .~ [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opting out of add ons here ensures that this reward will be shown as unavailable when it's not selected. The default addOn has the same reward id as one of the rewards, which messes with our count for the reward. |
||
) | ||
|
||
let language = Language.es, device = Device.phone5_8inch | ||
withEnvironment(language: language, locale: .init(identifier: language.rawValue)) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .landscape, child: vc) | ||
|
||
combos(Language.allLanguages, [Device.phone4_7inch, Device.phone5_8inch, Device.pad]).forEach { | ||
language, device in | ||
withEnvironment(language: language, locale: .init(identifier: language.rawValue)) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .landscape, child: vc) | ||
|
||
assertSnapshot( | ||
matching: parent.view, | ||
as: .image(perceptualPrecision: 0.98), | ||
named: "lang_\(language)_device_\(device)" | ||
) | ||
} | ||
assertSnapshot( | ||
matching: parent.view, | ||
as: .image(perceptualPrecision: 0.98), | ||
named: "lang_\(language)_device_\(device)" | ||
) | ||
} | ||
} | ||
|
||
|
@@ -107,21 +103,19 @@ final class RewardsCollectionViewControllerTests: TestCase { | |
|> Project.lens.state .~ .live | ||
|> Project.lens.rewardData.rewards .~ [reward] | ||
|
||
combos(Language.allLanguages, [Device.pad]).forEach { | ||
language, device in | ||
withEnvironment( | ||
language: language, | ||
locale: .init(identifier: language.rawValue) | ||
) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .landscape, child: vc) | ||
|
||
assertSnapshot(matching: parent.view, as: .image, named: "lang_\(language)_device_\(device)") | ||
} | ||
let language = Language.fr, device = Device.pad | ||
withEnvironment( | ||
language: language, | ||
locale: .init(identifier: language.rawValue) | ||
) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .landscape, child: vc) | ||
|
||
assertSnapshot(matching: parent.view, as: .image, named: "lang_\(language)_device_\(device)") | ||
} | ||
} | ||
|
||
|
@@ -134,21 +128,19 @@ final class RewardsCollectionViewControllerTests: TestCase { | |
|> Project.lens.state .~ .live | ||
|> Project.lens.rewardData.rewards .~ [reward] | ||
|
||
combos(Language.allLanguages, [Device.phone5_8inch]).forEach { | ||
language, device in | ||
withEnvironment( | ||
language: language, | ||
locale: .init(identifier: language.rawValue) | ||
) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: vc) | ||
|
||
assertSnapshot(matching: parent.view, as: .image, named: "lang_\(language)_device_\(device)") | ||
} | ||
let language = Language.ja, device = Device.phone5_8inch | ||
withEnvironment( | ||
language: language, | ||
locale: .init(identifier: language.rawValue) | ||
) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: vc) | ||
|
||
assertSnapshot(matching: parent.view, as: .image, named: "lang_\(language)_device_\(device)") | ||
} | ||
} | ||
|
||
|
@@ -161,21 +153,19 @@ final class RewardsCollectionViewControllerTests: TestCase { | |
|> Project.lens.state .~ .live | ||
|> Project.lens.rewardData.rewards .~ [.noReward, reward] | ||
|
||
combos(Language.allLanguages, [Device.phone5_8inch]).forEach { | ||
language, device in | ||
withEnvironment( | ||
language: language, | ||
locale: .init(identifier: language.rawValue) | ||
) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: vc) | ||
|
||
assertSnapshot(matching: parent.view, as: .image, named: "lang_\(language)_device_\(device)") | ||
} | ||
let language = Language.en, device = Device.phone5_8inch | ||
withEnvironment( | ||
language: language, | ||
locale: .init(identifier: language.rawValue) | ||
) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: vc) | ||
|
||
assertSnapshot(matching: parent.view, as: .image, named: "lang_\(language)_device_\(device)") | ||
} | ||
} | ||
|
||
|
@@ -193,21 +183,19 @@ final class RewardsCollectionViewControllerTests: TestCase { | |
) | ||
|> Project.lens.rewardData.rewards .~ [reward] | ||
|
||
combos(Language.allLanguages, [Device.phone5_8inch]).forEach { | ||
language, device in | ||
withEnvironment( | ||
language: language, | ||
locale: .init(identifier: language.rawValue) | ||
) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: vc) | ||
|
||
assertSnapshot(matching: parent.view, as: .image, named: "lang_\(language)_device_\(device)") | ||
} | ||
let language = Language.de, device = Device.phone5_8inch | ||
withEnvironment( | ||
language: language, | ||
locale: .init(identifier: language.rawValue) | ||
) { | ||
let vc = RewardsCollectionViewController.instantiate( | ||
with: project, | ||
refTag: nil, | ||
context: .createPledge | ||
) | ||
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: vc) | ||
|
||
assertSnapshot(matching: parent.view, as: .image, named: "lang_\(language)_device_\(device)") | ||
} | ||
} | ||
} |
Binary file removed
BIN
-250 KB
...ControllerTests/testRewards_Backer_LiveProject_Landscape.lang_de_device_pad.png
Binary file not shown.
Binary file removed
BIN
-109 KB
...rTests/testRewards_Backer_LiveProject_Landscape.lang_de_device_phone4_7inch.png
Binary file not shown.
Binary file removed
BIN
-129 KB
...rTests/testRewards_Backer_LiveProject_Landscape.lang_de_device_phone5_8inch.png
Binary file not shown.
Binary file removed
BIN
-241 KB
...ControllerTests/testRewards_Backer_LiveProject_Landscape.lang_en_device_pad.png
Binary file not shown.
Binary file removed
BIN
-105 KB
...rTests/testRewards_Backer_LiveProject_Landscape.lang_en_device_phone4_7inch.png
Binary file not shown.
Binary file removed
BIN
-124 KB
...rTests/testRewards_Backer_LiveProject_Landscape.lang_en_device_phone5_8inch.png
Binary file not shown.
Binary file removed
BIN
-247 KB
...ControllerTests/testRewards_Backer_LiveProject_Landscape.lang_es_device_pad.png
Binary file not shown.
Binary file removed
BIN
-107 KB
...rTests/testRewards_Backer_LiveProject_Landscape.lang_es_device_phone4_7inch.png
Binary file not shown.
Binary file modified
BIN
+17.3 KB
(110%)
...rTests/testRewards_Backer_LiveProject_Landscape.lang_es_device_phone5_8inch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-243 KB
...ControllerTests/testRewards_Backer_LiveProject_Landscape.lang_fr_device_pad.png
Binary file not shown.
Binary file removed
BIN
-107 KB
...rTests/testRewards_Backer_LiveProject_Landscape.lang_fr_device_phone4_7inch.png
Binary file not shown.
Binary file removed
BIN
-128 KB
...rTests/testRewards_Backer_LiveProject_Landscape.lang_fr_device_phone5_8inch.png
Binary file not shown.
Binary file removed
BIN
-241 KB
...ControllerTests/testRewards_Backer_LiveProject_Landscape.lang_ja_device_pad.png
Binary file not shown.
Binary file removed
BIN
-104 KB
...rTests/testRewards_Backer_LiveProject_Landscape.lang_ja_device_phone4_7inch.png
Binary file not shown.
Binary file removed
BIN
-124 KB
...rTests/testRewards_Backer_LiveProject_Landscape.lang_ja_device_phone5_8inch.png
Binary file not shown.
Binary file removed
BIN
-121 KB
...ollerTests/testRewards_LocalPickUp_LiveProject_Landscape.lang_de_device_pad.png
Binary file not shown.
Binary file removed
BIN
-116 KB
...ollerTests/testRewards_LocalPickUp_LiveProject_Landscape.lang_en_device_pad.png
Binary file not shown.
Binary file removed
BIN
-120 KB
...ollerTests/testRewards_LocalPickUp_LiveProject_Landscape.lang_es_device_pad.png
Binary file not shown.
Binary file removed
BIN
-116 KB
...ollerTests/testRewards_LocalPickUp_LiveProject_Landscape.lang_ja_device_pad.png
Binary file not shown.
Binary file removed
BIN
-76.4 KB
...ts/testRewards_LocalPickUp_LiveProject_Portrait.lang_de_device_phone5_8inch.png
Binary file not shown.
Binary file removed
BIN
-72.1 KB
...ts/testRewards_LocalPickUp_LiveProject_Portrait.lang_en_device_phone5_8inch.png
Binary file not shown.
Binary file removed
BIN
-75.4 KB
...ts/testRewards_LocalPickUp_LiveProject_Portrait.lang_es_device_phone5_8inch.png
Binary file not shown.
Binary file removed
BIN
-74 KB
...ts/testRewards_LocalPickUp_LiveProject_Portrait.lang_fr_device_phone5_8inch.png
Binary file not shown.
Binary file removed
BIN
-74.9 KB
...kUp_RewardBacked_LocalPickupRewardShown_Success.lang_en_device_phone5_8inch.png
Binary file not shown.
Binary file removed
BIN
-78.6 KB
...kUp_RewardBacked_LocalPickupRewardShown_Success.lang_es_device_phone5_8inch.png
Binary file not shown.
Binary file removed
BIN
-77 KB
...kUp_RewardBacked_LocalPickupRewardShown_Success.lang_fr_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-77.4 KB
...kUp_RewardBacked_LocalPickupRewardShown_Success.lang_ja_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-68.3 KB
...lPickUp_RewardNotBacked_AllRewardsShown_Success.lang_de_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-63.4 KB
...lPickUp_RewardNotBacked_AllRewardsShown_Success.lang_es_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-66.2 KB
...lPickUp_RewardNotBacked_AllRewardsShown_Success.lang_fr_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-66.9 KB
...lPickUp_RewardNotBacked_AllRewardsShown_Success.lang_ja_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-208 KB
...ionViewControllerTests/testRewards_NonBacker_LiveProject.lang_de_device_pad.png
Diff not rendered.
Binary file removed
BIN
-80.1 KB
...ntrollerTests/testRewards_NonBacker_LiveProject.lang_de_device_phone4_7inch.png
Diff not rendered.
Binary file removed
BIN
-85.3 KB
...ntrollerTests/testRewards_NonBacker_LiveProject.lang_de_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-202 KB
...ionViewControllerTests/testRewards_NonBacker_LiveProject.lang_en_device_pad.png
Diff not rendered.
Binary file modified
BIN
-197 Bytes
(100%)
...ntrollerTests/testRewards_NonBacker_LiveProject.lang_en_device_phone4_7inch.png
Oops, something went wrong.
Binary file removed
BIN
-81.2 KB
...ntrollerTests/testRewards_NonBacker_LiveProject.lang_en_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-207 KB
...ionViewControllerTests/testRewards_NonBacker_LiveProject.lang_es_device_pad.png
Diff not rendered.
Binary file removed
BIN
-79.4 KB
...ntrollerTests/testRewards_NonBacker_LiveProject.lang_es_device_phone4_7inch.png
Diff not rendered.
Binary file removed
BIN
-84.6 KB
...ntrollerTests/testRewards_NonBacker_LiveProject.lang_es_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-205 KB
...ionViewControllerTests/testRewards_NonBacker_LiveProject.lang_fr_device_pad.png
Diff not rendered.
Binary file removed
BIN
-79.1 KB
...ntrollerTests/testRewards_NonBacker_LiveProject.lang_fr_device_phone4_7inch.png
Diff not rendered.
Binary file removed
BIN
-84.3 KB
...ntrollerTests/testRewards_NonBacker_LiveProject.lang_fr_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-201 KB
...ionViewControllerTests/testRewards_NonBacker_LiveProject.lang_ja_device_pad.png
Diff not rendered.
Binary file removed
BIN
-75.2 KB
...ntrollerTests/testRewards_NonBacker_LiveProject.lang_ja_device_phone4_7inch.png
Diff not rendered.
Binary file removed
BIN
-80.5 KB
...ntrollerTests/testRewards_NonBacker_LiveProject.lang_ja_device_phone5_8inch.png
Diff not rendered.
Binary file modified
BIN
+8.59 KB
(100%)
...trollerTests/testRewards_NonBacker_LiveProject_Landscape.lang_de_device_pad.png
Oops, something went wrong.
Binary file removed
BIN
-106 KB
...sts/testRewards_NonBacker_LiveProject_Landscape.lang_de_device_phone4_7inch.png
Diff not rendered.
Binary file removed
BIN
-130 KB
...sts/testRewards_NonBacker_LiveProject_Landscape.lang_de_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-240 KB
...trollerTests/testRewards_NonBacker_LiveProject_Landscape.lang_en_device_pad.png
Diff not rendered.
Binary file removed
BIN
-103 KB
...sts/testRewards_NonBacker_LiveProject_Landscape.lang_en_device_phone4_7inch.png
Diff not rendered.
Binary file removed
BIN
-126 KB
...sts/testRewards_NonBacker_LiveProject_Landscape.lang_en_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-247 KB
...trollerTests/testRewards_NonBacker_LiveProject_Landscape.lang_es_device_pad.png
Diff not rendered.
Binary file removed
BIN
-105 KB
...sts/testRewards_NonBacker_LiveProject_Landscape.lang_es_device_phone4_7inch.png
Diff not rendered.
Binary file removed
BIN
-129 KB
...sts/testRewards_NonBacker_LiveProject_Landscape.lang_es_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-241 KB
...trollerTests/testRewards_NonBacker_LiveProject_Landscape.lang_fr_device_pad.png
Diff not rendered.
Binary file removed
BIN
-104 KB
...sts/testRewards_NonBacker_LiveProject_Landscape.lang_fr_device_phone4_7inch.png
Diff not rendered.
Binary file removed
BIN
-128 KB
...sts/testRewards_NonBacker_LiveProject_Landscape.lang_fr_device_phone5_8inch.png
Diff not rendered.
Binary file removed
BIN
-239 KB
...trollerTests/testRewards_NonBacker_LiveProject_Landscape.lang_ja_device_pad.png
Diff not rendered.
Binary file removed
BIN
-104 KB
...sts/testRewards_NonBacker_LiveProject_Landscape.lang_ja_device_phone4_7inch.png
Diff not rendered.
Binary file removed
BIN
-127 KB
...sts/testRewards_NonBacker_LiveProject_Landscape.lang_ja_device_phone5_8inch.png
Diff not rendered.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just reduces the number of items so that the unavailable one shows as well, even when it's last