1.7.3 • Published 6 years ago

mochawesome-screenshots v1.7.3

Weekly downloads
6,476
License
ISC
Repository
github
Last release
6 years ago

mochawesome-screenshots

This is a fork of Mochawesome(MochawesomePlusPlus) reporter with added screenshots functionality.

A reporter takes a screenshot after each failed test.

Installation of the module:

$ npm install mochawesome-screenshots --save-dev

Usage remains the same as the Mocahwesome.

For protractor - configuration file example:

  framework: 'mocha',

  mochaOpts: {
      reporter: 'mochawesome-screenshots',
      reporterOptions: {
          reportDir: 'customReportDir',
          reportName: 'customReportName',
          reportTitle: 'customReportTitle',
          reportPageTitle: 'customReportPageTitle',
          takePassedScreenshot: false,
          clearOldScreenshots: true,
          shortScrFileNames: false,
          jsonReport: false,
          multiReport: false
      },
      timeout: 600000
  },

For playwright and puppeteer:

  • Make global your "page" variable.
  • Add reporterOptions:
framework: playwright (puppeteer)

For cypress:

framework: cypress

For webdriver.io:

framework: webdriverio

For nightwatch.js:

framework: nightwatchjs

Use 'multiReport = true' for parallel test execution (adding timestamp in report file name), or change report name in tests or hooks for shardTestFiles option:

const logReport = require('mochawesome-screenshots/logReport');
    
it('Change report name', function() {
    logReport.setReportName(this, 'customReportName');
});

Log data to report:

const logReport = require('mochawesome-screenshots/logReport');

it('Log build number', function() {
    logReport.log(this, 'build number:' + buildNumber);
});

Add custom screenshots from mochawesome-reports/screenshots folder to report:

it('Custom screenshot', function() {
    ..
    save screenshot 1 to ('./mochawesome-reports/screenshots/'+imageFileName1);
    save screenshot 2 to ('./mochawesome-reports/screenshots/'+imageFileName2);
    ..
    logReport.setScreenshot(this, imageFileName1, 'message1');
    logReport.setScreenshot(this, imageFileName2, 'message2');
});
1.7.3

6 years ago

1.7.2

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.0

7 years ago

1.5.9

8 years ago

1.5.8

8 years ago

1.5.7

8 years ago

1.5.6

8 years ago

1.5.5

8 years ago

1.5.4

8 years ago

1.5.3

8 years ago

1.5.2

9 years ago

1.5.1

9 years ago

1.5.0

9 years ago

1.4.8

9 years ago

1.4.7

9 years ago

1.4.6

9 years ago

1.4.5

9 years ago

1.4.4

9 years ago

1.4.3

9 years ago

1.4.2

9 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

1.3.1

10 years ago