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

test(SFINT-3352): Safer tests #88

Merged
merged 1 commit into from
Jul 28, 2020

Conversation

louis-bompart
Copy link
Collaborator

Flaky UT issue from #86, see https://travis-ci.org/github/coveo/search-ui-extensions/builds/712557300.

I was not able to 'pin-point' with certitude what caused the flakiness, due to the issue being, well flaky (and thus I'm not 💯 confident it'll be fixed but I think it will)

Two fixes:

  • Do not modify activateSpy and deactivateSpy they're used as default options for the component instantiation, which can cause test leakage.
  • Ensure all events listener have completed their job before checking the spies. This also prevents test leakage (you could have the eventListener of the test n-1 executed during the execution of the test n) and also that we're actually testing what we want. (We do not want to 'miss' a double call because the second call occurs after the expectation.

Comment on lines +190 to +192
for (let index = 0; index < eventCompletionPromises.length; index++) {
await eventCompletionPromises[index];
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Promise.all and Jasmine cannot just cooperate (in fact, Jasmine and promises beyond basics are not working well together at all from what I experienced)

@nathanlb
Copy link
Contributor

Are there any metrics you noted that confirm this helps? Even just a little bit

@louis-bompart
Copy link
Collaborator Author

louis-bompart commented Jul 28, 2020

Are there any metrics you noted that confirm this helps? Even just a little bit

Eye-balling mostly but 10-20% failure rate before, 0% after (never reproduce after my changes on +10runs)

@nathanlb
Copy link
Contributor

Sounds pretty good to me

@louis-bompart louis-bompart merged commit 664ee53 into coveo:master Jul 28, 2020
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.

3 participants