inluxc / playwright-xray

XRAY reporter for Playwright
MIT License
26 stars 11 forks source link

Error message in Comment field in XRay not formatted (XRay Cloud) #79

Open jreyes-fy opened 2 weeks ago

jreyes-fy commented 2 weeks ago

Added the reporter to config file to get results in Jira XRay test execution. The failed test is a text comparison.

The tests run in Github Actions, test execution is created in XRAy. However, the comment column contains the error message as follows:

[{"message":"Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoEqual\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // deep equality\u001b[22m\n\nExpected: \u001b[32m\"Test\"\u001b[39m\nReceived: \u001b[31m\"Incorrect username or password.\"\u001b[39m","stack":"Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoEqual\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // deep equality\u001b[22m\n\nExpected: \u001b[32m\"Test\"\u001b[39m\nReceived: \u001b[31m\"Incorrect username or password.\"\u001b[39m\n at /home/runner/work/qa-automation-ui/qa-automation-ui/fitConsole/tests/loginTest.spec.ts:23:26","location":{"file":"/home/runner/work/qa-automation-ui/qa-automation-ui/fitConsole/tests/loginTest.spec.ts","column":26,"line":23},"snippet":"\u001b[0m \u001b[90m 21 |\u001b[39m \u001b[36mawait\u001b[39m loginPage\u001b[33m.\u001b[39mlogin(username\u001b[33m,\u001b[39m \u001b[32m\"WrgPwd\"\u001b[39m)\u001b[33m;\u001b[39m\n \u001b[90m 22 |\u001b[39m \u001b[36mconst\u001b[39m errorMessage \u001b[33m=\u001b[39m \u001b[36mawait\u001b[39m loginPage\u001b[33m.\u001b[39mgetErrorMessage()\u001b[33m;\u001b[39m\n\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 23 |\u001b[39m expect(errorMessage)\u001b[33m.\u001b[39mtoEqual(\u001b[32m\"Test\"\u001b[39m)\u001b[33m;\u001b[39m\n \u001b[90m |\u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\n \u001b[90m 24 |\u001b[39m })\u001b[33m;\u001b[39m\n \u001b[90m 25 |\u001b[39m })\u001b[33m;\u001b[39m\n \u001b[90m 26 |\u001b[39m\u001b[0m"}]

Expected behavior Expected: Test Received: "Incorrect username or password"

Screenshots attached 10252024_comment_issue

Desktop (please complete the following information): OS: iOS (MacBook Air) Running tests in Visual Studio Code Terminal playwright-xray version: ^0.6.5 @playwright/test: ^1.48.1 @types/node: ^22.7.9

Additional context Add any other context about the problem here.

Niklas-Back commented 2 weeks ago

Looks like ansi codes are not properly filtered out from comment. Can you please send the report file after dry run (just run the test in question)

jreyes-fy commented 2 weeks ago

Hi Niklas, please find attached the file. I would really appreciate your help on this and other tickets I submitted. xray-payload.json

NiklasBack commented 2 weeks ago

I will try to add an ansi filter

Niklas-Back commented 2 weeks ago

I have updated the ansi filtering, but the problem is that when I run it in our pipelines it strips away the ansi characters correctly (with the old and the new filter) so I wonder if I can send you a package to test before releasing?

jreyes-fy commented 2 weeks ago

Hi @Niklas-Back sure send me the package, I can test it

Niklas-Back commented 1 week ago

New try https://drive.google.com/file/d/1hekIBKTYFxIoMZBcGRjPtbnr0v8_Y0HL/view?usp=sharing

jreyes-fy commented 1 week ago

hey @Niklas-Back same result with 0.6.7 image xray-payload.json

Niklas-Back commented 1 week ago

Ok, I think I have to get hold of a Mac so I can debug

jreyes-fy commented 1 week ago

or Linux, I am getting the same issue when running from GH Actions, running on ubuntu-latest, the comment looks the same in XRay.

Niklas-Back commented 1 week ago

Hi, do you have time for a debugging session? I didnt manage to reproduce it in Github Actions or on a Mac

jreyes-fy commented 1 week ago

Hi Niklas, sure, let me know when you are available and I can schedule a meeting in the coming days

Niklas-Back commented 1 week ago

Hi, Im based in Stockholm so Im at CET. Thursday or Friday. How can I contact you?