Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add built storybooks to official storybook #2958

Merged
merged 6 commits into from
Feb 15, 2018
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 9 additions & 23 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ jobs:
command: |
cd examples/angular-cli
yarn build-storybook
- run:
name: "Build polymer-cli"
command: |
cd examples/polymer-cli
yarn build-storybook
- run:
name: "Run react kitchen-sink (smoke test)"
command: |
Expand All @@ -96,6 +101,10 @@ jobs:
command: |
cd examples/angular-cli
yarn storybook --smoke-test
- run:
name: "Visually test storybook"
command: |
yarn chromatic
- run:
name: "Run image snapshots"
command: yarn test --image
Expand Down Expand Up @@ -207,26 +216,6 @@ jobs:
command: |
yarn test --coverage --runInBand --core
yarn coverage
storybook:
<<: *defaults
steps:
- checkout
- restore_cache:
name: "Restore core dependencies cache"
keys:
- core-dependencies-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Restore core dist cache"
keys:
- core-dist-{{ .Revision }}
- run:
name: "Link packages"
command: |
yarn install
- run:
name: "Visually test storybook"
command: |
yarn chromatic
cli:
working_directory: /tmp/storybook
docker:
Expand Down Expand Up @@ -292,9 +281,6 @@ workflows:
- unit-test:
requires:
- build
- storybook:
requires:
- build
- cli:
requires:
- build
Expand Down
1 change: 1 addition & 0 deletions examples/official-storybook/built-storybooks/angular-cli
1 change: 1 addition & 0 deletions examples/official-storybook/built-storybooks/polymer-cli
2 changes: 1 addition & 1 deletion examples/official-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"chromatic": "chromatic test --storybook-addon --exit-zero-on-changes --app-code ab7m45tp9p",
"generate-addon-jest-testresults": "jest --config=tests/addon-jest.config.json --json --outputFile=stories/addon-jest.testresults.json",
"image-snapshots": "yarn run build-storybook && jest --projects=./image-snapshots",
"storybook": "start-storybook -p 9010 -c ./"
"storybook": "start-storybook -p 9010 -c ./ -s built-storybooks"
},
"devDependencies": {
"@storybook/addon-a11y": "^3.4.0-alpha.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots App|acceptance angular-cli 1`] = `
<iframe
src="/angular-cli/index.html"
style="border:0;position:absolute;top:0;left:0;width:100vw;height:100vh"
title="angular-cli"
/>
`;

exports[`Storyshots App|acceptance cra-kitchen-sink 1`] = `
<iframe
src="/cra-kitchen-sink/index.html"
style="border:0;position:absolute;top:0;left:0;width:100vw;height:100vh"
title="cra-kitchen-sink"
/>
`;

exports[`Storyshots App|acceptance polymer-cli 1`] = `
<iframe
src="/polymer-cli/index.html"
style="border:0;position:absolute;top:0;left:0;width:100vw;height:100vh"
title="polymer-cli"
/>
`;

exports[`Storyshots App|acceptance vue-kitchen-sink 1`] = `
<iframe
src="/vue-kitchen-sink/index.html"
style="border:0;position:absolute;top:0;left:0;width:100vw;height:100vh"
title="vue-kitchen-sink"
/>
`;
26 changes: 26 additions & 0 deletions examples/official-storybook/stories/app-acceptance.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withNotes } from '@storybook/addon-notes';

// For these stories to work, you must build the static version of the
// example storybooks *before* running this storybook.

const chapter = storiesOf('App|acceptance', module);

const style = {
border: 0,
position: 'absolute',
top: 0,
left: 0,
width: '100vw',
height: '100vh',
};

['cra-kitchen-sink', 'vue-kitchen-sink', 'angular-cli', 'polymer-cli'].forEach(name => {
chapter.add(
name,
withNotes(`You must build the storybook for the ${name} example for this story to work.`)(
() => <iframe style={style} title={name} src={`/${name}/index.html`} />
)
);
});