-
Notifications
You must be signed in to change notification settings - Fork 527
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
Fix NPS Survey Gating #5356
Fix NPS Survey Gating #5356
Conversation
@BenHenning, PTAL. |
@adhiamboperes is it possible to add tests for any of the discovered user-facing problems? |
@BenHenning, I have added some UI tests and updated the PR description. |
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.
Thanks @adhiamboperes! Left a few comments--PTAL.
...c/main/java/org/oppia/android/app/player/state/testing/StateFragmentTestActivityPresenter.kt
Outdated
Show resolved
Hide resolved
domain/src/main/java/org/oppia/android/domain/survey/SurveyGatingController.kt
Show resolved
Hide resolved
app/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivityPresenter.kt
Show resolved
Hide resolved
…rvey-gating # Conflicts: # app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt
@BenHenning, PTAL. |
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.
Thanks @adhiamboperes! Just a couple of follow-ups. Feel free to merge once they're addressed since the PR otherwise LGTM.
app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/android/app/player/exploration/ExplorationActivityTest.kt
Outdated
Show resolved
Hide resolved
domain/src/main/java/org/oppia/android/domain/survey/SurveyGatingController.kt
Show resolved
Hide resolved
Hi @adhiamboperes, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks! |
Resolved all comments as fixed and enabling auto merge. |
Explanation
I found out during testing that there is an underlying gating DataProvider update behavior that occurs because of the way I initially designed the survey popup behaviour:
I mitigated this by removing the observer once the initial gating result has been received and processed.
Tests
I added tests that test survey gating based on changes in the time criterion, while other gating criteria remains constant/fulfilled. Exhaustive gating tests were added in the SurveyGatingController.
I also made a change in the
StateFragmentTest
that unregisters the idling resource after initializing profiles instead of at the end of the test runs. Previously,StateFragmentTest
would not run locally and fail with the error:This was caused by registering an idling resource before test begins, then when the activity starts, the main thread becomes busy. Generally, the test will continue when the main thread becomes idle, but the idling resource now blocks it and does not call onTransitionToIdle(). So it will always time out. Unregistering the idling resource before the activity starts frees up the main thread.
Disabled running on Robolectric due to known issue with Drag and Drop interaction.
Espresso Run Screenshot
Essential Checklist
For UI-specific PRs only
If your PR includes UI-related changes, then: