-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[Actionable observability] Add tests for alert search bar #145259
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
[Actionable observability] Add tests for alert search bar #145259
Conversation
Pinging @elastic/actionable-observability (Team: Actionable Observability) |
@@ -85,6 +85,13 @@ export default ({ getService }: FtrProviderContext) => { | |||
await testSubjects.existOrFail('autocompleteSuggestion-field-kibana.alert.status-'); | |||
}); | |||
|
|||
it('Invalid input should not break the page', async () => { |
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.
💬 This is the main test related to the bug. When testing locally, by disabling my fix, this test was failing.
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.
Nice tests 👍🏻 !
I wonder if there is an easy way to test the fix without doing a functional test, but instantiating the component with a badly formatted query, and asserting on the toasts.addError
being called or something. I'm not suggesting to write such test, I'm just thinking out loud :) The functional test works fine 👍🏻
Good job 👏🏻
I wanted to do the same and because of that I have started with unit tests in this PR 🙂 But since I mocked the whole SearchBar from TriggersActionsUI, I wasn't able to select the input and fill it with invalid input. If you have other suggestions, I will be happy to improve this part in a future PR. Btw, for the bugs that make the page blank, I think a functional test is more suitable because in unit tests, we mock a lot of things and the test is more about what we think fixes the issue rather than testing what user will see on the page. |
@@ -21,10 +21,10 @@ interface AlertSearchBarContainerState { | |||
} | |||
|
|||
interface AlertSearchBarStateTransitions { | |||
setRangeFrom: (rangeFrom: string) => AlertSearchBarContainerState; |
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.
Interesting that this made it in in the first place
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.
LGTM!
💚 Build Succeeded
Metrics [docs]Unknown metric groupsESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Closes #143641
Summary
As a follow-up to this PR #145067, in this PR I've added tests to make sure the same issue will not happen in the future.
Checklist