Qase TMS Playwright Reporter
npm install playwright-qase-reporterQase Playwright reporter sends test results and metadata to Qase.io.
It can work in different test automation scenarios:
* Create new test cases in Qase from existing autotests.
* Report Playwright test results to existing test cases in Qase.
* Update existing cases with metadata, such as parameters and fields.
To install the latest version, run:
``sh`
npm install -D playwright-qase-reporter
- Qase TMS Playwright reporter
- Contents
- Getting started
- Updating from v1
- Example of usage
- Configuration
- Requirements
To report your tests results to Qase, install playwright-qase-reporter,playwright.config.ts
and add a reporter config in the file.
A minimal configuration needs just two things:
* Qase project code, for example, in https://app.qase.io/project/DEMO the code is DEMO.
* Qase API token, created on the Apps page.
`js`
const config: PlaywrightTestConfig = {
// ...
reporter: [
[
'playwright-qase-reporter',
{
testops: {
api: {
token: 'api_token',
},
project: 'project_code',
},
},
],
],
// ...
};
module.exports = config;
Now run the tests as usual.
Test results will be reported to a new test run in Qase:
`console`
$ npx playwright test
Running 5 tests using 1 worker
...
...
...
qase: 5 results sent to Qase
qase: run 1 completed
qase: Test run link: https://app.qase.io/run/DEMO/dashboard/1
To update a test project using qase-playwright-reporter@v1 to version 2:
1. Change the import paths:
`diff`
- import { qase } from 'playwright-qase-reporter/dist/playwright'
+ import { qase } from 'playwright-qase-reporter'
2. Update reporter configuration in playwright.config.js and/or environment variables —
see the configuration reference below.
The previous test annotation syntax is still supported, so there is no need to rewrite the tests.
However, check out the docs for the new, more flexible and powerful syntax.
The Playwright reporter has the ability to auto-generate test cases
and suites from your test data.
But if necessary, you can independently register the ID of already
existing test cases from TMS before the executing tests. For example:
`typescript
import { qase } from 'playwright-qase-reporter';
describe('Test suite', () => {
test(qase(2, 'Test with Qase ID'), () => {
expect(true).toBe(true);
});
test('Simple test', () => {
qase.title('Example of simple test');
expect(true).toBe(true);
});
test('Test with annotated fields', () => {
qase.fields({ 'severity': 'high', 'priority': 'medium' });
expect(true).toBe(true);
});
test('Running, but not reported to Qase', () => {
qase.ignore();
expect(true).toBe(true);
});
test('Test with steps', async () => {
await test.step('Step 1', async () => {
expect(true).toBe(true);
});
await test.step('Step 2', async () => {
expect(true).toBe(true);
});
expect(true).toBe(true);
});
});
`
---
To run tests and create a test run, execute the command (for example from folder examples):
`bash`
QASE_MODE=testops npx playwright test
or
`bash`
npm test

A test run will be performed and available at:
``
https://app.qase.io/run/QASE_PROJECT_CODE

Qase Playwright Reporter supports sending test results to multiple Qase projects simultaneously. You can specify different test case IDs for each project using qase.projects(mapping) or qase.projectsTitle(name, mapping).
For detailed information, configuration, and examples, see the Multi-Project Support Guide.
Reporter options (\* - required):
- mode - testops/off Enables reporter, default - offdebug
- - Enables debug logging, default - falseenvironment
- - To execute with the sending of the environment information testops.api.token
- * - Token for API access, you can generate it here.testops.project
- * - Your project's codetestops.uploadAttachments
- - Permission to send screenshots to Qase TMStestops.run.id
- - Pass Run IDtestops.run.title
- - Set custom Run name, when new run is createdtestops.run.description
- - Set custom Run description, when new run is createdtestops.run.complete
- - Whether the run should be completedframework.browser.addAsParameter
- - Whether to add the browser name as a parameter, default - falseframework.browser.parameterName
- - The name of the parameter to add the browser name to, default - browserframework.markAsFlaky
- - Whether to mark tests as flaky if they passed after retries, default - false
Example playwright.config.js config:
`js`
const config = {
use: {
screenshot: 'only-on-failure',
video: 'retain-on-failure',
},
reporter: [
['list'],
[
'playwright-qase-reporter',
{
debug: true,
testops: {
api: {
token: 'api_key',
},
project: 'project_code',
uploadAttachments: true,
run: {
complete: true,
},
},
framework: {
browser: {
addAsParameter: true,
parameterName: 'Browser Name',
},
markAsFlaky: true,
},
},
],
],
};
module.exports = config;
You can check example configuration with multiple reporters in example project.
Supported ENV variables:
- QASE_MODE - Same as modeQASE_DEBUG
- - Same as debugQASE_ENVIRONMENT
- - Same as environment QASE_TESTOPS_API_TOKEN
- - Same as testops.api.tokenQASE_TESTOPS_PROJECT
- - Same as testops.projectQASE_TESTOPS_RUN_ID
- - Pass Run ID from ENV and override reporter option testops.run.idQASE_TESTOPS_RUN_TITLE
- - Same as testops.run.titleQASE_TESTOPS_RUN_DESCRIPTION
- - Same as testops.run.description
We maintain the reporter on LTS versions of Node.js.
@playwright/test >= 1.16.3`
[auth]: https://developers.qase.io/#authentication