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

[Cases] Fix case view flaky tests #160412

Merged
merged 24 commits into from
Jun 27, 2023

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented Jun 23, 2023

Summary

This PR fixes flaky tests in x-pack/plugins/cases/public/components/case_view/case_view_page.test.tsx. Some of them were converted to an e2e test as they were too slow to be on a unit test.

Successful runs:

Fixes: #149775, #149776, #149777, #149778, #149779, #149780, #149781, #149782, #153335, #153336, #149773, #149774, #149772, #149771, #149770, #149769, #151845, #153336, #153335

Flaky test runner: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2500

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature v8.9.0 v8.10.0 labels Jun 23, 2023
@cnasikas cnasikas self-assigned this Jun 23, 2023
This was linked to issues Jun 25, 2023
@cnasikas cnasikas requested a review from a team as a code owner June 27, 2023 06:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

expect(result.getByTestId('case-view-status-dropdown')).toHaveTextContent('Closed');
});

it('should update status', async () => {
Copy link
Member Author

@cnasikas cnasikas Jun 27, 2023

Choose a reason for hiding this comment

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

It was flaky. We have an e2e for that.

});
});

it('should update title', async () => {
Copy link
Member Author

@cnasikas cnasikas Jun 27, 2023

Choose a reason for hiding this comment

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

It was flaky. We have an e2e for that.


it('should update connector', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

It was flaky. We already test this scenario in the x-pack/plugins/cases/public/components/edit_connector/connectors_form.test.tsx file.

});
});

it.skip('it should persist the draft of new comment while description is updated', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Too slow. Moved it as an e2e (skipped).

});

