testx-html-reporter

0.1.1 • Public • Published

testx-html-reporter

npm version

HTML and screenshot reporter for testx.

This work is heavily based on Protractor Jasmine 2 HTML Reporter.

Usage

In your Protractor configuration file, register testx-html-reporter:

var HtmlReporter = require('testx-html-reporter');

exports.config = {
   // ...
   onPrepare: function() {
      jasmine.getEnv().addReporter(
        new HtmlReporter({
          savePath: 'target/screenshots/'
        })
      );
   }
}

Options

Destination folder

Output directory for created files. All screenshots and reports will be stored here.

If the directory doesn't exist, it will be created automatically or otherwise cleaned before running the test suite.

jasmine.getEnv().addReporter(new HtmlReporter({
   savePath: './test/reports/'
}));

Default folder: ./

Show passed specs (optional)

By default the passed specifications will not be included in the report. To include them do:

jasmine.getEnv().addReporter(new HtmlReporter({
   showPassed: true
}));

Default value: false

Show skipped count (optional)

By default the number of skipped specifications will not be included in the report. To include it do:

jasmine.getEnv().addReporter(new HtmlReporter({
   showSkippedCount: true
}));

Default value: false

Show stack trace (optional)

By default the stacktrace of failed assertions will not be included in the report. To include it do:

jasmine.getEnv().addReporter(new HtmlReporter({
   showStacktrace: true
}));

Default value: false

Screenshots folder (optional)

By default the screenshots are stored in a folder inside the default path

If the directory doesn't exist, it will be created automatically or otherwise cleaned before running the test suite.

jasmine.getEnv().addReporter(new HtmlReporter({
   savePath: './test/reports/',
   screenshotsFolder: 'images'
}));

Default folder: screenshots

Take screenshots (optional)

When this option is enabled, reporter will create screenshots for specs.

jasmine.getEnv().addReporter(new HtmlReporter({
   takeScreenshots: false
}));

Default is true

Take screenshots only on failure (optional) - (NEW)

This option allows you to choose if create screenshots always or only when failures. If you disable screenshots, obviously this option will not be taken into account.

jasmine.getEnv().addReporter(new HtmlReporter({
   takeScreenshots: true,
   takeScreenshotsOnlyOnFailures: true
}));

Default is false (So screenshots are always generated)

FilePrefix (optional)

Filename for html report.

jasmine.getEnv().addReporter(new HtmlReporter({
   savePath: './test/reports/',
   filePrefix: 'index'
}));

Default is htmlReport.html

Consolidate and ConsolidateAll (optional)

This option allow you to create diferent HTML for each test suite.

jasmine.getEnv().addReporter(new HtmlReporter({
   consolidate: true,
   consolidateAll: true
}));

Default is false

Package Sidebar

Install

npm i testx-html-reporter

Weekly Downloads

241

Version

0.1.1

License

ISC

Unpacked Size

30 kB

Total Files

7

Last publish

Collaborators

  • greyarch