Playing with playwright integretions
- Setup playwright
- Create your playwright tests and add this in your test file (mapping xray tests in playwright).
test('test title', async ({ page }, testInfo) => {
//Adding Xray properties
testInfo.annotations.push({ type: 'test_key', description: 'GM-2' });
await page.goto('https://playwright.dev/');
});
- Set junit as reporter in the
playwright.config.ts
file.
reporter: [['junit', { outputFile: 'results.xml' }]],
- Run the playwright tests.
- Get your API key from XRay
client_id
andclient_secret
. - Get the authentication token.
curl -H "Content-Type: application/json" -X POST --data '{ "client_id": "client_id","client_secret": "client_secret" }' https://xray.cloud.getxray.app/api/v1/authenticate
- Get your
project_key
andtest_plan_key
from XRay. - Upload test result to XRay
curl -H "Content-Type: text/xml" -X POST -H "Authorization: Bearer $token" --data @"junit.xml" https://xray.cloud.getxray.app/api/v2/import/execution/junit?projectKey=project_key&testPlanKey=test_plan_key
Note: If anyone face any trouble, kindly create an issue for that. I will try to resolve it for you asap.