# testcafe-reporter-qase

> Qase TMS TestCafe Reporter

Latest version **2.7.0** (published 2026-08-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install testcafe-reporter-qase
pnpm add testcafe-reporter-qase
yarn add testcafe-reporter-qase
bun add testcafe-reporter-qase
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.7.0 |
| Published | 2026-08-19 |
| First published | 2021-02-14 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 2 |
| Unpacked size | 7.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Qase Team |
| Maintainers | qaseio, zeburek |

## Links

- npm: https://www.npmjs.com/package/testcafe-reporter-qase
- Repository: https://github.com/qase-tms/qase-javascript
- Issues: https://github.com/qase-tms/qase-javascript/issues
- npm.io page: https://npm.io/package/testcafe-reporter-qase

## Dependencies (2)

- [uuid](https://npm.io/package/uuid.md) 11.1.1
- [qase-javascript-commons](https://npm.io/package/qase-javascript-commons.md) ~2.9.0

## Recent versions

- 2.7.0 (latest) — 2026-08-19
- 2.0.0-beta.2 (beta) — 2024-05-29
- 2.6.2 — 2026-06-08
- 2.6.1 — 2026-06-05
- 2.6.0 — 2026-04-30
- 2.5.0 — 2026-04-27
- 2.4.0 — 2026-04-21
- 2.3.0 — 2026-04-09
- 2.2.3 — 2026-03-11
- 2.2.2 — 2026-03-04
- 2.2.1 — 2026-02-16
- 2.2.0 — 2026-02-03
- 2.1.3 — 2025-09-10
- 2.1.2 — 2025-08-12
- 2.1.1 — 2025-06-04
- … 20 more at https://npm.io/package/testcafe-reporter-qase/versions

## README

# [Qase TestOps](https://qase.io) TestCafe Reporter

[![License](https://lxgaming.github.io/badges/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![npm downloads](https://img.shields.io/npm/dm/testcafe-qase-reporter.svg)](https://www.npmjs.com/package/testcafe-qase-reporter)

Qase TestCafe Reporter enables seamless integration between your TestCafe tests and [Qase TestOps](https://qase.io), providing automatic test result reporting, test case management, and comprehensive test analytics.

## Features

- Link automated tests to Qase test cases by ID
- Auto-create test cases from your test code
- Report test results with rich metadata (fields, attachments, steps)
- Support for parameterized tests
- Multi-project reporting support
- Flexible configuration (file, environment variables)
- Browser name as a test parameter
- Network Profiler for automatic HTTP request capture

## Installation

```bash
npm install --save-dev testcafe-reporter-qase
```

## Quick Start

**1. Create `qase.config.json` in your project root:**

```json
{
  "mode": "testops",
  "testops": {
    "project": "YOUR_PROJECT_CODE",
    "api": {
      "token": "YOUR_API_TOKEN"
    }
  }
}
```

**2. Add Qase ID to your test using metadata:**

```javascript
import { test } from 'testcafe';
import { qase } from 'testcafe-reporter-qase/qase';

fixture`Example Fixture`
  .page`https://example.com`;

test.meta(qase.id(1).create())(
  'Test with Qase ID',
  async (t) => {
    await t.expect(true).ok();
  }
);
```

**3. Run your tests with Qase reporter:**

```bash
QASE_MODE=testops npx testcafe chrome tests/ -r spec,qase
```

## Configuration

The reporter is configured via (in order of priority):

1. **Environment variables** (`QASE_*`)
2. **Config file** (`qase.config.json`)

### Minimal Configuration

| Option | Environment Variable | Description |
|--------|---------------------|-------------|
| `mode` | `QASE_MODE` | Set to `testops` to enable reporting |
| `testops.project` | `QASE_TESTOPS_PROJECT` | Your Qase project code |
| `testops.api.token` | `QASE_TESTOPS_API_TOKEN` | Your Qase API token |

### Example `qase.config.json`

```json
{
  "mode": "testops",
  "fallback": "report",
  "testops": {
    "project": "YOUR_PROJECT_CODE",
    "api": {
      "token": "YOUR_API_TOKEN"
    },
    "run": {
      "title": "TestCafe Automated Run"
    },
    "batch": {
      "size": 100
    }
  },
  "report": {
    "driver": "local",
    "connection": {
      "local": {
        "path": "./build/qase-report",
        "format": "json"
      }
    }
  }
}
```

> **Full configuration reference:** See [qase-javascript-commons](../qase-javascript-commons/README.md) for all available options including logging, status mapping, execution plans, and more.

## Usage

### Link Tests with Test Cases

Associate your tests with Qase test cases using the `qase.id()` method:

**Single ID:**
```javascript
import { qase } from 'testcafe-reporter-qase/qase';

test.meta(qase.id(1).create())(
  'Test with single ID',
  async (t) => {
    await t.expect(true).ok();
  }
);
```

**Multiple IDs:**
```javascript
test.meta(qase.id([1, 2, 3]).create())(
  'Test linked to multiple cases',
  async (t) => {
    await t.expect(true).ok();
  }
);
```

### Add Metadata

Enhance your tests with additional information:

**Custom Title:**
```javascript
test.meta(qase.title('Custom test title').create())(
  'Test with custom title',
  async (t) => {
    await t.expect(true).ok();
  }
);
```

**Fields:**
```javascript
test.meta(
  qase.fields({
    'severity': 'critical',
    'priority': 'high',
    'layer': 'e2e',
    'description': 'Verifies critical user flow',
  }).create()
)(
  'Test with fields',
  async (t) => {
    await t.expect(true).ok();
  }
);
```

**Combined Metadata:**
```javascript
test.meta(
  qase.id(1)
    .title('User can login successfully')
    .fields({ 'severity': 'critical', 'priority': 'high' })
    .parameters({ 'browser': 'chrome', 'environment': 'staging' })
    .create()
)(
  'Login test',
  async (t) => {
    await t.typeText('#email', 'user@example.com');
    await t.typeText('#password', 'password123');
    await t.click('#login-button');
    await t.expect('#dashboard').exists;
  }
);
```

### Add Steps

Create detailed test steps for better reporting:

```javascript
import { qase } from 'testcafe-reporter-qase/qase';

test('Test with steps', async (t) => {
  await qase.step('Navigate to login page', async () => {
    await t.navigateTo('https://example.com/login');
  });

  await qase.step('Enter credentials', async (s1) => {
    await s1.step('Type email', async () => {
      await t.typeText('#email', 'user@example.com');
    });

    await s1.step('Type password', async () => {
      await t.typeText('#password', 'password123');
    });
  });

  await qase.step('Submit form', async () => {
    await t.click('#login-button');
  });
});
```

### Attach Files

Attach screenshots or other files to test results:

```javascript
import { qase } from 'testcafe-reporter-qase/qase';

test('Test with attachments', async (t) => {
  const screenshot = await t.takeScreenshot();

  qase.attach({
    name: 'screenshot.png',
    content: screenshot,
    contentType: 'image/png',
  });

  qase.attach({ paths: '/path/to/log.txt' });
  qase.attach({ paths: ['/path/to/file1.txt', '/path/to/file2.log'] });
});
```

### Ignore Tests

Exclude specific tests from Qase reporting (test still runs):

```javascript
test.meta(qase.ignore().create())(
  'Test ignored in Qase',
  async (t) => {
    await t.expect(true).ok();
  }
);
```

### Test Result Statuses

| TestCafe Result | Qase Status |
|-----------------|-------------|
| passed | passed |
| failed | failed |
| skipped | skipped |

> For more usage examples, see the [Usage Guide](docs/usage.md).

## Running Tests

### Basic Execution

```bash
# Run all tests with Qase reporter
QASE_MODE=testops npx testcafe chrome tests/ -r spec,qase

# Run specific test file
QASE_MODE=testops npx testcafe chrome tests/login.test.js -r qase

# Run in headless mode
QASE_MODE=testops npx testcafe chrome:headless tests/ -r qase
```

### Multiple Browsers

```bash
# Run in multiple browsers
QASE_MODE=testops npx testcafe chrome,firefox tests/ -r qase

# Run in all installed browsers
QASE_MODE=testops npx testcafe all tests/ -r qase
```

### Environment Variables

```bash
# Override configuration with environment variables
QASE_MODE=testops \
QASE_TESTOPS_PROJECT=DEMO \
QASE_TESTOPS_API_TOKEN=your_token \
npx testcafe chrome tests/ -r qase
```

### With TestCafe Configuration File

Create `.testcaferc.json`:

```json
{
  "browsers": ["chrome:headless"],
  "src": ["tests/**/*.test.js"],
  "reporter": [
    {
      "name": "spec"
    },
    {
      "name": "qase"
    }
  ],
  "concurrency": 3,
  "quarantineMode": false
}
```

Then run:

```bash
QASE_MODE=testops npx testcafe
```

## Browser as Parameter

When running tests, the reporter can automatically add the browser name as a test parameter. The browser is detected from TestCafe's user agent string (e.g., `"Chrome 97.0 / macOS 10.15"` → `"chrome"`).

**Enable in `qase.config.json`:**

```json
{
  "framework": {
    "testcafe": {
      "browser": {
        "addAsParameter": true,
        "parameterName": "browser"
      }
    }
  }
}
```

| Option | Description | Default |
|--------|-------------|---------|
| `browser.addAsParameter` | Add browser name as a test parameter | `false` |
| `browser.parameterName` | Name of the parameter | `browser` |

## Network Profiler

The Network Profiler automatically captures outgoing HTTP requests made during test execution and reports them as REQUEST-type steps in Qase TestOps.

**Enable in `qase.config.json`:**

```json
{
  "profilers": ["network"],
  "networkProfiler": {
    "skip_domains": ["analytics.example.com"],
    "track_on_fail": true
  }
}
```

| Option | Description | Default |
|--------|-------------|---------|
| `profilers` | Array of profilers to enable. Use `["network"]` for HTTP capture | `[]` |
| `networkProfiler.skip_domains` | Domains to exclude from profiling | `[]` |
| `networkProfiler.track_on_fail` | Capture response body for failed requests (status >= 400) | `true` |

> Requests to `qase.io` are always excluded automatically.

## Requirements

- Node.js >= 14
- TestCafe >= 2.0.0

## Documentation

| Guide | Description |
|-------|-------------|
| [Usage Guide](docs/usage.md) | Complete usage reference with all methods and options |
| [Attachments](docs/ATTACHMENTS.md) | Adding screenshots, logs, and files to test results |
| [Steps](docs/STEPS.md) | Defining test steps for detailed reporting |
| [Multi-Project Support](docs/MULTI_PROJECT.md) | Reporting to multiple Qase projects |
| [Upgrade Guide](docs/UPGRADE.md) | Migration guide for breaking changes |
| [Configuration Reference](../qase-javascript-commons/README.md) | Full configuration options |

## Examples

See the [examples directory](../examples/single/testcafe/) for complete working examples.

## License

Apache License 2.0. See [LICENSE](LICENSE) for details.

---
_Source: https://npm.io/package/testcafe-reporter-qase · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
