Screenshot not taken on failure
Closed this issue · 3 comments
when test fails due to "no element found using locator" no screenshots are taken of the failure.
My protractor config file has
let reporter = new HtmlScreenshotReporter({
showSummary: true,
showQuickLinks: true,
reportFailedUrl: true,
dest: 'screenshots/' +runID,
filename: 'my-report_'+runID+'.htm',
reportOnlyFailedSpecs: false,
captureOnlyFailedSpecs: false
});
other screenshots are being taken correctly
This behavior is correct, because your test actually threw an exception - hence the execution stopped and screenshot is not executed. This is a technical error, coming from Protractor - you need to either catch it and fail the test manually, or simply check for element's existence before interacting with it.
I agree, I think it would be helpful when maintaining tests that fail suddenly after working for weeks, having a screenshot of the point of failure can be helpful.
Sure, but that's something a library usually wouldn't do for you. You need to write your tests that way.