2018-04-20 21:13:37 +02:00
|
|
|
/.gradle
|
|
|
|
/build
|
|
|
|
/target
|
2018-05-15 18:43:40 +02:00
|
|
|
/test/functional/failure_debug
|
2018-04-20 21:13:37 +02:00
|
|
|
/test/functional/screenshots
|
|
|
|
/test/functional/apps/reporting/reports/session
|
|
|
|
/plugins/reporting/.chromium/
|
|
|
|
/plugins/reporting/.phantom/
|
|
|
|
/.aws-config.json
|
|
|
|
/.env
|
|
|
|
/.kibana-plugin-helpers.dev.*
|
2018-10-17 12:07:50 +02:00
|
|
|
!/plugins/infra/**/target
|
[Canvas] Storybook for testing and development (#29072)
## Summary
This PR adds [Storybook](https://storybook.js.org/) to our testing and development suite.
![screen shot 2019-01-21 at 4 35 32 pm](https://user-images.githubusercontent.com/297604/51502196-9f856780-1d9a-11e9-97bf-07c99c3f279b.png)
This will allow us to:
1. create a site outlining all components within Canvas, including their TS type information;
2. demonstrate usage of all components by example;
3. allow for individual component testing, both manually and by Jest;
4. iterate and fix bugs on individual components *without* having to start up Kibana, in a [HMR](https://webpack.js.org/concepts/hot-module-replacement/) environment;
5. automatically generate [snapshots](https://jestjs.io/docs/en/snapshot-testing) based on any examples written;
This PR also converts a few components to Typescript and adds examples.
## How this can help us, (with examples)
I was inspired to add this when I was fixing #25342. In order to fix my changes, I had to run elasticsearch and kibana, as well as refresh my page whenever I needed to test a change. Had I had a Storybook instance, I would have been done much faster.
In this PR, you'll see I converted `AdvancedFilter` from `renderers` and `FontPicker` and `ImageUpload` from `public/components`. Would you believe I discovered and fixed bugs just by converting to Typescript and writing examples?
### `AdvancedFilter`
- `onChange` and `commit` are not marked as required in `propTypes`, but the component will error out if they're not supplied.
- `commit` was actually being called twice when 'Apply' was clicked. This was shown in the 'Actions' panel when I was testing it.
### `FontPicker`
- The `fonts` collection was not strongly-typed, therefore any string could be passed to the `value` parameter without error.
- While the code allows for any font string to be given to the component, there is no way to currently select that value, nor type it in within the control. This is likely a bug in design.
- The `aria-labeledby` attribute in the drop down includes `undefined`. This is likely a bug in EUI:
![screen shot 2019-01-21 at 4 25 58 pm](https://user-images.githubusercontent.com/297604/51501908-5ed91e80-1d99-11e9-913a-ce1bb5f4e352.png)
## How to use
- `cd x-pack/plugins/canvas/`
- Run `node scripts/storybook` to start up a local development version, with HMR.
- Run `node scripts/storybook_build` to build a complete static version of the book.
- Run `node scripts/jest` which will run the Storyshots test; run `node scripts/jest --updateSnapshot` if source code has changed as expected.
## Future Work
- Adding Jest coverage and output to the info panels, ([this](https://www.npmjs.com/package/@storybook/addon-jest) is *sick* functionality).
- Adding automatic [a11y testing](https://www.npmjs.com/package/@storybook/addon-a11y), (currently [blocked](https://github.com/storybooks/storybook/issues/4889)).
- Adding generic knobs for stories
- Adding more example info, (e.g. who edited last, descriptions, etc).
2019-02-15 17:35:30 +01:00
|
|
|
.cache
|
2018-12-04 19:04:39 +01:00
|
|
|
|
|
|
|
# We don't want any yarn.lock files in here
|
|
|
|
/yarn.lock
|