Skip to main content

Halo CLI with Playwright

Run your Playwright tests and generate the results XML file

Playwright will generate a single XML file for a full suite of tests. This XML file can be uploaded to Halo. To generate the XML file, set your Playwright config reporter to junit as follows:

playwright.config.ts
import type { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
reporter: [['junit', {
outputFile: 'results/test-results.xml'
}]],
};

export default config;
npx playwright test

This will generate an XML file in the results directory.

Uploading your Playwright test results to Halo

To upload the XML result file to Halo, install the Halo CLI.

Generate an API key in Halo from the project 'Settings' page. API keys are project specific and will dictate the project to which data is sent.

You can also include metadata in your Halo reporting with the use of the '--metadata' flag. Any following environment variables with the HALO_ prefix will be uploaded as metadata. For security reasons, HALO_TOKEN will not be stored or displayed.

export HALO_TOKEN=<apiKey>

halo playwright
--file results/test-results.xml \
--instance https://<orgId>.testevolve.io \
--label playwright-regression \
--metadata KEY=VALUE --metadata KEY=VALUE \

You should now see your labelled Playwright test results in Halo. If you used a new label or a label that is not currently assigned to a Halo hierarchy node, you'll find the results on the 'Unassigned Labels' page as well as the 'Home' page.

If you used a label that is assigned to a Halo hierarchy node, you'll find the results on the targeted node as well as the 'Home' page.