-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
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.
Thank you for that cleanup, especially expanding the 1-character names!!
collect_app/src/main/java/org/odk/collect/android/widgets/SpinnerWidget.java
Outdated
Show resolved
Hide resolved
Oh, how about adding a case in |
A value from the second widget was used in both spinners
@lognaturel I added one test, you can review and add |
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.
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); |
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.
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.
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.
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"))); |
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.
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.
Tested with success Verified on Android: 4.2, 4.4, 5.1, 6.0, 7.0, 8.1 Verified cases:
@opendatakit-bot unlabel "needs testing" |
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. |
FIxed, but I can't merge without at least one approvement. |
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) sowidgetValueChanged()
was called.If we use that widget in a
field-list
group and withsearch
appearance (086f852) it caused that such a widget was recreated every time, and againonItemSelected()
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:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.