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

[7.x] [ML] Converts utils Mocha tests to Jest (#63132) #63487

Merged
merged 1 commit into from
Apr 14, 2020

Conversation

peteharverson
Copy link
Contributor

Backports the following commits to 7.x:

* [ML] Converts utils Mocha tests to Jest

* [ML] Remove unused imports

* [ML] Switch out enzyme mount for react testing library render

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / kibana-xpack-agent / X-Pack Endpoint Functional Tests.x-pack/test/functional_endpoint/apps/endpoint/host_list·ts.endpoint host list has a url with a host id displays details row headers

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches

[00:00:00]       │
[00:00:00]         └-: endpoint
[00:00:00]           └-> "before all" hook
[00:01:24]           └-: host list
[00:01:24]             └-> "before all" hook
[00:01:24]             └-> "before all" hook
[00:01:24]               │ info [endpoint/metadata/api_feature] Loading "mappings.json"
[00:01:24]               │ info [endpoint/metadata/api_feature] Loading "data.json"
[00:01:24]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-centos-tests-xl-1586883164949784224] applying create index request using v1 templates []
[00:01:25]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-centos-tests-xl-1586883164949784224] [endpoint-agent-1] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:01:25]               │ info [endpoint/metadata/api_feature] Created index "endpoint-agent-1"
[00:01:25]               │ debg [endpoint/metadata/api_feature] "endpoint-agent-1" settings {"index":{"number_of_replicas":"1","number_of_shards":"1"}}
[00:01:25]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-centos-tests-xl-1586883164949784224] [endpoint-agent-1/LLa7YAsqRAGydlGSyAw_bA] update_mapping [_doc]
[00:01:25]               │ info [endpoint/metadata/api_feature] Indexed 9 docs into "endpoint-agent-1"
[00:01:25]               │ debg navigateToActualUrl http://localhost:6171/app/endpoint/hosts
[00:01:25]               │ debg browser[INFO] http://localhost:6171/app/endpoint/hosts?_t=1586887769868 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:01:25]               │
[00:01:25]               │ debg browser[INFO] http://localhost:6171/bundles/app/core/bootstrap.js 9:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:01:25]               │ debg currentUrl = http://localhost:6171/app/endpoint/hosts
[00:01:25]               │          appUrl = http://localhost:6171/app/endpoint/hosts
[00:01:25]               │ debg TestSubjects.find(kibanaChrome)
[00:01:25]               │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:01:30]               │ debg isGlobalLoadingIndicatorVisible
[00:01:30]               │ debg TestSubjects.exists(globalLoadingIndicator)
[00:01:30]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:01:30]               │ debg browser[INFO] http://localhost:6171/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 380:106115 "INFO: 2020-04-14T18:09:34Z
[00:01:30]               │        Adding connection to http://localhost:6171/elasticsearch
[00:01:30]               │
[00:01:30]               │      "
[00:01:30]               │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:01:30]               │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:01:30]             └-> finds title
[00:01:30]               └-> "before each" hook: global before each
[00:01:30]               │ debg TestSubjects.getVisibleText(hostListTitle)
[00:01:30]               │ debg TestSubjects.find(hostListTitle)
[00:01:30]               │ debg Find.findByCssSelector('[data-test-subj="hostListTitle"]') with timeout=10000
[00:01:30]               └- ✓ pass  (28ms) "endpoint host list finds title"
[00:01:30]             └-> displays table data
[00:01:30]               └-> "before each" hook: global before each
[00:01:30]               │ debg TestSubjects.exists(hostListTable)
[00:01:30]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="hostListTable"]') with timeout=2500
[00:01:30]               │ debg TestSubjects.find(hostListTable)
[00:01:30]               │ debg Find.findByCssSelector('[data-test-subj="hostListTable"]') with timeout=10000
[00:01:31]               └- ✓ pass  (100ms) "endpoint host list displays table data"
[00:01:31]             └-> no details flyout when host page displayed
[00:01:31]               └-> "before each" hook: global before each
[00:01:31]               │ debg TestSubjects.missingOrFail(hostDetailsFlyout)
[00:01:31]               │ debg Find.waitForDeletedByCssSelector('[data-test-subj="hostDetailsFlyout"]') with timeout=2500
[00:01:31]               └- ✓ pass  (546ms) "endpoint host list no details flyout when host page displayed"
[00:01:31]             └-> display details flyout when the hostname is clicked on
[00:01:31]               └-> "before each" hook: global before each
[00:01:31]               │ debg TestSubjects.find(hostnameCellLink)
[00:01:31]               │ debg Find.findByCssSelector('[data-test-subj="hostnameCellLink"]') with timeout=10000
[00:01:31]               │ debg TestSubjects.exists(hostDetailsUpperList)
[00:01:31]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="hostDetailsUpperList"]') with timeout=120000
[00:01:31]               │ debg TestSubjects.exists(hostDetailsLowerList)
[00:01:31]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="hostDetailsLowerList"]') with timeout=120000
[00:01:32]               └- ✓ pass  (405ms) "endpoint host list display details flyout when the hostname is clicked on"
[00:01:32]             └-> update details flyout when new hostname is clicked on
[00:01:32]               └-> "before each" hook: global before each
[00:01:32]               │ debg TestSubjects.findAll(hostnameCellLink)
[00:01:32]               │ debg Find.allByCssSelector('[data-test-subj="hostnameCellLink"]') with timeout=10000
[00:01:32]               │ debg TestSubjects.exists(hostDetailsFlyoutTitle)
[00:01:32]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="hostDetailsFlyoutTitle"]') with timeout=120000
[00:01:32]               │ debg TestSubjects.getVisibleText(hostDetailsFlyoutTitle)
[00:01:32]               │ debg TestSubjects.find(hostDetailsFlyoutTitle)
[00:01:32]               │ debg Find.findByCssSelector('[data-test-subj="hostDetailsFlyoutTitle"]') with timeout=10000
[00:01:32]               │ debg TestSubjects.findAll(hostnameCellLink)
[00:01:32]               │ debg Find.allByCssSelector('[data-test-subj="hostnameCellLink"]') with timeout=10000
[00:01:32]               │ debg Waiting up to 2000ms for visible text to change...
[00:01:32]               │ debg TestSubjects.getVisibleText(hostDetailsFlyoutTitle)
[00:01:32]               │ debg TestSubjects.find(hostDetailsFlyoutTitle)
[00:01:32]               │ debg Find.findByCssSelector('[data-test-subj="hostDetailsFlyoutTitle"]') with timeout=10000
[00:01:32]               │ debg TestSubjects.getVisibleText(hostDetailsFlyoutTitle)
[00:01:32]               │ debg TestSubjects.find(hostDetailsFlyoutTitle)
[00:01:32]               │ debg Find.findByCssSelector('[data-test-subj="hostDetailsFlyoutTitle"]') with timeout=10000
[00:01:32]               │ debg TestSubjects.getVisibleText(hostDetailsFlyoutTitle)
[00:01:32]               │ debg TestSubjects.find(hostDetailsFlyoutTitle)
[00:01:32]               │ debg Find.findByCssSelector('[data-test-subj="hostDetailsFlyoutTitle"]') with timeout=10000
[00:01:33]               └- ✓ pass  (1.0s) "endpoint host list update details flyout when new hostname is clicked on"
[00:01:33]             └-> details flyout remains the same when current hostname is clicked on
[00:01:33]               └-> "before each" hook: global before each
[00:01:33]               │ debg TestSubjects.findAll(hostnameCellLink)
[00:01:33]               │ debg Find.allByCssSelector('[data-test-subj="hostnameCellLink"]') with timeout=10000
[00:01:33]               │ debg TestSubjects.exists(hostDetailsFlyoutTitle)
[00:01:33]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="hostDetailsFlyoutTitle"]') with timeout=120000
[00:01:33]               │ debg TestSubjects.getVisibleText(hostDetailsFlyoutTitle)
[00:01:33]               │ debg TestSubjects.find(hostDetailsFlyoutTitle)
[00:01:33]               │ debg Find.findByCssSelector('[data-test-subj="hostDetailsFlyoutTitle"]') with timeout=10000
[00:01:33]               │ debg TestSubjects.findAll(hostnameCellLink)
[00:01:33]               │ debg Find.allByCssSelector('[data-test-subj="hostnameCellLink"]') with timeout=10000
[00:01:33]               │ debg TestSubjects.getVisibleText(hostDetailsFlyoutTitle)
[00:01:33]               │ debg TestSubjects.find(hostDetailsFlyoutTitle)
[00:01:33]               │ debg Find.findByCssSelector('[data-test-subj="hostDetailsFlyoutTitle"]') with timeout=10000
[00:01:33]               └- ✓ pass  (962ms) "endpoint host list details flyout remains the same when current hostname is clicked on"
[00:01:33]             └-: no data
[00:01:33]               └-> "before all" hook
[00:01:33]               └-> "before all" hook
[00:01:34]                 │ info [endpoint/metadata/api_feature] Unloading indices from "mappings.json"
[00:01:34]                 │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-centos-tests-xl-1586883164949784224] [endpoint-agent-1/LLa7YAsqRAGydlGSyAw_bA] deleting index
[00:01:34]                 │ info [endpoint/metadata/api_feature] Deleted existing index "endpoint-agent-1"
[00:01:34]                 │ info [endpoint/metadata/api_feature] Unloading indices from "data.json"
[00:01:34]                 │ debg navigateToActualUrl http://localhost:6171/app/endpoint/hosts
[00:01:34]                 │ debg browser[INFO] http://localhost:6171/app/endpoint/hosts?_t=1586887778790 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:01:34]                 │
[00:01:34]                 │ debg browser[INFO] http://localhost:6171/bundles/app/core/bootstrap.js 9:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:01:34]                 │ debg currentUrl = http://localhost:6171/app/endpoint/hosts
[00:01:34]                 │          appUrl = http://localhost:6171/app/endpoint/hosts
[00:01:34]                 │ debg TestSubjects.find(kibanaChrome)
[00:01:34]                 │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:01:39]                 │ debg isGlobalLoadingIndicatorVisible
[00:01:39]                 │ debg TestSubjects.exists(globalLoadingIndicator)
[00:01:39]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:01:39]                 │ debg browser[INFO] http://localhost:6171/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 380:106115 "INFO: 2020-04-14T18:09:43Z
[00:01:39]                 │        Adding connection to http://localhost:6171/elasticsearch
[00:01:39]                 │
[00:01:39]                 │      "
[00:01:39]                 │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:01:39]                 │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:01:40]             └-: has a url with a host id
[00:01:40]               └-> "before all" hook
[00:01:40]               └-> "before all" hook
[00:01:40]                 │ debg navigateToActualUrl http://localhost:6171/app/endpoint/hosts?selected_host=fc0ff548-feba-41b6-8367-65e8790d0eaf
[00:01:40]                 │ debg browser[INFO] http://localhost:6171/app/endpoint/hosts?selected_host=fc0ff548-feba-41b6-8367-65e8790d0eaf&_t=1586887784720 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:01:40]                 │
[00:01:40]                 │ debg browser[INFO] http://localhost:6171/bundles/app/core/bootstrap.js 9:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:01:40]                 │ debg currentUrl = http://localhost:6171/app/endpoint/hosts?selected_host=fc0ff548-feba-41b6-8367-65e8790d0eaf
[00:01:40]                 │          appUrl = http://localhost:6171/app/endpoint/hosts?selected_host=fc0ff548-feba-41b6-8367-65e8790d0eaf
[00:01:40]                 │ debg TestSubjects.find(kibanaChrome)
[00:01:40]                 │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:01:44]                 │ debg isGlobalLoadingIndicatorVisible
[00:01:44]                 │ debg TestSubjects.exists(globalLoadingIndicator)
[00:01:44]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:01:44]                 │ debg browser[INFO] http://localhost:6171/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 380:106115 "INFO: 2020-04-14T18:09:48Z
[00:01:44]                 │        Adding connection to http://localhost:6171/elasticsearch
[00:01:44]                 │
[00:01:44]                 │      "
[00:01:44]                 │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:01:44]                 │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:01:45]               └-> shows a flyout
[00:01:45]                 └-> "before each" hook: global before each
[00:01:45]                 │ debg TestSubjects.exists(hostDetailsFlyout)
[00:01:45]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="hostDetailsFlyout"]') with timeout=120000
[00:01:45]                 └- ✓ pass  (37ms) "endpoint host list has a url with a host id shows a flyout"
[00:01:45]               └-> displays details row headers
[00:01:45]                 └-> "before each" hook: global before each
[00:01:45]                 │ debg TestSubjects.exists(hostDetailsFlyout)
[00:01:45]                 │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="hostDetailsFlyout"]') with timeout=2500
[00:01:45]                 │ debg TestSubjects.find(hostDetailsFlyout)
[00:01:45]                 │ debg Find.findByCssSelector('[data-test-subj="hostDetailsFlyout"]') with timeout=10000
[00:01:45]                 │ info Taking screenshot "/dev/shm/workspace/kibana/x-pack/test/functional/screenshots/failure/endpoint host list has a url with a host id displays details row headers.png"
[00:01:45]                 │ info Current URL is: http://localhost:6171/app/endpoint/hosts?selected_host=fc0ff548-feba-41b6-8367-65e8790d0eaf
[00:01:45]                 │ info Saving page source to: /dev/shm/workspace/kibana/x-pack/test/functional/failure_debug/html/endpoint host list has a url with a host id displays details row headers.html
[00:01:45]                 └- ✖ fail: "endpoint host list has a url with a host id displays details row headers"
[00:01:45]                 │

Stack Trace

{ Error: expected [] to sort of equal [ 'OS',
  'Last Seen',
  'Alerts',
  'Policy',
  'Policy Status',
  'IP Address',
  'Hostname',
  'Sensor Version' ]
    at Assertion.assert (/dev/shm/workspace/kibana/packages/kbn-expect/expect.js:100:11)
    at Assertion.eql (/dev/shm/workspace/kibana/packages/kbn-expect/expect.js:244:8)
    at Context.it (test/functional_endpoint/apps/endpoint/host_list.ts:159:25)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  actual: '[]',
  expected:
   '[\n  "OS"\n  "Last Seen"\n  "Alerts"\n  "Policy"\n  "Policy Status"\n  "IP Address"\n  "Hostname"\n  "Sensor Version"\n]',
  showDiff: true }

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

@peteharverson peteharverson merged commit 1bf8b6b into elastic:7.x Apr 14, 2020
@peteharverson peteharverson deleted the backport/7.x/pr-63132 branch April 14, 2020 20:13
tsullivan pushed a commit to tsullivan/kibana that referenced this pull request Apr 15, 2020
* [ML] Converts utils Mocha tests to Jest

* [ML] Remove unused imports

* [ML] Switch out enzyme mount for react testing library render

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants