Generates an HTML view of the Nightwatch.js test reports with Screenshots by either parsing the XML files generated by Nightwatch or by using the Nightwatch reporter options.
Need to replace in package.json, the existing package nightwatch-html-reporter , with this @webng/nightwatch-reporter and use compact Theme in globals.js.
Requires Nightwatch >= 0.5.32.
/* In nightwatch/globals.js */
const HtmlReporter = require('nightwatch-reporter');
const reporter = new HtmlReporter({
openBrowser: true,
reportsDirectory: 'output/reports',
reportFilename: 'index.html',
themeName: 'compact',
appFaviconUrl: 'https://www.palassets.com/favicon.ico',
appLogoUrl: 'https://www.palassets.com/sprites/paltalk_logo_white.svg',
relativeScreenshots: true
});
module.exports = {
reporter: reporter.fn
};
It must be noted that, for a screenshot to be associated with an assertion in the report being generated:
- the assertion message string must be equal the screenshot filename..
- Screenshots must be placed in the directory /output/screenshot
Assertion:
browser.waitForElementVisible('@DownloadExe', 5000, false, () => {}, `User registered successfully`)
Screenshot:
browser.saveScreenshot('./output/screenshots/User registered successfully.png');```