-
Notifications
You must be signed in to change notification settings - Fork 571
Fix #5784: Standardize audio and app language list ordering #5988
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
base: develop
Are you sure you want to change the base?
Fix #5784: Standardize audio and app language list ordering #5988
Conversation
Standardizes the ordering for App Language and Audio Language lists as English-first, then alphabetical
|
Hi @EngDann PTAL at the failing unit tests in CI and assign back, also make sure to write tests for the code changes as well. Thanks! |
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 for this great solution, @EngDann!
As @manas-yu mentioned, please look at this wiki page to see how to locate failing tests in the CI report. An easy method I use is to click on the failing shard, then in the search bar, I type "failures", and I can easily navigate to the errors.
For information on how to run the tests locally on your machine, please see here.
Ps: Coverage related failures will automatically fix themselves once the tests pass.
|
Please let us know if you need any support with the fixes. |
|
Hi @adhiamboperes and @manas-yu, thanks for the detailed feedback and the helpful links! I'll aim to have the necessary test cases written and the PR updated by the end of this week. I don't need any support right now, but I'll definitely reach out if I hit a blocker. Thanks! |
…eSelectionViewModel.kt
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 @EngDann for adding tests.
However, the tests have not been correctly written, and I have left some comments inline explaining that.
Also, I have noticed that you have not fixed the existing tests that are failing in the CI. In my previous comment, I left some links for you to look at, pointing towards the WIki pages about our CI. Please take a look and let me know if I can explain some things further.
| topicController.getTopic( | ||
| ProfileId.newBuilder().setInternalId(0).build(), | ||
| TEST_TOPIC_ID_0 | ||
| ).observeForever(mockTopicLiveDataObserver) | ||
| 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.
This seems completely out of place. I don't think this test will compile at all. Did you run it locally?
| ).observeForever(mockTopicLiveDataObserver) | ||
| testCoroutineDispatchers.runCurrent() | ||
|
|
||
| launch<OptionsActivity>( |
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 activity under test is AudioLanguageActivity, not OptionsActivity, so this test will fail with build errors.
I suggest looking at other tests in this class to see how they are written, and using an identical set up for this new test.
| matches( | ||
| atPositionOnView( | ||
| 0, | ||
| withText("English"), | ||
| R.id.language_radio_button | ||
| ) |
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 assertion only verifies that English is in the first position, but it does not verify the remaining languages. The name of the test is testAudioLanguage_englishIsFirstThenAlphabetical, which means we expect to see the onView....matches(atPositionOnView..) for all the languages in the list.
|
|
||
| @Test | ||
| fun testAppLanguage_englishIsFirstThenAlphabetical() { | ||
| launch(OptionsActivity::class.java).use { |
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 activity under test isAppLanguageActivity, not OptionsActivity, so this test will fail with build errors.
Please look at how the other tests in this class are written, and use the same format.
| onView(withId(R.id.language_recycler_view)) | ||
| .perform( | ||
| scrollToPosition<RecyclerView.ViewHolder>(0) | ||
| ).check( | ||
| matches( | ||
| atPositionOnView( | ||
| 0, | ||
| withText("English"), | ||
| R.id.language_radio_button | ||
| ) | ||
| ) | ||
| ) | ||
| } |
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 assertion only verifies that English is in the first position, but it does not verify the remaining languages. The name of the test is testAudioLanguage_englishIsFirstThenAlphabetical, which means we expect to see the onView....matches(atPositionOnView..) for all the languages in the list.
| val fragment = activity.supportFragmentManager | ||
| .findFragmentByTag(TAG_APP_LANGUAGE_FRAGMENT) as AppLanguageFragment | ||
| testCoroutineDispatchers.runCurrent() | ||
| fragment.requireView().requestLayout() |
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 will not be necessary if you launch isAppLanguageActivity directly.
|
@adhiamboperes, thank you so much for the feedback! I'm still learning how to write tests effectively for this project, and it has been a challenge for me, so your comments were very helpful. I will update the tests with all of your suggestions. Regarding the other failing CI checks, I had some trouble accessing the logs last time as they had expired. I see they are available now, so I will investigate those failures and work on fixing them. Thanks again for your help and patience! |
…nguageSelectionViewModel
|
Hey @adhiamboperes! I've pushed updates for all the feedback you gave me. I fixed the tests to launch the correct activities and check all the languages, like you pointed out. Could you please take another look when you get a chance? Thanks! |
Explanation
Fix #5784
Before, the list of text and audio languages was bad sorted, so, as was proposed, I sorted the languages in alphabetic form, excluding the English from that sort and applying that as the first language.
Essential Checklist
For UI-specific PRs only