Storybook is a great tool for developing components -- and while simulated and snapshot based testing can get you pretty far, there's no substitution for the real thing. proof
is a tapable integration testing library for your stories.
The quickest way to get started is to use the proof-cli.
npm i --save-dev @proof-ui/cli
Inspired by ava proof exposes a concise API for authoring tests:
import test, { assert } from '@proof-ui/test';
test({ kind: 'Components|Button', story: 'Basic' }, async ({ browser }) => {
// Use the browser object to test your component
assert(true === true);
});
Or mirror storybook to make it easy to cross-reference tests between files.
import { proofsOf } from '@proof-ui/test';
import assert from 'power-assert';
const proofs = proofsOf('Components|Button');
proofs.add('Basic', async ({ browser }) => {
// Use the browser object to test your component
assert(true === true);
});
Add proof as a test script in your package.json
{
"scripts": {
"test": "proof"
}
}
And call it
npm test
Proof will run against a local chrome instance by default, but can be configured to target any number of local, remote, or headless browsers.
Create a proof.config.js
file in your package's root folder or use the -c
, --conf
option on the command line to specify a different one.
At it's core, proof
uses tapable and exposes many hooks to allow complete control over the entire test life-cycle.
Please read the contributing and code of conduct document.
Clone the repo:
git clone https://github.com/intuit/proof.git
Go to the newly cloned repo, and download dependencies:
cd proof
yarn
Build the project:
yarn build