This storybook in an environment to build, test, certify, and document reference components with Janus-Bootstrap.
- If you haven't already, install Node and Docker
- Clone this repository to your local machine:
git clone [email protected]:Symplicity/janus-bootstrap-storybook.git
npm install
npm run storybook
- First, have a look at the Writing Stories section in the Storybook documentation
- Before you begin:
npm update
to ensure you have the latest versions of supporting libraries.npm run test
to detect visual regressions resulting from the update. Any regressions found should be reported to contributors and resolved.
- Create or modify stories in the stories folder
- Pass all of the Development Checkpoints outlined herein
- Desktop, tablet and mobile breakpoints have been evaluated.
- There are no Accessibility errors reported in the accessibility panel.
- Optionally use WAVE tool to be thorough
- The component is entirely keyboard accessible, with standard keyboard interactions. See: ARIA Design Pattern Examples.
- JAWS Inspect describes good reading order and clear labels.
- Optionally check NVDA and VoiceOver to bring screenreader coverage above 80-90%
- UX has reviewed and approved the final build of the UI.
- Any additions or changes to supporting libraries have been reviewed and approved by design and technical leads.
- Documentation covers usage scenarios, dos and don'ts and configuration.
- Visual regression tests have been added/updated, run and approved.
- Code review is approved.
- Version number (breaking.patch.fix) is updated in package.json. See Semantic Versioning.
- CHANGELOG.md is updated to reflect your additions. See format requirements.
Visual regression testing opens storybook pages in a headless browser, takes screenshots, and compares those screenshots to the reference (previously approved) versions. We use Docker to ensure that the platform you are running does not influence test results. Important: Manual review of test results is essential, because visual regression is imperfect.
-
Run
npm run test
-
If you see npm errors, the test has probably failed. Review the log for something like:
report | Test completed... report | 15 Passed report | 3 Failed
-
Always review test results manually, because visual regression is imperfect.
- If the test results automatically opened in your browser, you probably passed. You must verify this manually.
- To open test results, use
npm run test:view-report
- To approve test results and update the reference tests, use
npm run approve
- Edit
backstop.json
and add your test in thescenarios
array. See the docs - If this is a new scenario and component you will need to generate a set of reference images before running a test, for example you would use
npm run reference --filter=Typography-SB
if your new sceario had a label ofTypography-SB
. - Run all tests using
npm run test
. - In the test report, the only failures reported should be for your new test.
- If there are other failures, you must resolve them with contributors before continuing.
- Run
npm run approve
to approve all of the results of your test, including your new test.
If you need others to review your work, an easy option is to export and publish it on the web. Storybook comes with a tool for this:
- To export your site into a directory called export:
npx build-storybook -c .storybook -o
- Upload the export directory to an online location, such as a dev sandbox:
scp -r ../storybook-export [some_server]:[web/root/path]
Supercharge your documentation and scenario testing with the Addons that are already available in this Storybook:
- Notes for documenting your stories
- Viewport for testing mobile, tablet and desktop viewports
- Backgrounds to test components on different backgrounds. Colors are populated from Janus tokens.
- a11y for accessibility checks and color-blindness previews
- RTL to toggle between left-to-right and right-to-left text direction of the preview frame
- Knobs to dynamically set variables/properties in your story
- Events to create and emit events. Check out the awesome storybook-html-lab for examples.
- Actions to display data received by event handlers. Examples at storybook-html-lab.
- What if I need to add new CSS?
Answer: This storybook is intended to document usage of Janus-Bootstrap, so all CSS and JS should come from that framework. Additional packages could be added vianpm install --save-dev <package>
, and documented in your stories. You will need to edit.storybook/webpack.config.js
and potentially other configs to make new JS packages available in stories. - Something is confusing or not covered in this Read Me. What do I do?
Answer: Be a contributor and fix it! - I want to use another Storybook Addon. What do I do?
Answer: Add it in, get feedback, and fully configure it
- Janus-Bootstrap and Janus-Tokens are both installed as dependencies in package.json
- The compiled bootstrap.css and bootstrap.js files are automatically included via
.storybook/css-loader.scss
and.storybook/webpack.config.js
- Update changelog
- Add to Symplicity Github