[Security Solution] Update button text according to status#80389
[Security Solution] Update button text according to status#80389angorayc merged 8 commits intoelastic:masterfrom
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.
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.
if you get stuck and want to zoom let me know!
stephmilovic
left a comment
There was a problem hiding this comment.
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!
stephmilovic
left a comment
There was a problem hiding this comment.
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 Templateseven if the templates have already been loaded.Steps to Verify
./timelines/delete_all_timelines.shto delete all the existing timelines and templates.Load pre-built Elastic Rules and Timeline Templatestemplate. Wait for templates to loadManage Detection Rulespage, the button text should becomeLoad pre-built Elastic RulesChecklist
Delete any items that are not applicable to this PR.