-
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
Native checkout experiment #801
Conversation
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.
Looks good..had couple minor comments
@@ -64,10 +65,22 @@ final class ProjectPamphletContentDataSourceTests: TestCase { | |||
} | |||
} | |||
|
|||
func testRewardsSection_nativeCheckoutFeature_showsWithTurnedOff() { | |||
func testRewardsSection_showsWhen_nativeCheckoutFeatureEnabled_checkoutExperimentDisabled() { |
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.
Should these tests cover the following combinations? (I think we might be missing one)
- feature enable + experiment disabled
- feature disabled + experiment enabled
- feature disabled + experiment disabled (I think we're missing this one)
@@ -1,6 +1,7 @@ | |||
public enum Experiment { | |||
public enum Name: String { | |||
case creatorsNameDiscovery = "show_created_by_discovery" | |||
case nativeCheckoutV1 = "native_checkout_v1" |
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.
Just wondering about the naming of this ... is this named native
after our team (hence it's a native team feature) or is this named after the feature native checkout
?
If it's the first then I think it's fine.
If it's the later then V1 is technically web checkout
so not sure if it makes sense but don't feel strongly about it (just wanted to bring this up).
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 name starts with native
so it becomes clear on the Kickstarter app that it's a native experiment (so no one deletes it by accident).
Library/Config+Helpers.swift
Outdated
@@ -2,8 +2,8 @@ import Foundation | |||
import KsApi | |||
|
|||
extension Experiment.Name { | |||
public func isEnabled(in _: Environment) -> Bool { | |||
guard let experiments = AppEnvironment.current.config?.abExperiments else { return false } | |||
public func isEnabled(in environment: Environment = AppEnvironment.current) -> Bool { |
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.
I've noticed this function is not tested...can we add appropriate tests?
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 function stayed untested for over a year! π I will add a test for it.
Library/Feature.swift
Outdated
@@ -5,6 +5,14 @@ public enum Feature: String { | |||
case nativeCheckoutPledgeView = "ios_native_checkout_pledge_view" | |||
} | |||
|
|||
extension Feature { | |||
public func isEnabled(in environment: Environment = AppEnvironment.current) -> Bool { |
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.
Also looks untested..
Co-Authored-By: Pavel Dusatko <pavel.dusatko@gmail.com>
Generated by π« Danger |
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.
} | ||
} | ||
|
||
func testIsEnabled_Experimental() { |
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.
Can we name these 2 tests similarly?
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.
Ops!
|
||
func testIsEnabled_Experimental() { | ||
let config = Config.template | ||
|> \.abExperiments .~ [Experiment.Name.nativeCheckoutV1.rawValue: "experimental"] |
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.
I'd also suggest we test when abExperiments
is empty or does not include nativeCheckoutV1
. What do you think?
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.
Good idea!
import KsApi | ||
|
||
public func userCanSeeNativeCheckout() -> Bool { | ||
return nativeCheckoutExperimentIsEnabled() && featureNativeCheckoutEnabled() |
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.
I completely missed the naming the first time around...
What do you say we make this more consistent so that we:
- use
isEnabled
for both - use the same pattern (either:
nativeCheckoutExperimentIsEnabled
&nativeCheckoutFeatureIsEnabled
orexperimentNativeCheckoutIsEnabled
&featureNativeCheckoutIsEnabled
)?
@@ -80,10 +80,10 @@ public final class ProjectPamphletViewModel: ProjectPamphletViewModelType, Proje | |||
} | |||
|
|||
self.goToRewards = goToRewards | |||
.filter { _ in featureNativeCheckoutPledgeViewEnabled() } |
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.
Make sure that when merging master
this is actually using the correct feature flag Native Checkout
not Native Checkout Pledge View
... @justinswart has recently changed it since it was causing issue with deep links π
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.
Yeah, I noticed that. Actually we now will use userCanSeeNativeCheckout
because of the experiment π
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.
π’ π’ π’
π’ π’ π’
π’ π’ π’
Tested on iPad Air 2 (Cher)
π² What
π€ Why
And this is the JIRA ticket
π How
The app now receives the
native_checkout_v1
on theConfig
response.Note The users will only see the checkout if the nativeCheckout feature is enabled AND they are on the
experimental
bucket.β Acceptance criteria
One way to test this is first go to
Config.swift
and add a breakpoint to see the values of stringsArray (line 30).If the value of
native_checkout_v1
isexperimental
:If the value of
native_checkout_v1
iscontrol
:If you wanna test all the scenarios, simply go to
ExperimentName +Helpers.swift
and change the value ofreturn Experiment.Variant(rawValue: variant) == .experimental
tocontrol
. Here we are just changing the logic simulating a differentbucket
.