Sunday, 11 August 2019

Nightwatch JS Report Parsing Problems

I’m running some Nightwatch automated tests, and am having some problems parsing the reports with Jenkins and the nightwatch-html-reporter package.

The assertion in question is (basically checking for an alt tag value on a lot of links):

alts.value.forEach(alt => {
    this.verify.notEqual('', alt.value || '', '\nImage URL: ' + src.value + '\nImage Tag: ' + tagName + '\n');
}

And I’m catching several failures in the report that look like this, one after another in the report (probably 10 of them with different url’s):

<failure message="Failed [notEqual]: (
Image URL: https://<url>/bc/wp-content/uploads/blog-placeholder-img.jpg
Image Tag: img
) - expected [0;32m&#34;&#34;[0m but got: [0;31m&#34;&#34;[0m">Image URL: https://<url>/bc/wp-content/uploads/blog-placeholder-img.jpg
Image Tag: img

at NightwatchAPI.&lt;anonymous&gt; (/workspace/WebsiteLaunchAutomation/custom_commands/verifyImgAltTag.js:13:23)
at processTicksAndRejections (internal/process/task_queues.js:89:5)</failure>

<failure message="Failed [notEqual]: (
Image URL: https://<url>/bc/wp-content/uploads/Cars.jpg
Image Tag: img
) - expected [0;32m&#34;&#34;[0m but got: [0;31m&#34;&#34;[0m">Image URL: https://<url>/bc/wp-content/uploads/Cars.jpg
Image Tag: img

at NightwatchAPI.&lt;anonymous&gt; (/workspace/WebsiteLaunchAutomation/custom_commands/verifyImgAltTag.js:13:23)
at processTicksAndRejections (internal/process/task_queues.js:89:5)</failure>

My problem is when Jenkins reads the report, it only ever displays the first failure, when I am expecting it to display all the failures in the xml report.

Even worse, the nightwatch-html-reporter stops after the opening failure tag, and doesn’t print the stacktrace, or to the end of the first closing failure tag. Here is a bad example:

<failure message =“some message”> (stack trace and other ignored stuff)</failure>

So my question is, am I doing something to cause it to cut off like this? Can I change anything in the report so either of these tools can parse the report properly? (I’m not normally a javascript dev, I usually do selenium + java, and testng reports have always been fine)



from Nightwatch JS Report Parsing Problems

No comments:

Post a Comment