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

Remove ignore from field list test #6170

Merged
merged 6 commits into from
Jun 13, 2024
Merged

Conversation

seadowg
Copy link
Member

@seadowg seadowg commented Jun 5, 2024

Closes #5996

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

I was only able to get this to fail once, only on Test Lab and not since 40148aa. The main change I've made here is to deprecate withIndex due to it presenting subtle problems (because it's stateful). I suspect some of the other work we've done on UI tests recently has made this more stable, and I'm optimistic that the new method for scrolling to a question is more robust as well.

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?

This just changes tests, so there is nothing to verify.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • 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

@seadowg seadowg changed the title field list test Remove ignore from field list test Jun 5, 2024
* https://stackoverflow.com/a/39756832
*
*/
@Deprecated("this matcher is stateful and will cause problems if used more than once")
Copy link
Member Author

Choose a reason for hiding this comment

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

The problems with this are actually mentioned in a comment on the SO answer, but for some reason the answer has stayed up. I've flagged it, so others don't run into the same problems.

To be clear, I'm not sure if it actually broke anything for us, but while experimenting with different ways of scrolling and clicking I ended up running into problems caused by the state here.

}

override fun matchesSafely(item: View): Boolean {
return if (item is QuestionWidget) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not a big fan of UI tests that know this much about the view hierarchy, but I've tried to keep this as general as possible: QuestionWidget is a pretty fundamental view type and there just needs to be a text_label somewhere within it for this to work (the actual structure doesn't matter).

@seadowg seadowg marked this pull request as ready for review June 6, 2024 15:07
@seadowg seadowg requested a review from grzesiek2010 June 6, 2024 15:08
@grzesiek2010 grzesiek2010 merged commit e517efc into getodk:master Jun 13, 2024
6 checks passed
@seadowg seadowg deleted the field-list-test branch June 14, 2024 08:22
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.

Fix FieldListUpdateTest#listOfQuestionsShouldNotBeScrolledToTheLastEditedQuestionAfterClickingOnAQuestion
2 participants