wdio-summary-reporter
Advanced tools
Comparing version 0.0.13 to 0.0.15
{ | ||
"name": "wdio-summary-reporter", | ||
"version": "0.0.13", | ||
"version": "0.0.15", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/reporter/reporter.js", |
@@ -37,4 +37,11 @@ const events = require('events'); | ||
this.on('on:screenshot', function (runner) { | ||
console.log('SNAAAAAAAAAAAP'); | ||
this.on('runner:screenshot', function (runner) { | ||
const cid = runner.cid; | ||
const stats = this.baseReporter.stats; | ||
const results = stats.runners[cid]; | ||
const specHash = stats.getSpecHash(runner); | ||
const spec = results.specs[specHash]; | ||
const lastKey = Object.keys(spec.suites)[Object.keys(spec.suites).length - 1]; | ||
const currentTestKey = Object.keys(spec.suites[lastKey].tests)[Object.keys(spec.suites[lastKey].tests).length - 1]; | ||
spec.suites[lastKey].tests[currentTestKey].screenshots.push(runner.filename); | ||
}); | ||
@@ -44,3 +51,15 @@ | ||
}); | ||
this.on('start', function (runner) { | ||
const nativeClick = browser.click; | ||
browser.addCommand('click', function (selector) { | ||
const path = require('path'); | ||
const filename = Date.now().toString(); | ||
console.log(filename); | ||
const filePath = path.resolve('output', `${filename}.png`); | ||
browser.saveScreenshot(filePath); | ||
return nativeClick.call(this, selector); | ||
}, true); | ||
}); | ||
this.on('end', function (runner) { | ||
@@ -47,0 +66,0 @@ console.log(JSON.stringify(this.results)); |
3079
57