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

APM Storybook fixes #68671

Merged
merged 1 commit into from
Jun 9, 2020
Merged

APM Storybook fixes #68671

merged 1 commit into from
Jun 9, 2020

Conversation

smith
Copy link
Contributor

@smith smith commented Jun 9, 2020

  • Resolve core legacy assets in @kbn/storybook webpack configuration
  • Ignore stories in Jest coverage
  • Combine effects in Cytoscape component so handlers are always added before events are triggered
  • Add mock context to ErrorRateAlertTrigger stories
  • Disable TransactionDurationAlertTrigger stories

Changing the Cytoscape effect behavior is necessary because the layout was not being triggered when the final set of elements is provided as props to the component. When this is used in Kibana we're always starting with empty elements and fetching them, but in the Storybook we're starting out with the full elements.

Fixes #68543.

* Resolve core legacy assets in @kbn/storybook webpack configuration
* Ignore stories in Jest coverage
* Combine effects in Cytoscape component so handlers are always added before events are triggered
* Add mock context to ErrorRateAlertTrigger stories
* Disable TransactionDurationAlertTrigger stories

Changing the Cytoscape effect behavior is necessary because the layout was not being triggered when the final set of elements is provided as props to the component. When this is used in Kibana we're always starting with empty elements and fetching them, but in the Storybook we're starting out with the full elements.
@smith smith added release_note:skip Skip the PR/issue when compiling release notes v7.9.0 labels Jun 9, 2020
@smith smith requested a review from a team as a code owner June 9, 2020 17:11
@botelastic botelastic bot added the Team:APM All issues that need APM UI Team support label Jun 9, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/apm-ui (Team:apm)

return null;
}

// URIs on mixins in src/legacy/public/styles need to be resolved.
Copy link
Member

Choose a reason for hiding this comment

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

any need for the src/legacy/ui/public rewrite? not an issue, just thought i'd ask

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It wasn't affecting us in APM and.I don't know if anybody else is using it so I didn't copy it over.

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / kibana-xpack-agent / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/canvas/custom_elements·ts.Canvas app custom elements adds the custom element to the workpad when prompted

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 5 times on tracked branches: https://github.com/elastic/kibana/issues/63339

[00:00:00]       │
[00:01:27]         └-: Canvas app
[00:01:27]           └-> "before all" hook
[00:02:20]           └-: custom elements
[00:02:20]             └-> "before all" hook
[00:02:20]             └-> "before all" hook
[00:02:20]               │ info [logstash_functional] Loading "mappings.json"
[00:02:20]               │ info [logstash_functional] Loading "data.json.gz"
[00:02:20]               │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.22"
[00:02:20]               │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.20"
[00:02:20]               │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.21"
[00:02:23]               │ info [canvas/default] Loading "mappings.json"
[00:02:23]               │ info [canvas/default] Loading "data.json.gz"
[00:02:23]               │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-centos-tests-xl-1591722681753674887] [.kibana_1/pkcmBOP6R5eaDMFu-ZLjSg] deleting index
[00:02:23]               │ info [o.e.c.m.MetadataDeleteIndexService] [kibana-ci-immutable-centos-tests-xl-1591722681753674887] [.kibana_2/cePl69PwSFaO5CDufuS2tQ] deleting index
[00:02:23]               │ info [canvas/default] Deleted existing index [".kibana_2",".kibana_1"]
[00:02:23]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-centos-tests-xl-1591722681753674887] [.kibana_1] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:02:23]               │ info [canvas/default] Created index ".kibana_1"
[00:02:23]               │ debg [canvas/default] ".kibana_1" settings {"index":{"number_of_replicas":"1","number_of_shards":"1"}}
[00:02:23]               │ info [canvas/default] Indexed 3 docs into ".kibana_1"
[00:02:23]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-centos-tests-xl-1591722681753674887] [.kibana_1/I14_vNLNSs2w5rAQCfvMnA] update_mapping [_doc]
[00:02:23]               │ debg Migrating saved objects
[00:02:24]               │ proc [kibana]   log   [17:51:57.093] [info][savedobjects-service] Creating index .kibana_2.
[00:02:24]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-centos-tests-xl-1591722681753674887] [.kibana_2] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:02:24]               │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-centos-tests-xl-1591722681753674887] updating number_of_replicas to [0] for indices [.kibana_2]
[00:02:24]               │ proc [kibana]   log   [17:51:57.206] [info][savedobjects-service] Migrating .kibana_1 saved objects to .kibana_2
[00:02:24]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-centos-tests-xl-1591722681753674887] [.kibana_2/XVUjBP0wRq-xFFR7ZQMWzw] update_mapping [_doc]
[00:02:24]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-centos-tests-xl-1591722681753674887] [.kibana_2/XVUjBP0wRq-xFFR7ZQMWzw] update_mapping [_doc]
[00:02:24]               │ proc [kibana]   log   [17:51:57.341] [info][savedobjects-service] Pointing alias .kibana to .kibana_2.
[00:02:24]               │ proc [kibana]   log   [17:51:57.403] [info][savedobjects-service] Finished in 312ms.
[00:02:24]               │ debg navigating to canvas url: http://localhost:6131/app/canvas#/
[00:02:24]               │ debg navigate to: http://localhost:6131/app/canvas#/
[00:02:25]               │ debg browser[INFO] http://localhost:6131/app/canvas?_t=1591725117434#/ 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:02:25]               │
[00:02:25]               │ debg browser[INFO] http://localhost:6131/bundles/app/core/bootstrap.js 11:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:02:25]               │ debg ... sleep(700) start
[00:02:25]               │ debg ... sleep(700) end
[00:02:25]               │ debg returned from get, calling refresh
[00:02:28]               │ debg browser[INFO] http://localhost:6131/33699/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 380:106115 "INFO: 2020-06-09T17:51:59Z
[00:02:28]               │        Adding connection to http://localhost:6131/elasticsearch
[00:02:28]               │
[00:02:28]               │      "
[00:02:28]               │ debg browser[INFO] http://localhost:6131/app/canvas?_t=1591725117434#/ 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:02:28]               │
[00:02:28]               │ debg browser[INFO] http://localhost:6131/bundles/app/core/bootstrap.js 11:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:02:28]               │ debg browser[INFO] http://localhost:6131/33699/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 380:106115 "INFO: 2020-06-09T17:52:00Z
[00:02:28]               │        Adding connection to http://localhost:6131/elasticsearch
[00:02:28]               │
[00:02:28]               │      "
[00:02:28]               │ debg currentUrl = http://localhost:6131/app/canvas#/
[00:02:28]               │          appUrl = http://localhost:6131/app/canvas#/
[00:02:28]               │ debg TestSubjects.find(kibanaChrome)
[00:02:28]               │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:02:28]               │ debg ... sleep(501) start
[00:02:28]               │ debg ... sleep(501) end
[00:02:28]               │ debg in navigateTo url = http://localhost:6131/app/canvas#/
[00:02:28]               │ debg TestSubjects.exists(statusPageContainer)
[00:02:28]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="statusPageContainer"]') with timeout=2500
[00:02:31]               │ debg --- retry.tryForTime error: [data-test-subj="statusPageContainer"] is not displayed
[00:02:32]               │ debg navigating to canvas url: http://localhost:6131/app/canvas#/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1
[00:02:32]               │ debg navigate to: http://localhost:6131/app/canvas#/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1
[00:02:32]               │ debg browser[INFO] http://localhost:6131/app/canvas?_t=1591725124617#/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1 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:02:32]               │
[00:02:32]               │ debg browser[INFO] http://localhost:6131/bundles/app/core/bootstrap.js 11:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:02:32]               │ debg ... sleep(700) start
[00:02:32]               │ debg ... sleep(700) end
[00:02:32]               │ debg returned from get, calling refresh
[00:02:35]               │ debg browser[INFO] http://localhost:6131/33699/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 380:106115 "INFO: 2020-06-09T17:52:06Z
[00:02:35]               │        Adding connection to http://localhost:6131/elasticsearch
[00:02:35]               │
[00:02:35]               │      "
[00:02:35]               │ debg browser[INFO] http://localhost:6131/app/canvas?_t=1591725124617#/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1 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:02:35]               │
[00:02:35]               │ debg browser[INFO] http://localhost:6131/bundles/app/core/bootstrap.js 11:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:02:35]               │ debg browser[INFO] http://localhost:6131/33699/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js 380:106115 "INFO: 2020-06-09T17:52:07Z
[00:02:35]               │        Adding connection to http://localhost:6131/elasticsearch
[00:02:35]               │
[00:02:35]               │      "
[00:02:35]               │ debg currentUrl = http://localhost:6131/app/canvas#/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1
[00:02:35]               │          appUrl = http://localhost:6131/app/canvas#/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1
[00:02:35]               │ debg TestSubjects.find(kibanaChrome)
[00:02:35]               │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:02:35]               │ debg ... sleep(501) start
[00:02:36]               │ debg ... sleep(501) end
[00:02:36]               │ debg in navigateTo url = http://localhost:6131/app/canvas#/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1
[00:02:36]               │ debg TestSubjects.exists(statusPageContainer)
[00:02:36]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="statusPageContainer"]') with timeout=2500
[00:02:38]               │ debg --- retry.tryForTime error: [data-test-subj="statusPageContainer"] is not displayed
[00:02:39]             └-> creates a custom element from an element when prompted
[00:02:39]               └-> "before each" hook: global before each
[00:02:39]               │ debg TestSubjects.click(canvasWorkpadPage > canvasWorkpadPageElementContent)
[00:02:39]               │ debg Find.clickByCssSelector('[data-test-subj="canvasWorkpadPage"] [data-test-subj="canvasWorkpadPageElementContent"]') with timeout=20000
[00:02:39]               │ debg Find.findByCssSelector('[data-test-subj="canvasWorkpadPage"] [data-test-subj="canvasWorkpadPageElementContent"]') with timeout=20000
[00:02:39]               │ debg TestSubjects.click(canvasWorkpadEditMenuButton)
[00:02:39]               │ debg Find.clickByCssSelector('[data-test-subj="canvasWorkpadEditMenuButton"]') with timeout=20000
[00:02:39]               │ debg Find.findByCssSelector('[data-test-subj="canvasWorkpadEditMenuButton"]') with timeout=20000
[00:02:39]               │ debg TestSubjects.click(canvasWorkpadEditMenu__saveElementButton)
[00:02:39]               │ debg Find.clickByCssSelector('[data-test-subj="canvasWorkpadEditMenu__saveElementButton"]') with timeout=20000
[00:02:39]               │ debg Find.findByCssSelector('[data-test-subj="canvasWorkpadEditMenu__saveElementButton"]') with timeout=20000
[00:02:40]               │ debg TestSubjects.setValue(canvasCustomElementForm-name, My New Element)
[00:02:40]               │ debg TestSubjects.click(canvasCustomElementForm-name)
[00:02:40]               │ debg Find.clickByCssSelector('[data-test-subj="canvasCustomElementForm-name"]') with timeout=10000
[00:02:40]               │ debg Find.findByCssSelector('[data-test-subj="canvasCustomElementForm-name"]') with timeout=10000
[00:02:40]               │ debg TestSubjects.setValue(canvasCustomElementForm-description, An excellent new element)
[00:02:40]               │ debg TestSubjects.click(canvasCustomElementForm-description)
[00:02:40]               │ debg Find.clickByCssSelector('[data-test-subj="canvasCustomElementForm-description"]') with timeout=10000
[00:02:40]               │ debg Find.findByCssSelector('[data-test-subj="canvasCustomElementForm-description"]') with timeout=10000
[00:02:41]               │ debg TestSubjects.click(canvasCustomElementForm-submit)
[00:02:41]               │ debg Find.clickByCssSelector('[data-test-subj="canvasCustomElementForm-submit"]') with timeout=10000
[00:02:41]               │ debg Find.findByCssSelector('[data-test-subj="canvasCustomElementForm-submit"]') with timeout=10000
[00:02:41]               │ debg TestSubjects.exists(canvasCustomElementCreate-success)
[00:02:41]               │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="canvasCustomElementCreate-success"]') with timeout=30000
[00:02:41]               └- ✓ pass  (2.2s) "Canvas app custom elements creates a custom element from an element when prompted"
[00:02:41]             └-> adds the custom element to the workpad when prompted
[00:02:41]               └-> "before each" hook: global before each
[00:02:41]               │ debg TestSubjects.click(add-element-button)
[00:02:41]               │ debg Find.clickByCssSelector('[data-test-subj="add-element-button"]') with timeout=10000
[00:02:41]               │ debg Find.findByCssSelector('[data-test-subj="add-element-button"]') with timeout=10000
[00:02:41]               │ debg TestSubjects.click(saved-elements-menu-option)
[00:02:41]               │ debg Find.clickByCssSelector('[data-test-subj="saved-elements-menu-option"]') with timeout=10000
[00:02:41]               │ debg Find.findByCssSelector('[data-test-subj="saved-elements-menu-option"]') with timeout=10000
[00:02:42]               │ debg Find.findByCssSelector('.canvasElementCard__wrapper') with timeout=10000
[00:02:42]               │ info Taking screenshot "/dev/shm/workspace/kibana/x-pack/test/functional/screenshots/failure/Canvas app custom elements adds the custom element to the workpad when prompted.png"
[00:02:42]               │ info Current URL is: http://localhost:6131/app/canvas#/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1
[00:02:42]               │ info Saving page source to: /dev/shm/workspace/kibana/x-pack/test/functional/failure_debug/html/Canvas app custom elements adds the custom element to the workpad when prompted.html
[00:02:42]               └- ✖ fail: "Canvas app custom elements adds the custom element to the workpad when prompted"
[00:02:42]               │

Stack Trace

Error: expected '' to contain 'My New Element'
    at Assertion.assert (/dev/shm/workspace/kibana/packages/kbn-expect/expect.js:100:11)
    at Assertion.contain (/dev/shm/workspace/kibana/packages/kbn-expect/expect.js:442:10)
    at Context.it (test/functional/apps/canvas/custom_elements.ts:68:53)
    at process._tickCallback (internal/process/next_tick.js:68:7)

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

Copy link
Contributor

@ogupte ogupte left a comment

Choose a reason for hiding this comment

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

LGTM!

@smith smith merged commit 2e35786 into elastic:master Jun 9, 2020
@smith smith deleted the nls/fix-storybook branch June 9, 2020 21:17
smith added a commit to smith/kibana that referenced this pull request Jun 9, 2020
* Resolve core legacy assets in @kbn/storybook webpack configuration
* Ignore stories in Jest coverage
* Combine effects in Cytoscape component so handlers are always added before events are triggered
* Add mock context to ErrorRateAlertTrigger stories
* Disable TransactionDurationAlertTrigger stories

Changing the Cytoscape effect behavior is necessary because the layout was not being triggered when the final set of elements is provided as props to the component. When this is used in Kibana we're always starting with empty elements and fetching them, but in the Storybook we're starting out with the full elements.
smith added a commit that referenced this pull request Jun 9, 2020
* Resolve core legacy assets in @kbn/storybook webpack configuration
* Ignore stories in Jest coverage
* Combine effects in Cytoscape component so handlers are always added before events are triggered
* Add mock context to ErrorRateAlertTrigger stories
* Disable TransactionDurationAlertTrigger stories

