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

Failing test: Jest Tests.x-pack/plugins/cases/public/components/create - Create case Step 2 - Connector Fields should submit and push to resilient connector #143408

Closed
kibanamachine opened this issue Oct 14, 2022 · 10 comments · Fixed by #157380
Assignees
Labels
failed-test A test failure on a tracked branch, potentially flaky-test Feature:Cases Cases feature Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)

Comments

@kibanamachine
Copy link
Contributor

kibanamachine commented Oct 14, 2022

A test failed on a tracked branch

TestingLibraryElementError: Unable to find an element by: [data-test-subj="caseTitle"]

Ignored nodes: comments, <script />, <style />
<body
  class=""
>
  <div />
</body>
    at Object.getElementError (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/@testing-library/dom/dist/config.js:38:19)
    at /var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/@testing-library/dom/dist/query-helpers.js:90:38
    at /var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/@testing-library/dom/dist/query-helpers.js:62:17
    at getByTestId (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/@testing-library/dom/dist/query-helpers.js:111:19)
    at fillFormReactTestingLib (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/x-pack/plugins/cases/public/components/create/form_context.test.tsx:104:42)
    at Object.<anonymous> (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/x-pack/plugins/cases/public/components/create/form_context.test.tsx:502:13)
    at Promise.then.completed (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/utils.js:276:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/utils.js:216:10)
    at _callCircusTest (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/run.js:212:40)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processTimers (node:internal/timers:499:9)
    at _runTest (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/run.js:149:3)
    at _runTestsForDescribeBlock (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/run.js:63:9)
    at _runTestsForDescribeBlock (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/run.js:57:9)
    at _runTestsForDescribeBlock (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/run.js:57:9)
    at run (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/run.js:25:3)
    at runAndTransformResultsToJestFormat (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:176:21)
    at jestAdapter (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:109:19)
    at runTestInternal (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-runner/build/runTest.js:380:16)
    at runTest (/var/lib/buildkite-agent/builds/kb-n2-4-spot-44d53f83b83faf14/elastic/kibana-on-merge/kibana/node_modules/jest-runner/build/runTest.js:472:34)

First failure: CI Build - main

@kibanamachine kibanamachine added the failed-test A test failure on a tracked branch, potentially flaky-test label Oct 14, 2022
@botelastic botelastic bot added the needs-team Issues missing a team label label Oct 14, 2022
@kibanamachine kibanamachine added the Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) label Oct 14, 2022
@elasticmachine
Copy link
Contributor

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

@botelastic botelastic bot removed the needs-team Issues missing a team label label Oct 14, 2022
@cnasikas cnasikas added the Feature:Cases Cases feature label Oct 17, 2022
@cnasikas cnasikas self-assigned this Nov 15, 2022
@cnasikas cnasikas linked a pull request Nov 15, 2022 that will close this issue
2 tasks
cnasikas added a commit that referenced this issue Nov 16, 2022
## Summary

This PR fixes a number of issues with the same error:
`TestingLibraryElementError: Unable to find an element by:
[data-test-subj="caseTitle"]`. The PR:

- Clears unnecessary `act`
- Wait for the form to render before trying to fill the form
- Wait for the component to update all states to eliminate warnings
- Fill tags when necessary to improve tests execution time
- Replace `userEvent.type` with `userEvent.aste` when possible to
improve execution time
- Add `skipPointerEventsCheck: true` when necessary

I run the test file 100 times locally without any errors.

Fixes: #142287,
#142288,
#142285,
#142286,
#142284,
#142283,
#142282,
#142281,
#143407,
#143406,
#143405,
#143408,
#143403

### 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)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Nov 16, 2022
## Summary

This PR fixes a number of issues with the same error:
`TestingLibraryElementError: Unable to find an element by:
[data-test-subj="caseTitle"]`. The PR:

- Clears unnecessary `act`
- Wait for the form to render before trying to fill the form
- Wait for the component to update all states to eliminate warnings
- Fill tags when necessary to improve tests execution time
- Replace `userEvent.type` with `userEvent.aste` when possible to
improve execution time
- Add `skipPointerEventsCheck: true` when necessary

I run the test file 100 times locally without any errors.

Fixes: elastic#142287,
elastic#142288,
elastic#142285,
elastic#142286,
elastic#142284,
elastic#142283,
elastic#142282,
elastic#142281,
elastic#143407,
elastic#143406,
elastic#143405,
elastic#143408,
elastic#143403

### 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 6936644)
benakansara pushed a commit to benakansara/kibana that referenced this issue Nov 17, 2022
## Summary

This PR fixes a number of issues with the same error:
`TestingLibraryElementError: Unable to find an element by:
[data-test-subj="caseTitle"]`. The PR:

- Clears unnecessary `act`
- Wait for the form to render before trying to fill the form
- Wait for the component to update all states to eliminate warnings
- Fill tags when necessary to improve tests execution time
- Replace `userEvent.type` with `userEvent.aste` when possible to
improve execution time
- Add `skipPointerEventsCheck: true` when necessary

I run the test file 100 times locally without any errors.

Fixes: elastic#142287,
elastic#142288,
elastic#142285,
elastic#142286,
elastic#142284,
elastic#142283,
elastic#142282,
elastic#142281,
elastic#143407,
elastic#143406,
elastic#143405,
elastic#143408,
elastic#143403

### 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)
@kibanamachine kibanamachine reopened this Nov 23, 2022
@kibanamachine
Copy link
Contributor Author

New failure: CI Build - 8.6

@tylersmalley
Copy link
Contributor

@cnasikas, can we also get this backported, or would you prefer we skipped for 8.6?

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - 8.6

@cnasikas
Copy link
Member

@tylersmalley I backported the fix in #146213.

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - 8.6

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - 8.6

mistic added a commit that referenced this issue Nov 24, 2022
@mistic
Copy link
Member

mistic commented Nov 24, 2022

Skipped.

8.6: 69c72cb

@kibanamachine
Copy link
Contributor Author

New failure: CI Build - main

mistic added a commit that referenced this issue Nov 28, 2022
@mistic
Copy link
Member

mistic commented Nov 28, 2022

Skipped.

main: 48924de

@mistic mistic added the v8.7.0 label Nov 28, 2022
@cnasikas cnasikas linked a pull request Feb 12, 2023 that will close this issue
2 tasks
@cnasikas cnasikas removed a link to a pull request May 14, 2023
2 tasks
@cnasikas cnasikas linked a pull request May 14, 2023 that will close this issue
3 tasks
@cnasikas cnasikas removed the v8.8.0 label May 16, 2023
cnasikas added a commit that referenced this issue May 22, 2023
## Summary

This PR converts all connector forms to use the form lib.

Fixes: #133467,
#143408,
#146394

## Notable changes
- All connector's hooks were converted to use React Query
- All connector's forms were converted to use the Kibana Form Lib
- The form of fields of the connector and the preview of the fields of
the connector got separated
- All connector logic in the case view page moved on its own component
- Improve loading visualization on the first render
- Jira: Issue type is not selected automatically
- Jira: Added validation for the issue type field
- ServiceNow: Subcategory is visible

## Testing scenarios

- Create a case with no connectors. Press "Add connector". The Save
button should be disabled
- Create a case (or edit an existing one) with a connector. Press the
edit pencil. The Save button should be disabled
- Create a case (or edit an existing one) with a connector. Press the
edit pencil. Change a field or a connector. The Save button should not
be disabled
- Change various connectors and their fields on a case. The fields
should be preserved between changes
- Change various connectors and their fields on a case
- Test the forms of all supported connectors in the create case and the
view case page
- Push all supported connectors in the create case and the view case
page and verify it is working as expected
- Optional fields can be pushed correctly
- Check that the fields are being reset when changing connectors of the
same type (Jira for example)
- Test that connectors work in the create case form when attaching
outside of Cases (ML for example)
- Jira: Try to submit without an issue type selected. You should see an
error
- ServiceNow: Test that the subcategory is being reset when you change
the category.

## Flaky tests

The PR fixes the flaky tests in
`x-pack/plugins/cases/public/components/create/form_context.test.tsx`. I
run the test multiple times on CI to ensure that the test is not flaky
anymore: Specifically:
- Test run 50 times in
f220cc3
- Test run 55 times in
6221314
- Test run 50 times in
9155163

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [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)

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
delanni pushed a commit to delanni/kibana that referenced this issue May 25, 2023
## Summary

This PR converts all connector forms to use the form lib.

Fixes: elastic#133467,
elastic#143408,
elastic#146394

## Notable changes
- All connector's hooks were converted to use React Query
- All connector's forms were converted to use the Kibana Form Lib
- The form of fields of the connector and the preview of the fields of
the connector got separated
- All connector logic in the case view page moved on its own component
- Improve loading visualization on the first render
- Jira: Issue type is not selected automatically
- Jira: Added validation for the issue type field
- ServiceNow: Subcategory is visible

## Testing scenarios

- Create a case with no connectors. Press "Add connector". The Save
button should be disabled
- Create a case (or edit an existing one) with a connector. Press the
edit pencil. The Save button should be disabled
- Create a case (or edit an existing one) with a connector. Press the
edit pencil. Change a field or a connector. The Save button should not
be disabled
- Change various connectors and their fields on a case. The fields
should be preserved between changes
- Change various connectors and their fields on a case
- Test the forms of all supported connectors in the create case and the
view case page
- Push all supported connectors in the create case and the view case
page and verify it is working as expected
- Optional fields can be pushed correctly
- Check that the fields are being reset when changing connectors of the
same type (Jira for example)
- Test that connectors work in the create case form when attaching
outside of Cases (ML for example)
- Jira: Try to submit without an issue type selected. You should see an
error
- ServiceNow: Test that the subcategory is being reset when you change
the category.

## Flaky tests

The PR fixes the flaky tests in
`x-pack/plugins/cases/public/components/create/form_context.test.tsx`. I
run the test multiple times on CI to ensure that the test is not flaky
anymore: Specifically:
- Test run 50 times in
elastic@f220cc3
- Test run 55 times in
elastic@6221314
- Test run 50 times in
elastic@9155163

### Checklist

Delete any items that are not applicable to this PR.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [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)

---------

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
failed-test A test failure on a tracked branch, potentially flaky-test Feature:Cases Cases feature Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants