-
Notifications
You must be signed in to change notification settings - Fork 531
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 #2667: Wrong Tab selected on configuration change in TopicFragment #2670
Fix #2667: Wrong Tab selected on configuration change in TopicFragment #2670
Conversation
Few points:
Currently, we do have a test to test this issue Could you please confirm!!. |
@anandwana001 the bug only occurs when navigated through Promoted stories. I guess we need to test it using @MaskedCarrot Your implementation does fix this. But you need to track down what might be causing this issue before fixing this, to avoid further bugs related to this. This is also weird that it is only reproduced when navigated through Promoted stories. |
This issue is caused because in the |
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.
@MaskedCarrot Please add a test case for this specific case. The test should be added in TopicFragmentTest
.
@rt4914 before going for the test case, could you confirm if the approach looks good to you? Also, what is the root cause of this issue before fixing it? As we are landing on the same topic page but from two different places, what's the difference here? |
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.
@MaskedCarrot PTAL
app/src/main/java/org/oppia/android/app/topic/TopicFragmentPresenter.kt
Outdated
Show resolved
Hide resolved
@anandwana001 Yeah the approach is correct. Only the naming is just opposite. Cause: The code is incorrect. It should be like this: if we are on same screen and do orientation change than nothing should change. From promoted story we show Topic-Lessons in expanded form and from |
…-change' into topic-tab-changes-on-orientation-change
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.
Nit changes on the Test file.
app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/android/app/topic/TopicFragmentTest.kt
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.
LGTM. Added a commet please check
@@ -375,6 +375,7 @@ class TopicFragmentTest { | |||
targetViewId = R.id.master_skills_text_view, | |||
stringToMatch = "Master These Skills" | |||
) | |||
testCoroutineDispatchers.runCurrent() | |||
onView(isRoot()).perform(orientationLandscape()) | |||
testCoroutineDispatchers.runCurrent() |
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 we remove this?
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 think we can remove this because after clicking on the tab we have a runCurrent()
which will provide the delay to switch the tab.
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.
Check if Robolectric passing or not with/without this stabilizing.
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.
The robolectric test are passing with or without testCoroutineDispatchers.runCurrent()
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.
removed unnecessary testCoroutineDispatchers.runCurrent()
and checked that the tests are still correctly passing on espresso (real device and emulator) and robolectric.
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.
added screenshots for the same in 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.
LGTM,
Can you confirm that you are able to see the screen rotation while running the espresso tests.
yes I can see the orientation change |
I will take a look at this tomorrow. |
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
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 @MaskedCarrot! I had a couple thoughts, but feel free to resolve those conversations. The PR LGTM. Please re-assign me if you have any follow-up questions that you'd like my thoughts on.
app/src/main/java/org/oppia/android/app/topic/TopicFragmentPresenter.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.
LGTM, thanks.
Explanation
Fixes #2667
Checklist
gif
21-02-09-18-46-29.mp4
Espresso Tests
Tests after the changes made in this PR.