Skip to content
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 #138: Topic train fragment Low-fi UI (Part 4) #204

Merged
merged 41 commits into from
Oct 18, 2019

Conversation

rt4914
Copy link
Contributor

@rt4914 rt4914 commented Oct 3, 2019

Explanation

Replicated from #197

Part 1: #200
Part 2: #202
Part 3: #203
Part 4: Contains test case for TopicTrainFragment

Mock: https://xd.adobe.com/spec/e2239cf4-9cde-4c08-5296-25316c1f0a14-9412/screen/f403add1-079a-4202-9975-efe04c076290/Home-Page-1-Start-Learning-Pre-Scroll-6

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The PR follows the style guide.
  • The PR does not contain any unnecessary auto-generated code from Android Studio.
  • The PR is made from a branch that's not called "develop".
  • The PR is assigned to an appropriate reviewer.

@rt4914
Copy link
Contributor Author

rt4914 commented Oct 3, 2019

@veena14cs @nikitamarysolomanpvt PTAL

Copy link
Contributor

@veena14cs veena14cs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@veena14cs veena14cs assigned rt4914 and unassigned veena14cs Oct 3, 2019
@rt4914
Copy link
Contributor Author

rt4914 commented Oct 3, 2019

LGTM

Thanks @veena14cs

@rt4914 rt4914 assigned BenHenning and unassigned rt4914 Oct 3, 2019
Copy link
Contributor

@nikitamarysolomanpvt nikitamarysolomanpvt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include KDoc for test cases

fun testTopicTrainFragment_loadFragment_textIsDisplayed() {
ActivityScenario.launch(TopicActivity::class.java).use {
onView(withId(R.id.dummy_text_view)).check(matches(withText("This is dummy TextView for testing")))
fun testTopicTrainFragment_loadFragment_selectSkills_submitButtonIsActivated() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other cases worth testing:

  • Verifying that when no skills are selected, the button is not clickable
  • Verifying that the button's clickable state becomes disabled after selecting & deselecting skills
  • Verifying that clicking the submit button properly forwards the list of skills to an outgoing activity
  • Verifying that the list of selected skills stay selected upon a configuration change
  • Verifying that the submit button activation status stays correct for both enabled/disabled cases upon a configuration change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added all these working test-cases

@BenHenning BenHenning assigned rt4914 and unassigned BenHenning Oct 4, 2019
@rt4914 rt4914 changed the title Fix (#138): Topic train fragment Low-fi UI (Part 4) Fix #138: Topic train fragment Low-fi UI (Part 4) Oct 4, 2019
@rt4914 rt4914 assigned BenHenning and unassigned rt4914 Oct 10, 2019
@rt4914
Copy link
Contributor Author

rt4914 commented Oct 10, 2019

@BenHenning PTAL at updated test cases.

@rt4914
Copy link
Contributor Author

rt4914 commented Oct 11, 2019

@BenHenning Regarding RecyclerViewMatcher -> I have removed that file and implemented those methods inside BindableTestAdapter.

I was getting stuck at two points.

  1. I wanted to perform click on Checkbox inside the item which I was not unable do with the existing BindableTestAdapter.
  2. I wanted the information of Checkbox inside the item too.

So, I have added two methods inside BindableTestAdapter which solves the issue that i am facing.

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rt4914. I ran out of time to deep dive this PR, but could you move the test utilities you're using in BindableAdapterTest to a shared location for all tests to use? Prefer not having one test depend on another.

@BenHenning BenHenning assigned rt4914 and unassigned BenHenning Oct 15, 2019
@BenHenning
Copy link
Member

Please reassign to me once the requested refactor is completed.

@rt4914
Copy link
Contributor Author

rt4914 commented Oct 15, 2019

Thanks @rt4914. I ran out of time to deep dive this PR, but could you move the test utilities you're using in BindableAdapterTest to a shared location for all tests to use? Prefer not having one test depend on another.

@BenHenning I am actually confused what you mean here?

My interpretation: I should move the atPosition and atPositionView functions that I have introduced in BindableTestAdapter to a separate file.

If this is the case, I had actually done that only earlier by introducing the RecyclerViewMatcher file.
Reference Code:

@rt4914 rt4914 assigned BenHenning and unassigned rt4914 Oct 15, 2019
@rt4914
Copy link
Contributor Author

rt4914 commented Oct 18, 2019

@BenHenning
As discussed in one of our meetings, for recyclerview item testing we can either introduce androidx.test.espresso:espresso-contrib:3.1.0 library or we can write our own custom recyclerview test code.

I tried using androidx.test.espresso:espresso-contrib:3.1.0 but it only provides code to click on an specific item in recyclerview. There is no mechanism to check the content of an item.

Because of these reasons, I have created one new file which we can use for recyclerview testing, i.e., RecyclerViewMatcher, also, I have changed your BindableAdapterTest cases to use this RecyclerViewMatcher file.

@rt4914
Copy link
Contributor Author

rt4914 commented Oct 18, 2019

@BenHenning This PR is ready for your review.

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @rt4914! If the tests are passing, this looks reasonable to me. I found one potential issue with some of the new tests around configuration changes, but other than that the PR LGTM. Feel free to submit once the comments are resolved.

fun testTopicTrainFragment_loadFragment_selectSkills_configurationChange_skillsAreSelected() {
activityTestRule.launchActivity(null)
onView(atPosition(R.id.skill_recycler_view,0)).perform(click())
activityTestRule.activity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this is sufficient for a configuration change. Suggest instead: ActivityScenario.recreate()

Ditto elsewhere for configuration changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means I have add this or do I have to remove the current line and replace this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using both and merge code for now, because the test-cases passes in all possible combinations, using current code only, using your code only and using both.

@BenHenning BenHenning assigned rt4914 and unassigned BenHenning Oct 18, 2019
@rt4914
Copy link
Contributor Author

rt4914 commented Oct 18, 2019

Merging this code after making all suggested changes.

@rt4914 rt4914 merged commit 117ec95 into develop Oct 18, 2019
@rt4914 rt4914 deleted the topic-train-low-fi-part-4 branch October 18, 2019 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants