elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.47k stars 8.04k forks source link

[Storybook] Snapshots testing. #122068

Open Kuznietsov opened 2 years ago

Kuznietsov commented 2 years ago

Introduction

Right now, Canvas has its own way of testing components, using storybooks. It is taking a story and comparing it to the snapshot. This way is not requiring writing jest tests. You can see the example of the configuration here: https://github.com/elastic/kibana/blob/4c07aba4a200f6a057758e17e8cc2483a3b60637/x-pack/plugins/canvas/storybook/storyshots.test.tsx#L100.

When expression renderers have started moving out from Canvas and VisEditors to the separate plugins, it has raised the need for such a way of testing components, as it is organized at Canvas.

Proposition

What do you think about adding the common way of testing plugins with storybook snapshots, located at src/plugins/expression_* and src/plugins/chart_expressions/* in the way it is organized at Canvas (possibly, add the mechanism of including additional plugins in the configuration)?

elasticmachine commented 2 years ago

Pinging @elastic/kibana-operations (Team:Operations)