Changing the Cytoscape effect behavior is necessary because the layout was not being triggered when the final set of elements is provided as props to the component. When this is used in Kibana we're always starting with empty elements and fetching them, but in the Storybook we're starting out with the full elements.
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jun 10, 2020
* master: (22 commits)
  Partial revert of "Sync Kerberos + Anonymous access tests with the latest `security/_authenticate` API (user roles now include roles of anonymous user)." (elastic#68624)
  adapt some snapshot test (elastic#68489)
  [APM] Service maps - Fix missing ML status for services with jobs but no anomalies (elastic#68486)
  [skip test] apis Kerberos security Kerberos authentication finishing SPNEGO should properly set cookie and authenticate user
  [SIEM][Exceptions] - ExceptionsViewer UI component part 2 (elastic#68294)
  Surface data streams in Index Management. (elastic#67806)
  Fix edit datasource not working following changes in elastic#67234 (elastic#68583)
  [Logs + Metrics UI] Clean up async plugin initialization (elastic#67654)
  APM Storybook fixes (elastic#68671)
  Upgrade EUI to v24.1.0 (elastic#68141)
  [ML] DF Analytics: Creation wizard part 2 (elastic#68462)
  [Uptime] Fix race on overview page query (elastic#67843)
  Prefer using npm_execpath when spawning Yarn (elastic#68673)
  [Security] [Cases] Attach timeline to existing case (elastic#68580)
  Use Search API in Vega (elastic#68257)
  [Component templates] Table view (elastic#68031)
  [Uptime] Added relative date info in cert status column (elastic#67612)
  [Endpoint] Re-enable Functional test case for Endpoint related pages (elastic#68445)
  run page_load_metrics tests in visual regresssion jobs (elastic#68570)
  Enable exhaustive-deps; correct any lint warnings (elastic#68453)
  ...
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:APM All issues that need APM UI Team support v7.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Storybook
5 participants