-
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
[Security Solution] Update button text according to status #80389
Conversation
expect(wrapper.find('[data-test-subj="all-rules"]').exists()).toEqual(true); | ||
}); | ||
|
||
it('renders correct button with correct text - Load Elastic prebuilt rules and timeline templates', 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.
could you please refactor all of your tests to use waitFor
instead of act
? Whenever you see that act
error on a test, you should resolve it using waitFor
with enzyme mount
and act
with renderHook
You can follow the waitFor
pattern in edit_connector/index.test.tsx. I'll show you an example on this test:
import { waitFor } from '@testing-library/react';
it('renders correct button with correct text - Load Elastic prebuilt rules and timeline templates', async () => {
(getPrePackagedRulesStatus as jest.Mock).mockResolvedValue({
rules_not_installed: 3,
rules_installed: 0,
rules_not_updated: 0,
timelines_not_installed: 3,
timelines_installed: 0,
timelines_not_updated: 0,
});
const wrapper = mount(
<TestProviders>
<RulesPage />
</TestProviders>
);
await waitFor(() => {
wrapper.update();
expect(wrapper.find('[data-test-subj="loadPrebuiltRulesBtn"]').exists()).toEqual(true);
expect(wrapper.find('[data-test-subj="loadPrebuiltRulesBtn"]').last().text()).toEqual(
'Load Elastic prebuilt rules and timeline templates'
);
});
});
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 you get stuck and want to zoom let me know!
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 work here! Code looks good, great job on test coverage, manual testing is good. The only change for me is the test update I requested in my comment. Once you have that ping me for a LGTM!
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.
Thanks for updating those tests. This PR is ready to rock 🎸 LGTM!!
💚 Build SucceededMetrics [docs]async chunks size
History
To update your PR or re-run it, just comment with: |
…0389) * update button text according to status * remove unused translations * fix functional test * fixup * fix unit test * update unit tests * update unit test
…0389) * update button text according to status * remove unused translations * fix functional test * fixup * fix unit test * update unit tests * update unit test
* master: (115 commits) [ML] Transforms/DF Analytics: Fix data grid column sorting. (elastic#80618) added brace import to vis editor (elastic#80652) Fix error rate sorting in services list (elastic#80764) Emit info log when using custom registry URL (elastic#80768) [Reporting] Config Schema Validation for rules[N].protocol strings (elastic#80766) Add Storybook a11y addon (elastic#80069) Fix anomaly alert selection text (elastic#80746) [Security Solution] [Maps] Kibana index pattern, comma bug fix (elastic#80208) [kbn/optimizer] tweak split chunks options (elastic#80444) update template to use the new team label (elastic#80748) [Security Solution] Fix the Field dropdown in Timeline data providers resets when scrolled (elastic#80718) Adjusts observability alerting perms to require "all" (elastic#79896) [Security Solutions][Detection Engine] Fixes pre-packaged rules which contain exception lists to not overwrite user defined lists (elastic#80592) [data.ui] Fix flaky test & lazy loading rendering artifacts. (elastic#80612) Licensed feature usage for connectors (elastic#77679) [Security Solution] Cypress template creation (elastic#80180) [APM] Hide service if only data is from ML (elastic#80145) Fix role mappings test for ESS (elastic#80604) [Maps] Add support for envelope (elastic#80614) [Security Solution] Update button text according to status (elastic#80389) ...
Summary
This PR fixes https://github.com/elastic/security-team/issues/36
Problem:
Before this PR, the button for loading rules and templates in Manage Detection Rules button always display
Load pre-built Elastic Rules and Timeline Templates
even if the templates have already been loaded.Steps to Verify
./timelines/delete_all_timelines.sh
to delete all the existing timelines and templates.Load pre-built Elastic Rules and Timeline Templates
template
. Wait for templates to loadManage Detection Rules
page, the button text should becomeLoad pre-built Elastic Rules
Checklist
Delete any items that are not applicable to this PR.