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 part of #1868: Fix few Topic Tests and Migrate to ViewPager2 #2104

Conversation

anandwana001
Copy link
Contributor

@anandwana001 anandwana001 commented Nov 11, 2020

Explanation

Fix part of #1868 - TopicPracticeFragmentTest

Fix part of #632 - Converting ChapterSummaryAdapter to use generic adapter

Fix #2149 RTL Support to ViewPager

Fix #2194 Migrating to ViewPager2

Fix test cases from TopicFragmentTest
Fix few test cases from TopicInfoFragmentTest
Fix test cases from TopicLessonsFragmentTest
Fix test cases from TopicRevisionFragmentTest

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.

@anandwana001
Copy link
Contributor Author

anandwana001 commented Nov 11, 2020

Causing a bug in app:

  1. Open app
  2. Open any card (Fraction)
  3. Expand the list
  4. No item is visible
  5. Re creating the activity will display the list of chapters

This is because of DataBinding. Fixed using executePendingBindings(), after items of Story list binds.

@anandwana001 anandwana001 changed the title Fix part of #1868: Fix TopicPracticeFragmentTest and Migrate to ViewPager2 Fix part of #1868: Fix few Topic Tests and Migrate to ViewPager2 Nov 11, 2020
@anandwana001 anandwana001 removed their assignment Nov 12, 2020
@anandwana001 anandwana001 marked this pull request as ready for review November 12, 2020 10:22
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. Let's not merge this and wait for Ben as this was suggested by Ben.

@rt4914 rt4914 assigned BenHenning and unassigned rt4914 Nov 13, 2020
@BenHenning
Copy link
Member

Will need to take a look at this tomorrow. Sorry for the delay.

@BenHenning
Copy link
Member

BenHenning commented Nov 18, 2020

@anandwana001 Is there any other issue with this other than the explicit binding requirement? I'm wondering if we move the chapter list recycler view over to using our own data-binding recycler view adapter if that would avoid the need for explicitly calling executePendingBindings.

Also, does this fix the underlying tests? I wasn't sure if ViewPager2 would work, it was an idea after looking at semi-related issues that people ran into with the standard ViewPager.

@anandwana001
Copy link
Contributor Author

@anandwana001 Is there any other issue with this other than the explicit binding requirement? I'm wondering if we move the chapter list recycler view over to using our own data-binding recycler view adapter if that would avoid the need for explicitly calling executePendingBindings.

Also, does this fix the underlying tests? I wasn't sure if ViewPager2 would work, it was an idea after looking at semi-related issues that people ran into with the standard ViewPager.

For the tests, yes it does fix a lot of test cases after migrating to ViewPager2

@anandwana001
Copy link
Contributor Author

anandwana001 commented Nov 23, 2020

@anandwana001 Is there any other issue with this other than the explicit binding requirement? I'm wondering if we move the chapter list recycler view over to using our own data-binding recycler view adapter if that would avoid the need for explicitly calling executePendingBindings.

Also, does this fix the underlying tests? I wasn't sure if ViewPager2 would work, it was an idea after looking at semi-related issues that people ran into with the standard ViewPager.

@BenHenning We cannot use BindableAdapter here as we need to access every position to show the chapter number.
binding.index = position

@anandwana001
Copy link
Contributor Author

anandwana001 commented Nov 27, 2020

Thanks @anandwana001! Did a full pass--overall, this looks good. The test & functional improvements seem quite good. Most of my comments were nits, requests for clarification, and some suggestions to improve readability.

One high-level question that I have: can you please confirm that all the changed tests here still pass when run via Espresso and when run locally in Robolectric via Bazel?

All tests are passing on espresso and robolectric.

1

Need to run bazel tests, as of now I need to re-setup the bazel as I am getting timed out error. no such package '@maven//': Error while fetching artifact with coursier: Timed out

2

Build apk on bazel without extra param leads to error

ERROR: app/BUILD.bazel:554:19: output 'app/databinding/view_models_base/bin-files/org.oppia.android.app.view.models-org.oppia.android.app.view.models-setter_store.bin' was not created
ERROR: app/BUILD.bazel:554:19: output 'app/databinding/view_models_base/bin-files/org.oppia.android.app.view.models-org.oppia.android.app.view.models-layoutinfo.bin' was not created
ERROR: app/BUILD.bazel:554:19: output 'app/databinding/view_models_base/bin-files/org.oppia.android.app.view.models-org.oppia.android.app.view.models-br.bin' was not created
ERROR: app/BUILD.bazel:554:19: not all outputs were created or valid
Target //:oppia failed to build

build apk successfully on local, using our data binding version of bazel not the regular one.

bazel build //oppia --android_databinding_use_v3_4_args --experimental_android_databinding_v2 --java_header_compilation=false --noincremental_dexing --define=android_standalone_dexing_tool=d8_compat_dx

3

bazel test //app:TopicLessonsFragmentTest --android_databinding_use_v3_4_args --experimental_android_databinding_v2 --java_header_compilation=false --noincremental_dexing --define=android_standalone_dexing_tool=d8_compat_dx

Screenshot 2020-11-27 at 10 53 08

Screenshot 2020-11-27 at 10 56 35

Screenshot 2020-11-27 at 10 59 10

Screenshot 2020-11-27 at 11 00 38

Screenshot 2020-11-27 at 11 02 17

Adding @rt4914 for future reference regarding bazel tests running.

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 @anandwana001! I think the test simplifications are great! Just have a bunch of nits to address, then I think the PR will LGTM.

@BenHenning
Copy link
Member

@anandwana001 what specific issues did you run into with Bazel and how did you work around them? That wasn't entirely clear to me from your comment (& in general, please try to be clear about what you tried that didn't work, and what you tried that did to help others who might run into the same issue in the future).

@BenHenning BenHenning assigned anandwana001 and unassigned BenHenning Dec 1, 2020
@anandwana001
Copy link
Contributor Author

@anandwana001 what specific issues did you run into with Bazel and how did you work around them? That wasn't entirely clear to me from your comment (& in general, please try to be clear about what you tried that didn't work, and what you tried that did to help others who might run into the same issue in the future).

I did mention, let me just format it a bit.

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 @anandwana001! PR in its current form looks good, but let's try to consolidate the complexity around scrolling to avoid future developers running into similar pitfalls when working on test stability.

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 @anandwana001. LGTM!

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 [RTL] Highfi Topic tabs & toolbar
3 participants