-
Notifications
You must be signed in to change notification settings - Fork 1
chore: improvements on flakiness of UI tests INTELLIJ-107 #78
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
Conversation
Coverage Report
|
...es/jetbrains-plugin/src/main/kotlin/com/mongodb/jbplugin/editor/inputs/DataSourceComboBox.kt
Outdated
Show resolved
Hide resolved
...ages/jetbrains-plugin/src/main/kotlin/com/mongodb/jbplugin/editor/inputs/DatabaseComboBox.kt
Outdated
Show resolved
Hide resolved
| eventually(1.minutes.toJavaDuration()) { | ||
| step("Selecting DataSource $title in toolbar") { |
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.
| eventually(1.minutes.toJavaDuration()) { | |
| step("Selecting DataSource $title in toolbar") { | |
| step("Selecting DataSource $title in toolbar") { | |
| eventually(1.minutes.toJavaDuration()) { |
Because eventually will retry every a few milliseconds, until (in this case) 1 minute passes, so we will see the step in the logs for every retry.
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.
If we are going to use this pattern of eventually/step a lot, maybe we want to have an eventually that receives the step name and does both things? So we encapsulate both calls and it's easier to use.
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.
Actually in practice I found that step log for every retries were making it more clear about what is happening. I am thinking of step as very detailed and verbose explanation of what is happening in the UI. Agree that we probably should have eventually with a step block. I will work towards that if my earlier reasoning sounds good?
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 sounds great, if it's possible can we add then the retry number? Like "Selecting DataSource $title: retry N" so it's clear in the logs that we are retrying?
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.
Added this here
1fb05f2 to
fa2c016
Compare
fa2c016 to
9fe8b08
Compare
| fun eventually( | ||
| description: String, | ||
| timeout: Duration = Duration.ofSeconds(1), | ||
| recovery: () -> Unit = {}, | ||
| fn: (Int) -> Unit | ||
| ) { | ||
| eventually(timeout, recovery) { attempt -> | ||
| step("$description, attempt=$attempt") { | ||
| fn(attempt) | ||
| } | ||
| } | ||
| } |
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.
Added this to address the suggestion about combining eventually and step descriptions.
Description
Two things that I identified inducing flakiness in our UI tests were:
To address the first concern, we are now updating the combobox only when there is an actual change, otherwise not and that too wrapped in an invokeLater so that existing interactions are finished before performing the update.
Second concern is addressed in two steps:
openRunQueryPopup.Update
There were two further problems identified for subsequent failures:
To address the first problem, we have worked up a series of UI steps to always perform for every test that will ensure that gradle project is in sync.
And for the second problem, we realised that the write unsafe error is more of a warning which can safely be ignored. But to be on the correct step here, we have wrapped all the actions now in an invokeLater with explicit modality state.
Note: This PR does not entirely remove flakes from our CI. There is still one source of problem (happening from time to time) which I haven't been able to understand completely. When we open a file, at times it will happen that the toolbar is not visible. There is no gradle sync or indexing happening in the background but still its almost like the IDE is in dumb mode. Not yet entirely sure why but I am happy to look into that as a follow up.
Checklist
Open Questions