A Jest reporter with Detox support that uploads the results to a ReportPortal server.
npm install --save-dev @bolteu/agent-js-jestIn your jest config section of package.json, add the following entry:
{
"jest": {
"reporters": [
"default",
["@bolteu/agent-js-jest",
{
"token": "00000000-0000-0000-0000-000000000000",
"endpoint": "https://your.reportportal.server/api/v1",
"project": "YourReportPortalProjectName",
"launch": "YourLauncherName",
"description": "YourDescription",
"logLaunchLink": true,
"attributes": [
{
"key": "YourKey",
"value": "YourValue"
},
{
"value": "YourValue"
}
],
"restClientConfig": {
"timeout": 0
}
}]
]
}
}In case you use jest.config.js, you should add to it the following:
module.exports = {
reporters: [
"default",
[
"@bolteu/agent-js-jest",
{
"token": "00000000-0000-0000-0000-000000000000",
"endpoint": "https://your.reportportal.server/api/v1",
"project": "YourReportPortalProjectName",
"launch": "YourLauncherName",
"description": "YourDescription",
"logLaunchLink": true,
"disabled": true,
"disableUploadAttachments": true,
"attributes": [
{
"key": "YourKey",
"value": "YourValue"
},
{
"value": "YourValue"
},
]
}
]
],It's possible by using environment variables, it's important to mention that environment variables has precedence over package.json definition.
$ export RP_TOKEN=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
$ export RP_PROJECT_NAME=MY_AWESOME_PROJECT
$ export RP_ENDPOINT=MY_RP_ENDPOINT
$ export RP_LAUNCH=MY_COOL_LAUNCHER
$ export RP_ATTRIBUTES=key:value,key:value,value
$ export RP_LAUNCH_ID=EXIST_LAUNCH_ID
$ export RP_RERUN=boolean
$ export RP_RERUNOF=EXIST_LAUNCH_ID
$ export RP_DESCRIPTION=MY_LAUNCH_DESCRIPTION
$ export RP_ARTIFACTS_PATH=MY_DETOX_ARTIFACTS_PATH
$ export RP_DISABLED=false
$ export RP_DISABLE_UPLOAD_ATTACHMENTS=falseThis for your convenience in case you has a continuous job that run your tests and may post the results pointing to a different Report Portal definition of project, launcher name or tags.
In the Report Portal, the output of the test results may contain ANSI character set, this may be caused by the color setting in Jest. For version "jest": "^24.8.0", use jest --no-colors command to disable the colors of test output.
The agent supports of Retries. Read more about retries in jest.
The agent supports Detox Retries (including CLI --retries).
Read more about retries in detox.
Reruns are automatically handled for Detox retries.
To report rerun to the report portal you need to specify the following options:
- rerun - to enable rerun
- rerunOf - UUID of launch you want to rerun. If not specified, report portal will update the latest launch with the same name
Example:
"rerun": true,
"rerunOf": "f68f39f9-279c-4e8d-ac38-1216dffcc59c"Default: '__e2e__/artifacts/'.
Artifacts path where detox store captured videos/screenshots/device logs.
All mp4, png and log files will be included as an attachments to failed test logs.
Example:
"artifactsPath": '__e2e__/artifacts/'This flag disables sending e2e tests data to report portal. (Default: false)
Example:
"disabled": falseThis flag disables sending e2e tests attachments to report portal. (Default: false)
Example:
"disableUploadAttachments": trueDefault: true. ReportPortal provides feature to mark skipped tests as not 'To Investigate' items on WS side.
Parameter could be equal boolean values:
TRUE - skipped tests considered as issues and will be marked as 'To Investigate' on Report Portal.
FALSE - skipped tests will not be marked as 'To Investigate' on application.
Example:
"skippedIssue": falseLaunch mode. Allowable values DEFAULT (by default) or DEBUG.
Example:
"mode": "DEBUG"This flag allows seeing the logs of the client-javascript. Useful for debugging an agent.
Example:
"debug": trueThis flag allows print the URL of the Launch of the tests in console.
Example:
"logLaunchLink": trueOptional property.
The object with agent property for configure http(s) client, may contain other client options eg. timeout.
Visit client-javascript for more details.
Licensed under the Apache License v2.0
This code was based on the jest-junit and adapted by team members of Ontoforce for the ReportPortal upload. Ontoforce contributed this effort as Open Source to the ReportPortal project team.