-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
[Cases] Fix flaky hooks #183721
[Cases] Fix flaky hooks #183721
Conversation
Pinging @elastic/response-ops (Team:ResponseOps) |
Pinging @elastic/response-ops-cases (Feature:Cases) |
await waitFor(() => { | ||
expect(spy).toHaveBeenCalled(); | ||
}); |
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.
await waitFor(() => { | |
expect(spy).toHaveBeenCalled(); | |
}); | |
await waitFor(() => { | |
expect(spy).toHaveBeenCalledWith({ | |
http, | |
signal: expect.anything(), | |
connectorId: connector.id, | |
}); | |
}); |
and remove line 46 and below?
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.
I do this because if we have the toHaveBeenCalledWith
inside the waitFor
, we do not know if the expect
failed because the function did not get called with the correct arguments or did not call at all. The logs will not show anything in the CI. This way, in the case of a flaky test, the logs will show the expected args.
await waitFor(() => { | ||
expect(spyOnGetCurrentUserProfile).toBeCalled(); | ||
}); |
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.
Same as above(removing line 47)
await waitFor(() => { | |
expect(spyOnGetCurrentUserProfile).toBeCalled(); | |
}); | |
await waitFor(() => { | |
expect(spyOnGetCurrentUserProfile).toBeCalledWith({ | |
security: expect.anything(), | |
}); | |
}); |
💚 Build Succeeded
Metrics [docs]
To update your PR or re-run it, just comment with: cc @cnasikas |
Summary
Fixes: #183144, #182845
Checklist
Delete any items that are not applicable to this PR.
For maintainers