0.3.6 • Published 7 months ago

@proof-ui/test v0.3.6

Weekly downloads
264
License
MIT
Repository
-
Last release
7 months ago

@proof-ui/test

Writing a test using proof is very similar to how you write your stories. Typically you'd start with:

import { proofsOf } from '@proof-ui/test';

const proofs = proofsOf('Components|Button');

Look familiar? Just like when you write your stories, you can now write a proof for that story to verify everything is working as expected.

While most of your testing will probably occur at the unit-test using react-testing-library or similar -- there's no substitution for grabbing screenshots and running some testing in the browser (especially when you're responsible for supporting some of the more annoying browsers).

Writing a test

Adding a proof is very similar to adding a story. In the callback function, instead of returning a react component, you're given a browser object to interact with the page.

import { proofsOf } from '@proof-ui/test';

const proofs = proofsOf('Components|Button');

proofs.add('Simple', ({ browser }) => {});

API

The test callback function is passed the following:

nametype
browserA webdriverio browser
storystring
kindstring

Alternative API

To enable finer control of testing, you can also use the generic version of the test api:

import test from '@proof-ui/test';

test({ kind: 'Components|Button', story: 'Simple' }, ({ browser }) => {});

The test api accepts a filter for what stories to run the test on. It can filter on both the kind or story name -- using the same callback API as the proofsOf version.

If no story is provided, all stories under that kind are executed. Similarly, if neither a story or kind are provided, the test runs against every story in your storybook.

0.3.6

7 months ago

0.3.5

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.3.0

2 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.6

3 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.20-0

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago