Skip to main content

CodeceptJS

Installation

Install the npm package:

npm install --save-dev @orangebeard-io/codeceptjs-listener

The source code can be found on GitHub: CodeceptJS Listener

Configuration

Create orangebeard.json in your project folder (or above):

{
"endpoint": "https://app.orangebeard.io/{ORGANIZATION}",
"token": "{ACCESS_TOKEN}",
"project": "{ORANGEBEARD_PROJECT}",
"testset": "CodeceptJS Test Set",
"description": "CodeceptJS run",
"attributes": [
{
"key": "Tool",
"value": "CodeceptJS"
}
]
}

Note: Description and attributes are optional.

Configure the reporter in your codecept.conf.js / codecept.conf.ts:

exports.config = {
// ...
mocha: {
reporter: '@orangebeard-io/codeceptjs-listener',
reporterOptions: {
// Optional: override orangebeard.json values
// endpoint: 'https://...',
// token: '...',
// project: '...',
// testset: '...',
},
},
};

Optional: enable screenshot plugin to attach failure screenshots:

exports.config = {
// ...
plugins: {
screenshotOnFail: {
enabled: true,
},
},
};

Running

Run tests as usual:

npx codeceptjs run

You can also provide Orangebeard values via environment variables:

ORANGEBEARD_ENDPOINT=https://company.orangebeard.app
ORANGEBEARD_TOKEN=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
ORANGEBEARD_PROJECT="my project"
ORANGEBEARD_TESTSET="my test set"
ORANGEBEARD_DESCRIPTION="CodeceptJS run"
ORANGEBEARD_ATTRIBUTES="key:value; singleTag;"

What gets reported

  • Features are reported as suites.
  • Scenarios are reported as tests.
  • I.* actions are reported as real-time steps.
  • I.say(...) sections are reported as parent steps with nested child steps.
  • Hook activity is grouped under Before / After parent steps.
  • Test tags are reported as Orangebeard attributes.
  • Step and test errors are reported as logs with stack traces.
  • I.executeScript(...) source is logged as Markdown on the step.
  • HTTP request steps (sendGetRequest, sendPostRequest, etc.) keep URL in step name and log payload/headers as Markdown.
  • Screenshots (e.g. from screenshotOnFail) are attached to the corresponding test.