-
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 #2633: Add label for FAQList screen #2750
Conversation
@rt4914 @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.
PTAL. Thanks.
app/src/sharedTest/java/org/oppia/android/app/faq/FAQListActivityTest.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/android/app/faq/FAQListActivityTest.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/android/app/faq/FAQListActivityTest.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.
Thanks @Sparsh1212! Left some thoughts.
app/src/sharedTest/java/org/oppia/android/app/faq/FAQListActivityTest.kt
Outdated
Show resolved
Hide resolved
app/src/sharedTest/java/org/oppia/android/app/faq/FAQListActivityTest.kt
Outdated
Show resolved
Hide resolved
@rt4914 @BenHenning PTAL, 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 @Sparsh1212! LGTM.
|
||
// Verify that the activity label is correct as a proxy to verify TalkBack will announce the | ||
// correct string when it's read out. | ||
assertThat(title).isEqualTo(context.getString(R.string.faq_activity_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.
@rt4914 random thought: given we keep repeating this context in a bunch of places, could we maybe introduce an extension method to contextualize this? E.g. introducing a flow that would let us do:
assertThat(activityTestRule.activity).hasTalkBackLabel(R.string.faq_activity_label)
I was thinking at first that we could maybe do this with an extension function, but I actually think we will need to implement a custom subject (https://truth.dev/extension.html) since unfortunately AndroidX doesn't include one for Activity (https://developer.android.com/training/testing/fundamentals#assertions). This might lead to other nice wins when testing activities, and we could establish other extensions as we need them. Might be worth filing an issue to track. @anandwana001 as well since this falls under testing.
Note that I do not suggest doing any of this work in this PR--let's keep the current pattern & consider doing the above.
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.
Sounds good. @anandwana001 Can you file an issue for 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.
@BenHenning is Custome Subject is available in Kotlin?
Reference - google/truth#536
I just had a quick look over what a custom subject is and tried this gist, could you check once if it is the correct way?
https://gist.github.com/anandwana001/9bccce1f9a0413af5f86ec12dc331d24
I will look into more on this today and see how to have a clean implementation.
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.
Custom subjects should work fine in Kotlin. Did you observe something that suggests they won’t?
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.
(From what I can tell the issue you linked to is for using extensions which is actually why I was thinking custom subjects originally).
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 #2633: Add label for FAQList screen for correct talkback output.
Checklist