nightwatchjs / nightwatch-storybook-plugin Goto Github PK
View Code? Open in Web Editor NEWAutomatically integrate Storybook and run stories directly with Nightwatch
Home Page: https://nightwatchjs.org
License: MIT License
Automatically integrate Storybook and run stories directly with Nightwatch
Home Page: https://nightwatchjs.org
License: MIT License
When using the default config the tests run correctly:
parameters: {
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
layout: "centered",
a11y: {},
},
[Search.stories.jsx component] Test Suite
───────────────────────────────────────────────────────────────────────────────
ℹ Connected to selenium_chrome on port 4444 (242ms).
Using: chrome (94.0.4606.61) on LINUX.
Running "Default" story:
───────────────────────────────────────────────────────────────────────────────────────────────────
✖ NightwatchAssertError
There are accessibility violations; please see the complete report for details.
Read More :
https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md
FAILED: 1 assertions failed (1.04s)
I want to specify tags to run using the runOnly options like below:
parameters: {
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
layout: "centered",
a11y: {
options: {
runOnly: {
type: "tag",
values: ["wcag2a", "wcag2aa"],
},
},
},
},
Which results in a syntax error?
[@nightwatch/storybook] Found 1 total number of story files, of which 1 were ignored due to errors.
[@nightwatch/storybook] Found 1 total number of story files, of which 1 were ignored due to errors.
[@nightwatch/storybook] Found 1 total number of story files, of which 1 were ignored due to errors.
Wrote HTML report file to: /app/docroot/modules/custom/foobar_react/js/tests_output/nightwatch-html-report/index.html
✖ SyntaxError
Cannot use import statement outside a module
In order to be able to load JSX files, one of these plugins is needed:
- @nightwatch/react
- @nightwatch/storybook (only if using Storybook in your project)
Try fixing by :
1. Using ES6 import/export syntax? - make sure to specify "type=module" in your package.json or use .mjs extension.
Read More :
https://nodejs.org/api/esm.html
Versions:
"@nightwatch/storybook": "^0.1.15",
"nightwatch": "^3.1.3",
"storybook": "^7.4.2",
I'm using webpack module aliasing but it doesn't appear to be working with this plugin even though it is working when I view the built storybook.
The resolve portion of my webpack file.
resolve: {
extensions: [".js", ".jsx"],
alias: {
"opensearch-search-fetcher": path.resolve(
__dirname,
"src/search/fetchers/opensearch"
),
},
},
The mock in my main.js file:
webpackFinal: async (config) => {
config.resolve.alias = {
...config.resolve.alias,
"opensearch-search-fetcher": path.resolve(__dirname, '../__mocks__/opensearch.js')
};
return config;
},
This works when I view storybook in the browser.
When I run the nightwatch command though it can't resolve it:
yarn run v1.22.19
warning package.json: No license field
$ npx nightwatch src/stories/Search.stories.jsx
✘ [ERROR] Could not resolve "opensearch-search-fetcher"
src/search/components/search.jsx:11:33:
11 │ import getOpenSearchResults from "opensearch-search-fetcher";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can mark the path "opensearch-search-fetcher" as external to exclude it from the bundle, which will remove this error.
Wrote HTML report file to: /app/docroot/modules/custom/dnsw_react/js/tests_output/nightwatch-html-report/index.html
Error Error while trying to load /app/docroot/modules/custom/dnsw_react/js/src/stories/Search.stories.jsx
Build failed with 1 error:
src/search/components/search.jsx:11:33: ERROR: Could not resolve "opensearch-search-fetcher"
error Command failed with exit code 10.
Using:
"@nightwatch/storybook": "^0.1.15",
"nightwatch": "^3.1.3",
"storybook": "^7.4.2",
@storybook/cli v7.0.8
Error
✖ NightwatchMountError
Could not mount the component story.
Request POST /session/325fba74da614dca1d73e5915cf66c68/execute/sync
{
script: 'var passedArgs = Array.prototype.slice.call(arguments,0); return (function(innerHTML) {\n' +
" var scriptTag = Object.assign(document.createElement('script'), {\n" +
" type: 'module',\n" +
' in... (301 characters)',
args: [
'\n' +
' const channel = window.__STORYBOOK_ADDONS_CHANNEL__;\n' +
" window['@@story_rendered'] = null;\n" +
' \n' +
' if (channel && channel.data) {\n' +
' const errorEvents = channel.data.stor... (1061 characters)'
]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.