Norwegian Pony Master

    This package has been deprecated

    Author message:

    renamed to mocha-webdriver-runner, this package is no longer maintained

    @zbigg/mocha-selenium-runner
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.1 • Public • Published

    Deprecated

    Renamed to [mocha-webdriver-runner], see


    mocha-selenium-runner

    Run Mocha tests in browsers using Selenium WebDriver.

    Inspired by mocha-chrome, but with following features implemented from start:

    • drives browser using Selenium WebDriver, so you can run tests on everything that selenium WebDriver supports. Hint: it supports everything (tm).
    • runs reporters locally, in node environment so most of reporters (which are designed to work in node environment) should work out-of-box:
      • tested mocha builtins: spec, xunit, tap, etc ...
      • support for mochawesome (including usage of addContext)

    That's it, have fun.

    Install

    $ npm install @zbigg/mocha-selenium-runner
    

    How to

    Prepare your tests to run in browser as described on Mocha website.

    Add mocha-selenium-runner browser side client:

     <script src="../node_modules/@zbigg/mocha-selenium-runner/dist/mocha-selenium-client.js"></script>
    

    and install MochaSeleniumClient in global mocha instance:

      mocha.setup({ui: "bdd"});
    + MochaSeleniumClient.install(mocha);
    

    Run the test suite:

    SELENIUM_BROWSER=chrome npx mocha-selenium-runner test/index.html
    
    SELENIUM_BROWSER=firefox npx mocha-selenium-runner test/index.html --reporter=tap
    

    (assuming your tests are in test/index.html).

    See package.json scripts and test/sample-suite/index-headless.html for reference.

    Browser capabilities

    Use -C key[=value] (or --capability) options to set requested browser capabilities. Value may be plain string, or JSON value, examples:

    -C browserName=firefox
    -C browserName=chrome
    -C chromeOptions.args='["--headless", "--window-size=300,300"]'
    

    Useful links:

    Selenium WebDriverJS accepts capabilities passed by environment variables as below.

    SELENIUM_BROWSER=chrome
    SELENIUM_BROWSER=firefox:52
    SELENIUM_REMOTE_URL=http://my-selenium-grid:4444/wd/hub
    

    See WebDriverJS Builder

    Contribute

    PRs accepted.

    License

    MIT © Zbigniew Zagórski

    Install

    npm i @zbigg/mocha-selenium-runner

    DownloadsWeekly Downloads

    2

    Version

    0.2.1

    License

    MIT

    Unpacked Size

    124 kB

    Total Files

    29

    Last publish

    Collaborators

    • zbigg