Closed jaquith closed 4 years ago
Caleb,
that functionality is there. Its described in the readme.and in the test code
Rich
On Tue, Mar 17, 2020 at 1:47 PM Caleb Jaquith notifications@github.com wrote:
Is it possible to add the mocha test function itself to the report?
For instance, given this suite:
describe('These should pass', function(){ it('should pass', function() { logMessage("Just simple addition") expect(1+1).to.equal(2) })
it('should also pass', function() { logMessage("Multiplication this time") expect(2*3).to.equal(6) }) })
I'm hoping to be able to extract and add
logMessage("Just simple addition")expect(1+1).to.equal(2)
and
logMessage("Multiplication this time")expect(2*3).to.equal(6)
to the report as part of the output for the respective test - something like what mochawesome https://github.com/adamgruber/mochawesome/blob/master/docs/marge-report-1.0.1.png does (but only in its non-wdio implementation).
I've been trying various wdio reporters out and haven't seen any that do that, so I'm not sure it's even a technical possibility within @wdio/mocha-framework's implementation of mocha?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/22, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIELQLC35EMGK5JDUEEDRH7OUZANCNFSM4LN2WVFA .
Rich,
thanks for writing back so quickly (again). I swear I'm not being intentionally thick, but I reread the README and tried to find the test code you're talking about - I came up empty.
If you could point me in the right direction a little more specifically I'd be very grateful.
Best Caleb
here is a sample of the base page that I use that interacts with the wdio-html reporter
const moment = require('moment'); const mkdirp = require('mkdirp') ; const path = require('path') ;
export default class BasePage { navigateTo (path) { browser.url(path); }
logMessage(message) {
process.emit('test:log', message);
}
takeScreenshot(message) {
this.logMessage(message) ;
const timestamp = moment().format('YYYYMMDD-HHmmss.SSS') ;
const dir = 'reports/html-reports/screenshots/' ;
mkdirp(dir) ;
const filepath = path.join(dir,timestamp + '.png');
browser.saveScreenshot(filepath);
process.emit('test:screenshot', filepath);
return this;
}
waitForPresence(selector, timeout, invert) {
try {
selector.waitForExist(timeout, invert) ;
return true ;
} catch (ex) {
return false;
}
}
}
On Wed, Mar 18, 2020 at 1:15 PM Caleb Jaquith notifications@github.com wrote:
Rich,
thanks for writing back so quickly (again). I swear I'm not being intentionally thick, but I reread the README and tried to find the test code you're talking about - I came up empty.
If you could point me in the right direction a little more specifically I'd be very grateful.
Best Caleb
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/22#issuecomment-600836562, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEKUYO2A2PLRUJCWQRDRIETRRANCNFSM4LN2WVFA .
@rpii thanks Rich. But I think we're talking about different things?
The logMessage
functionality works fine - that's not my question.
What I'm trying to do is add my mocha assertions themselves to the test report as part of the output. I don't see that in your code?
I would be fine referencing it explicitly if need be, something like
it('should pass', function() {
// add a log message to provide context in the report
logMessage("Just simple addition")
// also output the test code itself for transparency
logMessage(this.currTest.code)
expect(1+1).to.equal(2)
})
But obviously this.currTest.code isn't what I need, just an example to try to help explain.
Am I trying to do something that isn't supported by wdio?
Best Caleb
Sorry I misunderstood. I think its an issue with chai. It doesnt output anything for testing conditions which pass. Maybe someone needs to add that. I sure would like that.
On Mon, Mar 23, 2020 at 1:18 AM Caleb Jaquith notifications@github.com wrote:
@rpii https://github.com/rpii thanks Rich. But I think we're talking about different things?
The logMessage functionality works fine - that's not my question.
What I'm trying to do is add my mocha assertions themselves to the test report as part of the output. I don't see that in your code?
I would be fine referencing it explicitly if need be, something like
it('should pass', function() { // add a log message to provide context in the report logMessage("Just simple addition") // also output the test code itself for transparency logMessage(this.currTest.code) expect(1+1).to.equal(2) })
But obviously this.currTest.code isn't what I need, just an example to try to help explain.
Am I trying to do something that isn't supported by wdio?
Best Caleb
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/22#issuecomment-602448217, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEKNZMBILWJOJ2MLLDLRI4LLRANCNFSM4LN2WVFA .
Got it, thanks!
Is it possible to add the mocha test function itself to the report?
For instance, given this suite:
I'm hoping to be able to extract and add
and
to the report as part of the output for the respective test - something like what mochawesome does (but only in its non-wdio implementation).
I've been trying various wdio reporters out and haven't seen any that do that, so I'm not sure it's even a technical possibility within @wdio/mocha-framework's implementation of mocha?