# TestCafe reporter

This is the **sealights** reporter plugin for [TestCafe](http://devexpress.github.io/testcafe).

{% hint style="warning" %}
For more details, you can also refer to [https://www.npmjs.com/package/sealights-jest-plugin](https://www.npmjs.com/package/testcafe-reporter-sealights)
{% endhint %}

## Configuration

{% stepper %}
{% step %}

#### Install the Reporter

To install the Sealights TestCafe reporter, follow the instructions below.

```bash
npm install testcafe-reporter-sealights
```

{% endstep %}

{% step %}

#### Run TestCafe with SeaLights Reporter

Execute your TestCafe command and specify the reporter name by using the `--reporter` option and passing it arguments via the `--sl-` prefix

{% code overflow="wrap" %}

```bash
testcafe chrome test/spec.js --reporter sealights --sl-token sltoken.txt --sl-testStage 'API Tests' --sl-labId lab1
```

{% endcode %}
{% endstep %}
{% endstepper %}

{% hint style="success" %}
When the command and **Jest tests complete successfully**, a new test stage (with the name you specified) will appear in the Sealights dashboard under the corresponding build. This stage will include the **associated test results and coverage data.**
{% endhint %}

## Logging and Debugging

Enable detailed logging:

```bash
export SL_LOG_LEVEL=debug
```

## Sample End-to-End Pipeline Script

{% code overflow="wrap" %}

```bash
# 1. Install dependencies and SeaLights TestCafe reporter
npm ci
npm install testcafe-reporter-sealights

# 2. Run tests with SeaLights
#export SL_LOG_LEVEL=debug
testcafe chrome test/spec.js --reporter sealights --sl-token $SL_TOKEN --sl-testStage 'API Tests' --sl-labId QA-env2
```

{% endcode %}

✅ Coverage data are test results are uploaded automatically to your SeaLights dashboard

## Reporter's Arguments

<table><thead><tr><th width="222.88885498046875">CLI Parameter</th><th>Description</th><th width="99.3333740234375">Required</th></tr></thead><tbody><tr><td><code>--sl-testStage</code></td><td>Name of the test stage (“Unit”, “Integration”, etc.)</td><td>✅</td></tr><tr><td><code>--sl-token</code> or <code>--sl-tokenFile</code></td><td>Authentication token or Path to file containing the token (by default <code>sltoken.txt</code>)</td><td>✅</td></tr><tr><td><code>--sl-labId</code></td><td>Lab ID used to identify the test environment</td><td>✅</td></tr><tr><td><code>--sl-buildSessionId</code> or <code>--sl-buildSessionIdFile</code></td><td>(Deprecated) Build Session ID. Use <code>--sl-labId</code> instead.</td><td>Optional</td></tr><tr><td><code>--sl-proxy</code></td><td>Proxy configuration (host:port or URL)</td><td>Optional</td></tr><tr><td><code>--sl-enforceFullRun</code></td><td>Overrides Test Optimization's recommendations and runs all tests.</td><td>Optional</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/node.js-testing-plugins/testcafe-reporter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
