How to add screenshots in Nightwatch html reporter

93 views
Skip to first unread message

Prerit Bhuwalka

unread,
Jun 11, 2020, 5:26:35 AM6/11/20
to NightwatchJs
We are able to save screenshots at specified folder using -

"screenshots" : {
        "enabled" : true,
        "path" : "./tests/screenshots/",
        "on_failure" : true,
        "on_skip" : true,
        "on_pass" : true
      },


We have generated the Nightwatch html report using handlebars but we are unable to add screenshot to report.

Priya Gaba

unread,
Jun 12, 2020, 4:58:52 AM6/12/20
to NightwatchJs
I am also facing the same issue - attaching screenshot to NightWatch html report .

Pieraś

unread,
Jun 12, 2020, 6:01:27 AM6/12/20
to nightw...@googlegroups.com
Mission impossible :-)
Never read about it though would be great.

To me NW becomes too frustrating - even index.d.ts we had to update on our own to write test in typescript. I will use it for some time then I am going to find something else. 

--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/8ffd3354-1209-47bc-8ed1-c2d2ea7ac6c6o%40googlegroups.com.

Zachary Betz

unread,
Jul 20, 2020, 10:10:25 AM7/20/20
to NightwatchJs
I attach screenshots to HTML reports by Base64 encoding the image, so that the report stays portable. For samples see https://github.com/zwbetz-gh/nightwatchjs-template

Zachary Betz

unread,
Jul 20, 2020, 10:21:06 AM7/20/20
to NightwatchJs
The relevant lines that actually Base64 encode the screenshot then create an img element are here https://github.com/zwbetz-gh/nightwatchjs-template/blob/f81fc7e788a9ed966f97ddc7f49f23e2484d522a/src/shared/report_html.js#L86-L112
Reply all
Reply to author
Forward
0 new messages