Skip to content

siam1113/playwright_integretions

Repository files navigation

Playwright Integretions

Playing with playwright integretions

Xray Integretion

  1. Setup playwright
  2. 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/');
});
  1. Set junit as reporter in the playwright.config.ts file.
reporter: [['junit', { outputFile: 'results.xml' }]],
  1. Run the playwright tests.
  2. Get your API key from XRay client_id and client_secret.
  3. 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
  1. Get your project_key and test_plan_key from XRay.
  2. 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.