webdriverio-community / wdio-html-reporter

Fork of wdio-html-format-reporter
MIT License
18 stars 27 forks source link

Screenshots not coming for url navigation #41

Closed qburst-hari closed 3 years ago

qburst-hari commented 3 years ago

I have made the option "useOnAfterCommandForScreenshot" to true. but still for url navigation or opening html pages, screenshots are not getting attached to report. I am using webdriverIO6 with cucumber

rpii commented 3 years ago

you need to add the sample code shown in

afterTest: function (test) { const path = require('path'); const moment = require('moment');

// if test passed, ignore, else take and save screenshot.
if (test.passed) {
    return;
}
const timestamp = moment().format('YYYYMMDD-HHmmss.SSS');
const filepath = path.join('reports/html-reports/screenshots/',

timestamp + '.png'); browser.saveScreenshot(filepath); process.emit('test:screenshot', filepath); },

if that is not working maybe cucumber is not firing this event.

On Mon, Nov 9, 2020 at 12:57 AM Qburst - Hari notifications@github.com wrote:

I have made the option "useOnAfterCommandForScreenshot" to true. but still for url navigation or opening html pages, screenshots are not getting attached to report. I am using webdriverIO6 with cucumber

— 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/41, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEABIEODXAFB5QT63THLR5LSO6VGDANCNFSM4TPBPH7Q .

rpii commented 3 years ago

no response