isaaceindhoven / testcafe-reporter-allure

An Allure reporter plugin for TestCafé. Used to generate test reports for e2e-tests.
https://isaaceindhoven.github.io/testcafe-reporter-allure
MIT License
8 stars 14 forks source link

Bug: ERROR An uncaught error occurred in the "allure" reporter's "reportTestDone" method #76

Closed puneetpunj closed 2 years ago

puneetpunj commented 3 years ago

Bug Details

Below error comes for 20% of the test executions and this occurs while a screenshot is enabled in allure config. I have not figured out a common reason of the failure and neither been able to understand the failure reason.

ERROR An uncaught error occurred in the "allure" reporter's "reportTestDone" method. Error details: TypeError: Cannot read property 'screenshotPath' of undefined at AllureReporter.addScreenshotAttachment (C:\Users\punjp\Desktop\Puneet\retail_regression_test_framework\node_modules\testcafe-reporter-allure\dist\index.js:545:24) at AllureReporter.addStepsWithAttachments (C:\Users\punjp\Desktop\Puneet\retail_regression_test_framework\node_modules\testcafe-reporter-allure\dist\index.js:519:26) at AllureReporter.endTest (C:\Users\punjp\Desktop\Puneet\retail_regression_test_framework\node_modules\testcafe-reporter-allure\dist\index.js:493:18) at ReporterPluginHost. (C:\Users\punjp\Desktop\Puneet\retail_regression_test_framework\node_modules\testcafe-reporter-allure\dist\index.js:720:41) at step (C:\Users\punjp\Desktop\Puneet\retail_regression_test_framework\node_modules\testcafe-reporter-allure\dist\index.js:73:23) at Object.next (C:\Users\punjp\Desktop\Puneet\retail_regression_test_framework\node_modules\testcafe-reporter-allure\dist\index.js:54:53) at C:\Users\punjp\Desktop\Puneet\retail_regression_test_framework\node_modules\testcafe-reporter-allure\dist\index.js:47:71 at new Promise () at __awaiter (C:\Users\punjp\Desktop\Puneet\retail_regression_test_framework\node_modules\testcafe-reporter-allure\dist\index.js:43:12) at ReporterPluginHost.reportTestDone (C:\Users\punjp\Desktop\Puneet\retail_regression_test_framework\node_modules\testcafe-reporter-allure\dist\index.js:717:20)

Expected behavior Screenshot is added successfully to the allure report's step

puneetpunj commented 3 years ago

@vanhoofmaarten It would be very appreciable if you could help us with this error.

mrtnvh commented 3 years ago

@puneetpunj Can you provide more information? Test code snippet?

puneetpunj commented 3 years ago

@vanhoofmaarten Sample code causing the above error -

  const disabledAddConcessionButton = Selector('.mds-btn-disabled')
  await step('Validate Add concession button is disabled on page load', t, t.expect(disabledAddConcessionButton.exists).ok())
  await this.clickAcceptConcessionTerms(t)
  const enabledAddConcessionButton = Selector('.mds-btn-primary')
  await step(
    'Validate Add concession button is enabled after clicking terms and conditions checkbox',
    t,
    t.expect(enabledAddConcessionButton.exists).ok()
  )

Apart from the above sample code, it fails quite frequently for Salesforce screens, so I have to disable the screenshot.

updating the below line removed the error for me.

if (screenshot && screenshot.screenshotPath && fs.existsSync(screenshot.screenshotPath)) {

image

puneetpunj commented 3 years ago

@vanhoofmaarten Hey mate, hope you are keeping well. any update on the fix for this issue?

mrtnvh commented 3 years ago

@puneetpunj My calendar hasn't allowed me to look in to this yet. If you're up for it, you're very much welcome to look in to this and submit a PR.

mrtnvh commented 3 years ago

@puneetpunj It's hard to reproduce this error. For instance, I had this error when using an outdated version of Firefox. After the update everything worked again.

Next to some other updates, I also provided a possible fix for this issue in v2.0.0. Could you install and verify?

mrtnvh commented 3 years ago

Closing due to inactivity.

ppunjmomentum commented 2 years ago

@vanhoofmaarten Apologies for not responding earlier. The issue still persists for us even after v2.0.0. We run all our tests only on the latest chrome. As I mentioned above, it is failing on allure-reporter.ts line no. 213. If I add a check for the screenshot object, it works fine.

if (screenshot && screenshot.screenshotPath && fs.existsSync(screenshot.screenshotPath)) {

Looks like I am not

authorized to create a branch to raise PR for this.

mrtnvh commented 2 years ago

Hey, @ppunjmomentum.

You are welcome to fork the repository and create a Pull Request from that fork. Checkout https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork

If you are able to do so, please create a test where we can check on regressions of this bug.

puneetpunj commented 2 years ago

Okay sure, I will have a look. Thanks.

mrtnvh commented 2 years ago

Released in v2.2.1

FantaAI commented 1 year ago

I face this issue when I run testcafe chrome 'XXX' --reporter allure

ERROR The "reportTestDone" method of the "allure" reporter produced an uncaught error. Error details: Error: charData should not contain characters not allowed in XML at XmlCharData.set [as charData] (/Users/xiaochuan.sun/work/GCID/front end/frontend-automation-tests/node_modules/xmlcreate/lib/nodes/XmlCharData.js:75:23) at new XmlCharData (/Users/xiaochuan.sun/work/GCID/front end/frontend-automation-tests/node_modules/xmlcreate/lib/nodes/XmlCharData.js:53:24) at XmlElement.charData (/Users/xiaochuan.sun/work/GCID/front end/frontend-automation-tests/node_modules/xmlcreate/lib/nodes/XmlElement.js:168:28) at parseString (/Users/xiaochuan.sun/work/GCID/front end/frontend-automation-tests/node_modules/js2xmlparser/lib/main.js:53:27) at parseValue (/Users/xiaochuan.sun/work/GCID/front end/frontend-automation-tests/node_modules/js2xmlparser/lib/main.js:227:5) at parseObjectOrMapEntry (/Users/xiaochuan.sun/work/GCID/front end/frontend-automation-tests/node_modules/js2xmlparser/lib/main.js:132:5) at parseObjectOrMap (/Users/xiaochuan.sun/work/GCID/front end/frontend-automation-tests/node_modules/js2xmlparser/lib/main.js:152:13) at parseValue (/Users/xiaochuan.sun/work/GCID/front end/frontend-automation-tests/node_modules/js2xmlparser/lib/main.js:220:9) at parseToDocument (/Users/xiaochuan.sun/work/GCID/front end/frontend-automation-tests/node_modules/js2xmlparser/lib/main.js:249:5) at Object.parse (/Users/xiaochuan.sun/work/GCID/front end/frontend-automation-tests/node_modules/js2xmlparser/lib/main.js:265:20)

mrtnvh commented 1 year ago

@xiaochuansun Can you provide a minimal reproduction and if so, open a new issue?