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 #1873: Fix OnboardingFragmentTest test cases on Robolectric #2482

Merged
merged 60 commits into from
Feb 3, 2021

Conversation

prayutsu
Copy link
Contributor

@prayutsu prayutsu commented Jan 15, 2021

Explanation

FIxes #1873, fixes #2194, fixes part of #2417
Migrated from ViewPager to ViewPager2
Fixed test cases on robolectric

Testing Video to ensure that new implementation of ViewPager2 does not bring any new regressions -

Screenrecorder-2021-01-15-19-23-34-39.mp4

All test cases passing on Robolectric -
Screenshot from 2021-01-30 03-19-00

All test cases passing on Espresso -
Screenshot from 2021-01-30 03-18-05

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 made from a branch that is up-to-date with "develop".
  • The PR's branch is based on "develop" and not on any other branch.
  • The PR is assigned to an appropriate reviewer in both the Assignees and the Reviewers sections.

@prayutsu prayutsu removed their assignment Jan 30, 2021
@prayutsu
Copy link
Contributor Author

prayutsu commented Jan 30, 2021

@BenHenning @anandwana001 @rt4914 PTAL, the PR is ready for full review.

/** Adapter to control the slide details in onboarding flow. */
private const val VIEW_TYPE_TITLE_TEXT = 1
private const val VIEW_TYPE_STORY_ITEM = 2

class OnboardingPagerAdapter(
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we going to use the Bindale Adapter and remove this Adapter in this PR only or we are keeping this as a separate issue? @rt4914

Copy link
Member

Choose a reason for hiding this comment

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

That seems like a larger & unrelated change--I suggest splitting it off of this task.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, given that so much of the adapter has changed anyway, maybe it is worth trying to migrate to BindableAdapter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BenHenning So, should I replace it with a bindable Adapter in this PR only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I guess you are suggesting to track it via a new issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Given the case that @prayutsu has already worked a lot on this issue, let him decide what he wants to do:
(a.) File an issue, mention it this PR and later on either @prayutsu solves it or the community.
(b.) Use BindableAdapter in this PR itself.

Copy link
Contributor

@anandwana001 anandwana001 left a comment

Choose a reason for hiding this comment

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

LGTM, Thank @prayutsu

@@ -529,7 +529,7 @@ class OnboardingFragmentTest {
}

override fun perform(uiController: UiController?, view: View?) {
(view as ViewPager2).setCurrentItem(position, false)
(view as ViewPager2).setCurrentItem(position, /* smoothScroll= */false)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
(view as ViewPager2).setCurrentItem(position, /* smoothScroll= */false)
(view as ViewPager2).setCurrentItem(position, /* smoothScroll= */ false)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@anandwana001 anandwana001 removed their assignment Feb 2, 2021
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.

Overall, I think the new action is reasonable. I agree with @anandwana001's suggestion to move this to BindableAdapter.

Otherwise I have nothing else to add. Feel free to re-add me if you'd like my review, otherwise I'm happy to defer to codeowners for review.

@prayutsu prayutsu assigned prayutsu and unassigned FareesHussain Feb 2, 2021
@prayutsu
Copy link
Contributor Author

prayutsu commented Feb 2, 2021

Overall, I think the new action is reasonable. I agree with @anandwana001's suggestion to move this to BindableAdapter.

Otherwise I have nothing else to add. Feel free to re-add me if you'd like my review, otherwise I'm happy to defer to codeowners for review.

@BenHenning Thanks for your review, if everything looks good, then can you please approve the changes?

@prayutsu
Copy link
Contributor Author

prayutsu commented Feb 2, 2021

@rt4914 We Will also need your review, PTAL.

@prayutsu
Copy link
Contributor Author

prayutsu commented Feb 2, 2021

Filed #2600 for Bindable Adapter Implementation

@BenHenning
Copy link
Member

@prayutsu I didn't actually review this in detail (and don't need to since I'm not a codeowner). In general, I don't fully review PRs that don't require my review unless the author specifically asks for it.

If you want me to review, I'm happy to, but I might need to prioritize it lower than other reviews that require my approval.

@BenHenning BenHenning assigned prayutsu and unassigned BenHenning Feb 3, 2021
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

@prayutsu Overall this PR has turned out to be really good. Suggested few changes.

/** Adapter to control the slide details in onboarding flow. */
private const val VIEW_TYPE_TITLE_TEXT = 1
private const val VIEW_TYPE_STORY_ITEM = 2

class OnboardingPagerAdapter(
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the case that @prayutsu has already worked a lot on this issue, let him decide what he wants to do:
(a.) File an issue, mention it this PR and later on either @prayutsu solves it or the community.
(b.) Use BindableAdapter in this PR itself.

@rt4914 rt4914 removed their assignment Feb 3, 2021
@prayutsu
Copy link
Contributor Author

prayutsu commented Feb 3, 2021

@rt4914 I have filed issue #2600 for migration to the bindable adapter, but I am thinking to close that issue and migrate to Bindable Adapter in this PR only. What do you suggest?

@rt4914
Copy link
Contributor

rt4914 commented Feb 3, 2021

@rt4914 I have filed issue #2600 for migration to the bindable adapter, but I am thinking to close that issue and migrate to Bindable Adapter in this PR only. What do you suggest?

@prayutsu I would suggest you do it in a separate PR.

Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@rt4914 rt4914 merged commit c571a05 into oppia:develop Feb 3, 2021
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.

Onboarding Fragment needs to be updated to ViewPager2 Fix OnboardingFragmentTest for Robolectric
5 participants