describe('breadcrumbs', () => {
it('should set the cases title', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

It was flaky. We have an e2e for that.

@cnasikas cnasikas force-pushed the fix_case_view_flaky_tests branch from f3efff4 to e344caa Compare June 27, 2023 07:46
@cnasikas cnasikas force-pushed the fix_case_view_flaky_tests branch from e344caa to abaead4 Compare June 27, 2023 07:51
Copy link
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

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

Changes looks good, thanks for doing this!! 👍

* where this test randomly reproduces thus making the test flaky.
* Skipping for now until we fix it.
*/
it.skip('should persist the draft of new comment while description is updated', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I will fix it in a separate PR, there is already an issue for it. #151845

expect(result.container.querySelector('.euiCallOut--danger')).not.toBeInTheDocument();
expect(await screen.findByTestId('edit-connectors')).toBeInTheDocument();
expect(
screen.queryByTestId('case-callout-a25a5b368b6409b179ef4b6c5168244f')
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the test id stay the same across test runs?

Copy link
Member Author

Choose a reason for hiding this comment

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

I discovered that yes! The footprint of this callout is the same. This is the expected behavior.

@@ -90,7 +90,7 @@ export const EditConnector = React.memo(
!needsToBePushed;

return (
<EuiFlexItem grow={false}>
<EuiFlexItem grow={false} data-test-subj="sidebar-connectors">
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe prefix these with cases-

* fast to the cases table and the comment is not
* persisted
*/
await setTimeoutAsync(2000);
Copy link
Contributor

Choose a reason for hiding this comment

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

@kibana-ci
Copy link
Collaborator

💚 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
cases 420.8KB 420.9KB +116.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
cases 58 59 +1
enterpriseSearch 14 16 +2
securitySolution 416 420 +4
total +7

Total ESLint disabled count

id before after diff
cases 75 76 +1
enterpriseSearch 15 17 +2
securitySolution 497 501 +4
total +7

History

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

cc @cnasikas

@cnasikas cnasikas merged commit c0047a1 into elastic:main Jun 27, 2023
@cnasikas cnasikas deleted the fix_case_view_flaky_tests branch June 27, 2023 13:57
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 27, 2023
## Summary

This PR fixes flaky tests in
`x-pack/plugins/cases/public/components/case_view/case_view_page.test.tsx`.
Some of them were converted to an e2e test as they were too slow to be
on a unit test.

Successful runs:

-
elastic@a4ed839
(50 times)
-
elastic@82ccceb
(45 times)
-
elastic@43c47e6
(20 times)

Fixes: elastic#149775,
elastic#149776,
elastic#149777,
elastic#149778,
elastic#149779,
elastic#149780,
elastic#149781,
elastic#149782,
elastic#153335,
elastic#153336,
elastic#149773,
elastic#149774,
elastic#149772,
elastic#149771,
elastic#149770,
elastic#149769,
elastic#151845,
elastic#153336,
elastic#153335

Flaky test runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2500

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

(cherry picked from commit c0047a1)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.9

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 27, 2023
# Backport

This will backport the following commits from `main` to `8.9`:
- [[Cases] Fix case view flaky tests
(#160412)](#160412)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Christos
Nasikas","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-06-27T13:57:30Z","message":"[Cases]
Fix case view flaky tests (#160412)\n\n## Summary\r\n\r\nThis PR fixes
flaky tests
in\r\n`x-pack/plugins/cases/public/components/case_view/case_view_page.test.tsx`.\r\nSome
of them were converted to an e2e test as they were too slow to be\r\non
a unit test.\r\n\r\nSuccessful runs:
\r\n\r\n-\r\nhttps://github.com//pull/160412/commits/a4ed8390d45b628ee4328c3655164c94449e3dc8\r\n(50
times)\r\n-\r\nhttps://github.com//pull/160412/commits/82ccceb03aff6f74cd30f80fcaaa0f2b99c28103\r\n(45
times)\r\n-\r\nhttps://github.com//pull/160412/commits/43c47e645b26561c00de97e8a4d965b435a5491b\r\n(20
times)\r\n\r\nFixes:
https://github.com/elastic/kibana/issues/149775,\r\nhttps://github.com/elastic/kibana/issues/149776,\r\nhttps://github.com/elastic/kibana/issues/149777,\r\nhttps://github.com/elastic/kibana/issues/149778,\r\nhttps://github.com/elastic/kibana/issues/149779,\r\nhttps://github.com/elastic/kibana/issues/149780,\r\nhttps://github.com/elastic/kibana/issues/149781,\r\nhttps://github.com/elastic/kibana/issues/149782,\r\nhttps://github.com/elastic/kibana/issues/153335,\r\nhttps://github.com/elastic/kibana/issues/153336,\r\nhttps://github.com/elastic/kibana/issues/149773,\r\nhttps://github.com/elastic/kibana/issues/149774,\r\nhttps://github.com/elastic/kibana/issues/149772,\r\nhttps://github.com/elastic/kibana/issues/149771,\r\nhttps://github.com/elastic/kibana/issues/149770,\r\nhttps://github.com/elastic/kibana/issues/149769,\r\nhttps://github.com/elastic/kibana/issues/151845,\r\nhttps://github.com/elastic/kibana/issues/153336,\r\nhttps://github.com/elastic/kibana/issues/153335\r\n\r\nFlaky
test
runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2500\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"c0047a1b94d898a16e4a5aad94663f07b5b06e52","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","Feature:Cases","v8.9.0","v8.10.0"],"number":160412,"url":"https://github.com/elastic/kibana/pull/160412","mergeCommit":{"message":"[Cases]
Fix case view flaky tests (#160412)\n\n## Summary\r\n\r\nThis PR fixes
flaky tests
in\r\n`x-pack/plugins/cases/public/components/case_view/case_view_page.test.tsx`.\r\nSome
of them were converted to an e2e test as they were too slow to be\r\non
a unit test.\r\n\r\nSuccessful runs:
\r\n\r\n-\r\nhttps://github.com//pull/160412/commits/a4ed8390d45b628ee4328c3655164c94449e3dc8\r\n(50
times)\r\n-\r\nhttps://github.com//pull/160412/commits/82ccceb03aff6f74cd30f80fcaaa0f2b99c28103\r\n(45
times)\r\n-\r\nhttps://github.com//pull/160412/commits/43c47e645b26561c00de97e8a4d965b435a5491b\r\n(20
times)\r\n\r\nFixes:
https://github.com/elastic/kibana/issues/149775,\r\nhttps://github.com/elastic/kibana/issues/149776,\r\nhttps://github.com/elastic/kibana/issues/149777,\r\nhttps://github.com/elastic/kibana/issues/149778,\r\nhttps://github.com/elastic/kibana/issues/149779,\r\nhttps://github.com/elastic/kibana/issues/149780,\r\nhttps://github.com/elastic/kibana/issues/149781,\r\nhttps://github.com/elastic/kibana/issues/149782,\r\nhttps://github.com/elastic/kibana/issues/153335,\r\nhttps://github.com/elastic/kibana/issues/153336,\r\nhttps://github.com/elastic/kibana/issues/149773,\r\nhttps://github.com/elastic/kibana/issues/149774,\r\nhttps://github.com/elastic/kibana/issues/149772,\r\nhttps://github.com/elastic/kibana/issues/149771,\r\nhttps://github.com/elastic/kibana/issues/149770,\r\nhttps://github.com/elastic/kibana/issues/149769,\r\nhttps://github.com/elastic/kibana/issues/151845,\r\nhttps://github.com/elastic/kibana/issues/153336,\r\nhttps://github.com/elastic/kibana/issues/153335\r\n\r\nFlaky
test
runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2500\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"c0047a1b94d898a16e4a5aad94663f07b5b06e52"}},"sourceBranch":"main","suggestedTargetBranches":["8.9"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/160412","number":160412,"mergeCommit":{"message":"[Cases]
Fix case view flaky tests (#160412)\n\n## Summary\r\n\r\nThis PR fixes
flaky tests
in\r\n`x-pack/plugins/cases/public/components/case_view/case_view_page.test.tsx`.\r\nSome
of them were converted to an e2e test as they were too slow to be\r\non
a unit test.\r\n\r\nSuccessful runs:
\r\n\r\n-\r\nhttps://github.com//pull/160412/commits/a4ed8390d45b628ee4328c3655164c94449e3dc8\r\n(50
times)\r\n-\r\nhttps://github.com//pull/160412/commits/82ccceb03aff6f74cd30f80fcaaa0f2b99c28103\r\n(45
times)\r\n-\r\nhttps://github.com//pull/160412/commits/43c47e645b26561c00de97e8a4d965b435a5491b\r\n(20
times)\r\n\r\nFixes:
https://github.com/elastic/kibana/issues/149775,\r\nhttps://github.com/elastic/kibana/issues/149776,\r\nhttps://github.com/elastic/kibana/issues/149777,\r\nhttps://github.com/elastic/kibana/issues/149778,\r\nhttps://github.com/elastic/kibana/issues/149779,\r\nhttps://github.com/elastic/kibana/issues/149780,\r\nhttps://github.com/elastic/kibana/issues/149781,\r\nhttps://github.com/elastic/kibana/issues/149782,\r\nhttps://github.com/elastic/kibana/issues/153335,\r\nhttps://github.com/elastic/kibana/issues/153336,\r\nhttps://github.com/elastic/kibana/issues/149773,\r\nhttps://github.com/elastic/kibana/issues/149774,\r\nhttps://github.com/elastic/kibana/issues/149772,\r\nhttps://github.com/elastic/kibana/issues/149771,\r\nhttps://github.com/elastic/kibana/issues/149770,\r\nhttps://github.com/elastic/kibana/issues/149769,\r\nhttps://github.com/elastic/kibana/issues/151845,\r\nhttps://github.com/elastic/kibana/issues/153336,\r\nhttps://github.com/elastic/kibana/issues/153335\r\n\r\nFlaky
test
runner:\r\nhttps://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2500\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"c0047a1b94d898a16e4a5aad94663f07b5b06e52"}}]}]
BACKPORT-->

Co-authored-by: Christos Nasikas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.9.0 v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failing test: Jest Tests.x-pack/plugins/cases/public/components/case_view - CaseViewPage Tabs renders the activity tab when the query parameter tabId has activity Failing test: Jest Tests.x-pack/plugins/cases/public/components/case_view - CaseViewPage Tabs renders the alerts tab when the query parameter tabId has alerts Failing test: Jest Tests.x-pack/plugins/cases/public/components/case_view - CaseViewPage Tabs renders the activity tab by default Failing test: Jest Tests.x-pack/plugins/cases/public/components/case_view - CaseViewPage Tabs renders tabs correctly Failing test: Jest Tests.x-pack/plugins/cases/public/components/case_view - CaseViewPage Callouts it shows the danger callout when a connector has been deleted
7 participants