-
Notifications
You must be signed in to change notification settings - Fork 528
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 #3607: ExplorationPlayer End to End tests #3608
Fix #3607: ExplorationPlayer End to End tests #3608
Conversation
… setup-uiautomator � Conflicts: � third_party/maven_install.json
…oppia-android; branch 'develop' of https://github.com/oppia/oppia-android into setup-uiautomator
Assigning to @FareesHussain as well, to keep track of adding screenshots. |
Adding screenshots might take a time here as the whole test suite has 188 testcases, it might almost take more than 2 hrs |
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 @FareesHussain. Left one comment, but in general I think that:
- We need to leverage helpers to simplify the tests (per a comment I added in one of the base PRs)
- The tests we add for UiAutomator should be higher-level and cover general user flows rather than testing at the same level of specificity of Robolectric. Please follow up with me & Akshay if you're unsure how to proceed, but I did add one example to my comment. PTAL.
instrumentation/src/javatest/org/oppia/android/instrumentation/ExplorationPlayerTest.kt
Outdated
Show resolved
Hide resolved
… setup-uiautomator � Conflicts: � third_party/maven_install.json
…oppia-android into exploration-e2e-tests � Conflicts: � instrumentation/src/javatest/org/oppia/android/instrumentation/ExplorationPlayerTest.kt
val imageSelectionView = device.findObjectByRes("interaction_container_frame_layout") | ||
device.waitForRes("image_click_interaction_image_view") | ||
imageSelectionView!!.children!!.get(2)!!.click() | ||
device.findObjectByText("SUBMIT")!!.click() |
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.
Here I'm using !!.
instead of ?.
So that in case the view doesn't exist the test fails immediately, else the test runs as normal till it reaches the assertion and then gives a failure which might be confusing
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 suggest returning only non-nullable types from your helper class and utilize checkNotNull with clearer error messages if an object isn't found. That'll give you the quick-failure you're looking for with clearer context, and doesn't even give the choice to test authors to potentially avoid the null-check (since we do want things to be really crisp).
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.
Done
@@ -116,6 +116,7 @@ class ClickableAreasImage( | |||
newView.isFocusable = true | |||
newView.isFocusableInTouchMode = true | |||
newView.tag = clickableArea.label | |||
newView.contentDescription = clickableArea.label |
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.
@aggarwalpulkit596 PTAL
This enables content description for each image region in ImageRegionSelectionInteraction
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 isn't correct. The label will give away the answer, so we introduced another property for content descriptions in image region.
However, looking at https://github.com/oppia/oppia/blob/develop/extensions/interactions/ImageClickInput/ImageClickInput.py it seems we never did add this. Per oppia/oppia#9924 I guess we didn't finish this which introduces a problem. We unfortunately won't be able to use this method.
Can you file an issue to add support for oppia/oppia#9924 once it's ready & add that as a TODO here to fix the reference? We probably aren't going to be able to do better than the direct indexing without content description support.
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.
Done
#3712
...src/sharedTest/java/org/oppia/android/app/testing/ImageRegionSelectionInteractionViewTest.kt
Outdated
Show resolved
Hide resolved
...src/sharedTest/java/org/oppia/android/app/testing/ImageRegionSelectionInteractionViewTest.kt
Outdated
Show resolved
Hide resolved
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.
Approved for code owner file.
Unassigning @rt4914 since they have already approved the PR. |
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.
LGTM
Unassigning @aggarwalpulkit596 since they have already approved the PR. |
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 @FareesHussain. Couple more comments, but this looks pretty close to LGTM. Once you address these I'll take on more full pass (check open conversation threads; I didn't submit the review correctly this time).
Also @rt4914 PTAL at the comment I replied to above re: the content 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 @FareesHussain. This LGTM!
Since no reviewer threads are open & everyone's approved, merging this. |
Explanation
Fixes #3607
This pr introduces e2e tests in ExplorationPlayerTests using Ui Automator
How to run UI Automator tests
Prerequisites:
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~18.04-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
Steps to run the tests:
Using.android.test.orchestrator.mp4
Ran using single testcase for both with argument and without argument
Failing.test.case.included.mp4
Ran using duplicate testcase for both without argument and with argument
Using.duplicate.test.case.2.2.pr.mp4
Note: There are few flacky tests which is obvious for E2E tests but each test passes on individual run.
Checklist