-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Unit Tests for new o11y rules page #128576
Conversation
@elasticmachine merge upstream |
@elasticmachine merge upstream |
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.
A good tests suite!
There is one question, and need to add mention types to better get the context.
describe('empty RulesPage with show only capability', () => { | ||
let wrapper: ReactWrapper<any>; | ||
async function setup() { | ||
const rulesState = { |
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 here
describe('empty RulesPage', () => { | ||
let wrapper: ReactWrapper<any>; | ||
async function setup() { | ||
const rulesState = { |
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.
Would you please use the Rule State type for this variable https://github.com/elastic/kibana/pull/128576/files#diff-f3577bd6740c5a14c816d10e3104210e7598807d70a4953e60d28e513ebfe559R89
}, | ||
]; | ||
|
||
const rulesState = { |
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 here
await nextTick(); | ||
wrapper.update(); | ||
}); | ||
expect(wrapper.find(RulesTable)).toHaveLength(0); |
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.
What does toHaveLength(0)
mean for the Rules Table? it seems to be checking of existence why not use .exists()
for example?
Don't we need a kind of selector to do so?
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.
@fkanout I can do expect(wrapper.find(RulesTable).exists()).toBe(false);
@elasticmachine merge upstream |
merge conflict between base and head |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: cc @mgiota |
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
* tests for rules page * mock useKibana and useBreadcrubms * mock useFetchRules * rules page scenarios * temp * mock usePluginContext and useLoadRuleTypes * fix typescript errors * fix Jest did not exit one second after the test run has completed warning * add more tests to the empty rules page scenario * fix typescript error * render documentation link * empty RulesPage with show only capability * rules page with items * RulesPage with items and show only capability * remove disabled items (I need to implement it later on) * refactoring * update documentation link * add types to the ruleState Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Fixes #127440
Covers following basic scenarios:
Note: These tests are a starting point and can be extended to cover more scenarios