Skip to content

Conversation

@cmonfortep
Copy link
Contributor

@cmonfortep cmonfortep commented Feb 26, 2020

Task/Issue URL: https://app.asana.com/0/0/1163707393081881/f
Tech Design URL:
CC: https://app.asana.com/0/0/1163228561849713/f

Description:

VariantManager changes

Moving as a control group a variant with concept test + Ctas.
Dropping variant only showing concept test.

SearchWidget cta changes

Only show search widget Cta if the user has seen at least on nonSerp Cta.

Steps to test this PR:

VariantManager changes

Concept test variant ml: Concept test with old ctas

  1. Hardcode into variantManager variant "ml"
  2. Perform a fresh install
  3. Run the app and ensure during the onboarding Default browser cta appears
  4. Visit a web with trackers like cnn.com
  5. Ensure dax dialog appears informing about trackers found
  6. Click on "High five!"
  7. Ensure no more Ctas are shown
  8. Visit duckduckgo.com
  9. Ensure dax dialog appears
  10. Click on "Phew!"
  11. Ensure no more Ctas are shown
  12. Continue the Dax journey till the end (open new tab, visit a website, open a new tab)
  13. Ensure Search widget cta appears in home screen

Concept test variant mh: concept test with ctas as dax dialogs:

  1. Hardcode into variantManager variant "mh"
  2. Perform a fresh install
  3. Run the app and ensure onboarding doesn't show any default browser cta
  4. Visit a web with trackers like cnn.com
  5. Ensure dax dialog appears informing about trackers found
  6. Click on "High five!"
  7. Ensure DefaultBrowser cta appears
  8. Click on "Ok"
  9. Ensure Dialog asking to set ddg as default browser appears
  10. Visit duckduckgo.com
  11. Ensure dax dialog appears
  12. Click on "Phew!"
  13. Ensure SearchWidget cta appears
  14. Click on "Add"
  15. Ensure dialog appears asking the user to add the search widget

SearchWidget cta new user flow

  1. Hardcode into variantManager variant "mh"
  2. Perform a fresh install
  3. Run the app and ensure onboarding doesn't show any default browser cta
  4. Visit duckduckgo.com
  5. Ensure dax dialog appears
  6. Click on "Phew!"
  7. Ensure SearchWidget cta DOES NOT appear
  8. Visit a site with trackers, a major network site or a site without trackers (wikipedia.org)
  9. Ensure nonSerp dax dialog appears
  10. Accept or dismiss dialog
  11. Visit duckduckgo.com again
  12. Ensure SearchWidget cta appears

Side note: a more detailed way of testing all the different combinations is explained inside #716 . If the reviewer decides to use any test scenario from that PR, please ensure it's still valid taking into account the changes introduced in this PR.


Internal references:

Software Engineering Expectations
Technical Design Template

@cmonfortep
Copy link
Contributor Author

@subsymbolic I will move this PR over to you.
It has a change that affects variantManager and we talked about pinging you once you were able to test changes introduced also in #714.

Copy link
Contributor

@subsymbolic subsymbolic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, provided a few tidy ups in the comments.

features = listOf(ConceptTest, SuppressHomeTabWidgetCta, SuppressOnboardingDefaultBrowserCta),
filterBy = { isEnglishLocale() }),
Variant(
key = "ml",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need a new variant here, ml was recently reserved for the eu auction, see RESERVED_EU_AUCTION_VARIANT at the top. You should have been protected from this by the verifyNoDuplicateVariantNames test but it didn't quite happen because RESERVED_EU_AUCTION_VARIANT is a special case and not in the variants list. Let's add and protect the next person.

)
}

private fun givenSerpCtaShown() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I like the way you have set these out.

// Is Serp
if (!daxDialogSerpShown() && isSerpUrl(it.url)) {
return DaxDialogCta.DaxSerpCta(onboardingStore, appInstallStore)
if (isSerpUrl(it.url)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work making this self-documenting. Let's delete the // Is Serp comment, it's no longer needed.

setConceptTestFeature(SearchWidgetDaxCta)
givenSerpCtaShown()
givenAtLeastOneNonSerpCtaShown()
whenever(mockDismissedCtaDao.exists(CtaId.DAX_DIALOG_SEARCH_WIDGET)).thenReturn(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I set this condition to false, the test should fail but it doesn't. Update test to be identical to its opposite test above, other than this condition and assertion.

Copy link
Contributor

@malmstein malmstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple of comments on readability

whenever(mockDismissedCtaDao.exists(CtaId.DAX_DIALOG_SEARCH_WIDGET)).thenReturn(true)
val site = site(url = "http://www.duckduckgo.com")

val value = testee.refreshCta(coroutineRule.testDispatcher, isBrowserShowing = true, site = site)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather we don't test if something is null as result of a business logic function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this change only apply if DaxDialogCta.NotNeeded exists or also for null values in general?

Copy link
Contributor

@subsymbolic subsymbolic Feb 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a null value is a possible and expected value os an API (whether it should be or not is another discussion) we should test it just like we would any other value. What's your reason for not wanting to test it @malmstein?

return when {
!daxDialogSerpShown() -> DaxDialogCta.DaxSerpCta(onboardingStore, appInstallStore)
canShowWidgetDaxCta() -> DaxDialogCta.SearchWidgetCta(widgetCapabilities, onboardingStore, appInstallStore)
else -> null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we return here something like DaxDialogCta.NotNeeded instead of null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with a different strategy to avoid returning null but I think we should agree first on a guideline or a tech design (using a new type inside Cta class like you suggested, and maybe Option in other cases).

Also, I think the change should be introduced in a different PR (LHF or inside the next project that comes here to introduce new Ctas). why? Because the change will affect how Ctas are handled in BrowserTabViewModel, BrowserTabFragment, and other methods in this same file + their own tests. The PR will be big enough to deserve its own PR so the reviewer can focus on the refactor.

what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nullability is a well-defined concept in kotlin, the code is understandable, not lying and not duplicating state. This is a good suggestion however I place it in the "nice to have" rather than PR blocking category.

* Test refactor to guard from someone using EU_AUCTION key variant
If null variant, test should throw exception and be invalid.
We can remove unnecessary !! when asserting values
@subsymbolic
Copy link
Contributor

@cmonfortep I have approved these changes however there is an outstanding question from @malmstein who is out. You are welcome to wait until that is resolved or, if you're blocked, you are welcome to merge now but continue that conversation with a view to creating a followup PR if required.

…feature/cristian/experiment2_flow_changed

# Conflicts:
#	app/src/androidTest/java/com/duckduckgo/app/statistics/VariantManagerTest.kt
@cmonfortep cmonfortep merged commit 5baeadc into feature/cristian/fb_insert_cta_concept_test_exp2 Feb 27, 2020
@cmonfortep cmonfortep deleted the feature/cristian/experiment2_flow_changed branch February 27, 2020 16:43
@cmonfortep
Copy link
Contributor Author

@malmstein moving forward with this PR, but happy to discuss your proposal offline. Thanks for the review.

cmonfortep added a commit that referenced this pull request Feb 28, 2020
* Dax dialog with two buttons (#713)

* New variant: Showing DefaultBrowserCta and SearchWidgetCta as Dax dialogs (#714)

* Insert DefaultBrowser Cta and SearchWidget Cta as Dax dialog during Dax Journey (#716)

* New control group and changes on when to show search widget cta (#723)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants