Giter Site home page Giter Site logo

nightwatchjs / nightwatch-storybook-plugin Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 5.0 4.21 MB

Automatically integrate Storybook and run stories directly with Nightwatch

Home Page: https://nightwatchjs.org

License: MIT License

JavaScript 84.48% CSS 4.70% MDX 10.82%
component-testing nightwatch nightwatchjs storybook

nightwatch-storybook-plugin's People

Contributors

aberonni avatar automatedtester avatar beatfactor avatar kapelianovych avatar oanabotezat avatar olezhka-web avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nightwatch-storybook-plugin's Issues

Syntax error when passing the runOnly option

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",

Plugin doesn't seem to work with module aliasing

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",

@nightwatch/[email protected] does not work with [email protected]

@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)'
     ]
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.