Skip to content
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][Case] Attach alerts to cases: Tests #86305

Merged
merged 30 commits into from
Jan 11, 2021

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented Dec 17, 2020

Summary

This PR adds and improves tests for the attach alerts to cases feature.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas self-assigned this Dec 17, 2020
@cnasikas cnasikas added v7.11.0 v7.12.0 release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting Security Solution Threat Hunting Team v8.0.0 and removed v7.11.0 labels Dec 17, 2020
@cnasikas cnasikas force-pushed the case_alerts_tests branch 5 times, most recently from 54fb8cd to fa5abae Compare December 23, 2020 20:27
@cnasikas cnasikas marked this pull request as ready for review January 4, 2021 14:47
@cnasikas cnasikas requested review from a team as code owners January 4, 2021 14:47
@cnasikas cnasikas force-pushed the case_alerts_tests branch 2 times, most recently from a958454 to 20984ef Compare January 5, 2021 16:26
it('it toggles the switch', async () => {
const wrapper = mount(<SyncAlertsSwitch disabled={false} />);

act(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use waitFor here instead. See: https://kentcdodds.com/blog/common-mistakes-with-react-testing-library. You can also get rid of the wrapper.update. that article says do the side effect, then wrap the expect in waitFor:

  it('it toggles the switch', async () => {
    const wrapper = mount(<SyncAlertsSwitch disabled={false} />);

    wrapper.find('button[data-test-subj="sync-alerts-switch"]').first().simulate('click');
    await waitFor(() => {
      expect(wrapper.find('[data-test-subj="sync-alerts-switch"]').first().prop('checked')).toBe(
        false
      );
    });
  });

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the article!

@cnasikas cnasikas requested a review from stephmilovic January 7, 2021 17:41
@cnasikas
Copy link
Member Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 8.5MB 8.5MB +461.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for making those changes. LGTM!

@cnasikas cnasikas merged commit a1931ac into elastic:master Jan 11, 2021
@cnasikas cnasikas deleted the case_alerts_tests branch January 11, 2021 15:44
cnasikas added a commit to cnasikas/kibana that referenced this pull request Jan 11, 2021
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
cnasikas added a commit to cnasikas/kibana that referenced this pull request Jan 11, 2021
Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
cnasikas added a commit that referenced this pull request Jan 11, 2021
… (#87861)

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
cnasikas added a commit that referenced this pull request Jan 11, 2021
#87860)

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting Security Solution Threat Hunting Team v7.11.0 v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants