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

Fixed the problem with SelectOneWidget and minimal + search appearance in field-list #3181

Merged
merged 12 commits into from Jul 10, 2019

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Jun 27, 2019

Closes #3180

What has been done to verify that this works as intended?

I tested the form attached to the issue.

Why is this the best possible solution? Were any other approaches considered?

I solved the issue in the first commit 62cae79
The problem was that the code in onItemSelected() was performed even if we set the item programmatically (during initiating the view) so widgetValueChanged() was called.
If we use that widget in a field-list group and with search appearance (086f852) it caused that such a widget was recreated every time, and again onItemSelected() was called (endless loop).

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Changes are related only to that one widget (SelectOneWidget with minimal appearance) so it's not risky and testing the widget would be enough.

Do we need any specific form for testing your changes? If so, please attach one.

The form attached to the issue.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • run ./gradlew checkAll and confirmed all checks still pass OR confirm CircleCI build passes and run ./gradlew connectedDebugAndroidTest locally.
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

Copy link
Member

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

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

Thank you for that cleanup, especially expanding the 1-character names!!

@lognaturel
Copy link
Member

Oh, how about adding a case in FieldListUpdateTest? I gave you write access to the test form so you can easily add to the bottom of it.

@grzesiek2010
Copy link
Member Author

@lognaturel I added one test, you can review and add needs testing label if everything is fine.

Copy link
Member

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

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

Up to you whether you want to share the CSV data file. I'm a little more concerned about the sleep/InterruptedException.

Either way, these are test-only changes so don't need to be figured out before QA.

public void search_function_in_field_list() throws InterruptedException {
jumpToGroupWithText("Search in field-list");
onView(withText(startsWith("Source15"))).perform(click());
Thread.sleep(1000);
Copy link
Member

Choose a reason for hiding this comment

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

Why are this sleep and the InterrputedException throwing needed? Espresso should be able to detect when the UI thread is idle. Is it related to database lookups? ExternalCsvSearchTest does something similar so I'm surprised.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's because the spinner is not clickable immediately and the test didn't work.

@@ -83,7 +84,7 @@
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.CAMERA)
)
.around(new CopyFormRule(FIELD_LIST_TEST_FORM));
.around(new CopyFormRule(FIELD_LIST_TEST_FORM, "", Collections.singletonList("fruits.csv")));
Copy link
Member

Choose a reason for hiding this comment

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

Would you consider using the existing external-csv-search-produce.csv data file? I think it would be appropriate to move fieldlist-updates.xml to the forms subdirectory as well. Not a big deal if you prefer to keep them separate for now.

@bognasoldev89
Copy link

Tested with success

Verified on Android: 4.2, 4.4, 5.1, 6.0, 7.0, 8.1

Verified cases:

  • SelectOneWidget with minimal + search appearance search list
  • Rotating during testing the form
  • Swiping while a mobile phone was vertically
  • Closing the app during testing the form
  • Minimizing the app during testing the form
  • Blocking mobile phones during testing
  • Saving changes
  • Dismissing changes

@opendatakit-bot unlabel "needs testing"
@opendatakit-bot label "behavior verified"

@lognaturel
Copy link
Member

Thanks for testing, @bognasoldev89! @grzesiek2010, can you please fix the new conflict and merge? We can see if there's another option for the test when someone has a chance to dig deeper.

@grzesiek2010
Copy link
Member Author

can you please fix the new conflict and merge?

FIxed, but I can't merge without at least one approvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SelectOneWidget doesn't work with minimal and search appearance if it's in a field-list group
4 participants