Skip to content

Commit

Permalink
chore(E2E): use cypress-storybook library for tests (#18353)
Browse files Browse the repository at this point in the history
* chore(E2E): use cypress-storybook library for tests

This pr introduces
[cypress-storybook](https://github.com/NicholasBoll/cypress-storybook)
integration for cypress tests. Removes the need for the custom
`visitStory` utility.

The OSS integration uses storybook internals to modify controls and knobs
which will be leverage in future PRs to improve testing.

cypress-storybook also uses storybook internals to reload stories
without a page reload and speeds up the tests by 50% in the best cases

* Change files

* add cypresss-storybook addon to react-examples too

* Change files

* update change file
  • Loading branch information
ling1726 authored May 28, 2021
1 parent 96e9aa6 commit 203ccaf
Show file tree
Hide file tree
Showing 17 changed files with 322 additions and 300 deletions.
1 change: 1 addition & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { withFluentProvider, withStrictMode } from '@fluentui/react-storybook';
import 'cypress-storybook/react';

export const decorators = [withFluentProvider, withStrictMode];
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Add cypress-storybook-plugin",
"packageName": "@fluentui/react-examples",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Use cypress-storybook for e2e tests",
"packageName": "@fluentui/react-menu",
"email": "[email protected]",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"packageName": "@fluentui/react-tabster",
"comment": "Add cypress-storybook-plugin",
"email": "[email protected]",
"dependentChangeType": "none"
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"css-loader": "5.0.1",
"cypress": "6.6.0",
"cypress-real-events": "1.2.0",
"cypress-storybook": "0.5.1",
"danger": "^6.0.5",
"del": "6.0.0",
"eslint": "7.25.0",
Expand Down Expand Up @@ -154,10 +155,10 @@
"tslib": "2.2.0",
"typescript": "4.1.5",
"webpack": "5.21.2",
"webpack-cli": "4.3.1",
"webpack-dev-server": "4.0.0-beta.0",
"webpack-bundle-analyzer": "4.4.2",
"webpack-cli": "4.3.1",
"webpack-dev-middleware": "4.2.0",
"webpack-dev-server": "4.0.0-beta.0",
"webpack-hot-middleware": "2.25.0",
"yargs": "13.3.2"
},
Expand Down
1 change: 1 addition & 0 deletions packages/react-examples/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react';
import { initializeIcons } from '@fluentui/font-icons-mdl2';
import { configure, addParameters, addDecorator } from '@storybook/react';
import 'cypress-storybook/react';
import { withInfo } from '@storybook/addon-info';
import { withPerformance } from 'storybook-addon-performance';
import { withFluentProvider, withKeytipLayer, withStrictMode } from '@fluentui/storybook';
Expand Down
Loading

0 comments on commit 203ccaf

Please sign in to comment.