Libra
Libra

Reputation: 33

Playwright Junit file into X-ray

I am able to generate a results.xml file using playwright execution and also upload to JIRA.

However, my screenshot/video from the execution are not reported back into X-Ray. I can see in xml file, ATTACHMENT in the tag as CDATA.

enter image description here

Then , I run the curl command, it runs successfully but the attachment is not present. The playwright html report does show the video as attached.

Any idea on what I am missing here or is the tag definition generated by playwright/junit is wrong or missing?

BR!

screenshot to be uploaded to xray.

Upvotes: 0

Views: 272

Answers (1)

Cristiano Cunha
Cristiano Cunha

Reputation: 391

Xray has a custom reporter available: https://github.com/Xray-App/playwright-junit-reporter that creates supported reports to be ingested into Xray.

One of the options is to add attachments:

// example.spec.ts/js
import { test } from '@playwright/test';

test('embed attachments, including its content, on the JUnit report', async ({}, testInfo) => {
  const file = testInfo.outputPath('evidence1.txt');
  require('fs').writeFileSync(file, 'hello', 'utf8');
  await testInfo.attach('evidence1.txt', { path: file, contentType: 'text/plain' });
  await testInfo.attach('evidence2.txt', { body: Buffer.from('world'), contentType: 'text/plain' });
});

Upvotes: 1

Related Questions