Neutral Political Machine

    wdio-mocha-emailable-reporter

    1.2.2 • Public • Published

    WDIO Mocha Emailable Reporter

    Generates test results in the a single page emailable HTML. Inspired by wdio-mochawesome-reporter, this is pretty much a clone with the exception of generating a single page HTML report instead of merged json file.

    Installation

    • NPM
    npm install wdio-mocha-emailable-reporter --save-dev

    Configuration

    Import

    import WdioMochaEmailableReporter from 'wdio-mocha-emailable-reporter';

    Results to File

    reporters: [
      ['WdioMochaEmailableReporter',{
          outputDir: './Results'
      }]
    ],

    Results to File with custom file name

    reporters: [
      ['WdioMochaEmailableReporter',{
        outputDir: './Results',
        outputFileFormat: function(opts) {
            return `results-${opts.cid}.${opts.capabilities}.json`
        }
      }]
    ],

    Result Files

    Command line

    As part of a wdio hook

    The onComplete is a great place to call the renderHtml script. Usage this way requires passing in the results directory and the file pattern as arguments to the script.

    // Located in your wdio.conf.js file
    onComplete: function (exitCode, config, capabilities, results) {
      const renderHtml = require('wdio-mocha-emailable-reporter/renderHtml');
      renderHtml('./mocha-results', 'wdio-*');
    }

    Upon completion, the result script will output a single html file named result.html in the provided <RESULTS_DIR>

    Custom variable

    Custom variable can be included in the result html by creating mocha-emailable.properties file in the project root. Additionally, environment variable can also be used in real time.

    // Set environment variable
    export BASE_URL=http://www.test.com
    
    // Properties file
    NAME=Test
    BASE_URL=${BASE_URL}
    

    Install

    npm i wdio-mocha-emailable-reporter

    DownloadsWeekly Downloads

    98

    Version

    1.2.2

    License

    MIT

    Unpacked Size

    41.1 kB

    Total Files

    11

    Last publish

    Collaborators

    • ccharnkij