Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/semantic-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ name: Semantic Release
on:
push:
branches: [main]
# Skip running on release commits (already created)
paths-ignore:
- 'testplanit/CHANGELOG.md'
# Only run when the main application code changes — not for docs, packages, or CLI
paths:
- 'testplanit/**'
- '!testplanit/CHANGELOG.md'

permissions:
contents: write
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
.yarn/install-state.gz

# testing
/coverage
testplanit/coverage/
**/coverage/

# next.js
**/.next/
Expand Down
2 changes: 1 addition & 1 deletion docs/blog/2025-12-15-webdriverio-reporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ runName: `Build #${process.env.GITHUB_RUN_NUMBER} - {browser} - {date}`,

## Documentation

For complete configuration options, examples, and advanced features like custom case ID patterns, milestone/configuration associations, and retry handling, see the [WebdriverIO Reporter documentation](/docs/sdk/webdriverio-reporter).
For complete configuration options, examples, and advanced features like custom case ID patterns, milestone/configuration associations, and retry handling, see the [WebdriverIO Reporter documentation](/docs/sdk/wdio-overview).

## Get Started

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Yes, TestPlanIt supports importing test cases from CSV files. For specific tools
TestPlanIt doesn't run automated tests directly, but it integrates with your existing automation frameworks. You can push automated test results to TestPlanIt using:

- The [TestPlanIt SDK](/docs/sdk/) for programmatic access
- The [WebdriverIO reporter](/docs/sdk/webdriverio-reporter) for WebdriverIO integration
- The [WebdriverIO reporter](/docs/sdk/wdio-overview) for WebdriverIO integration
- The REST API for custom integrations

### Can I integrate with Jira/GitHub/Azure DevOps?
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/sdk/api-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,6 @@ reportTestResults();

## Related Resources

- [WebdriverIO Reporter](./webdriverio-reporter.md) - Automatic reporting for WebdriverIO tests
- [WebdriverIO Reporter](./wdio-overview.md) - Automatic reporting for WebdriverIO tests
- [API Tokens](../api-tokens.md) - Managing API tokens
- [API Reference](../api-reference.md) - Full REST API documentation
2 changes: 1 addition & 1 deletion docs/docs/sdk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TestPlanIt provides official npm packages to integrate with your test automation
| Package | Description | npm |
|---------|-------------|-----|
| [`@testplanit/api`](./api-client.md) | Official JavaScript/TypeScript API client | [![npm](https://img.shields.io/npm/v/@testplanit/api)](https://www.npmjs.com/package/@testplanit/api) |
| [`@testplanit/wdio-reporter`](./webdriverio-reporter.md) | WebdriverIO reporter | [![npm](https://img.shields.io/npm/v/@testplanit/wdio-reporter)](https://www.npmjs.com/package/@testplanit/wdio-reporter) |
| [`@testplanit/wdio-reporter`](./wdio-overview.md) | WebdriverIO reporter | [![npm](https://img.shields.io/npm/v/@testplanit/wdio-reporter)](https://www.npmjs.com/package/@testplanit/wdio-reporter) |

## Architecture

Expand Down
261 changes: 261 additions & 0 deletions docs/docs/sdk/wdio-ci-cd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
---
title: CI/CD & Advanced Usage
---

# CI/CD & Advanced Usage

## CI/CD Integration

### GitHub Actions

```yaml
name: E2E Tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Run E2E tests
env:
TESTPLANIT_API_TOKEN: ${{ secrets.TESTPLANIT_API_TOKEN }}
run: npx wdio run wdio.conf.js
```

### GitLab CI

```yaml
e2e-tests:
image: node:20
script:
- npm ci
- npx wdio run wdio.conf.js
variables:
TESTPLANIT_API_TOKEN: $TESTPLANIT_API_TOKEN
```

### Jenkins

```groovy
pipeline {
agent any
environment {
TESTPLANIT_API_TOKEN = credentials('testplanit-api-token')
}
stages {
stage('E2E Tests') {
steps {
sh 'npm ci'
sh 'npx wdio run wdio.conf.js'
}
}
}
}
```

### Dynamic Run Names with Build Info

Include CI build information in your test run names:

```javascript
// wdio.conf.js
const buildNumber = process.env.GITHUB_RUN_NUMBER
|| process.env.CI_PIPELINE_ID
|| process.env.BUILD_NUMBER
|| 'local';

const branch = process.env.GITHUB_REF_NAME
|| process.env.CI_COMMIT_REF_NAME
|| process.env.GIT_BRANCH
|| 'unknown';

export const config = {
reporters: [
['@testplanit/wdio-reporter', {
domain: 'https://testplanit.example.com',
apiToken: process.env.TESTPLANIT_API_TOKEN,
projectId: 1,
runName: `Build #${buildNumber} - ${branch} - {browser}`,
}]
],
};
```

## Handling Test Retries

The reporter tracks retry attempts and reports them to TestPlanIt:

```javascript
// wdio.conf.js
export const config = {
specFileRetries: 1, // Retry failed spec files
specFileRetriesDelay: 0,
reporters: [
['@testplanit/wdio-reporter', {
domain: 'https://testplanit.example.com',
apiToken: process.env.TESTPLANIT_API_TOKEN,
projectId: 1,
}]
],
};
```

Each retry attempt is recorded with its attempt number, so you can see the full history of a flaky test.

## Debugging

Enable verbose logging to troubleshoot issues:

```javascript
// wdio.conf.js
export const config = {
reporters: [
['@testplanit/wdio-reporter', {
domain: 'https://testplanit.example.com',
apiToken: process.env.TESTPLANIT_API_TOKEN,
projectId: 1,
verbose: true, // Enables detailed logging
}]
],
};
```

You'll see detailed output:

```
[TestPlanIt] Initializing reporter...
[TestPlanIt] Status mapping: passed -> 1
[TestPlanIt] Status mapping: failed -> 2
[TestPlanIt] Status mapping: skipped -> 3
[TestPlanIt] Creating test run: E2E Tests - 2024-01-15 14:30:00
[TestPlanIt] Created test run with ID: 123
[TestPlanIt] Test passed: should login successfully (Case IDs: 12345)
[TestPlanIt] Added case to run: 456
[TestPlanIt] Created test result: 789
```

## Complete Example

Here's a complete configuration with all features:

```javascript
// wdio.conf.js
import { TestPlanItService } from '@testplanit/wdio-reporter';

export const config = {
specs: ['./test/specs/**/*.js'],

capabilities: [{
browserName: 'chrome',
'goog:chromeOptions': {
args: ['--headless', '--disable-gpu']
}
}],

framework: 'mocha',

mochaOpts: {
ui: 'bdd',
timeout: 60000
},

services: [
[TestPlanItService, {
// Required
domain: process.env.TESTPLANIT_URL || 'https://testplanit.example.com',
apiToken: process.env.TESTPLANIT_API_TOKEN,
projectId: parseInt(process.env.TESTPLANIT_PROJECT_ID || '1'),

// Test run configuration
runName: `E2E Tests - Build #${process.env.BUILD_NUMBER || 'local'} - {date}`,
configId: 5, // Chrome configuration
milestoneId: 10, // Current sprint

// Screenshots
captureScreenshots: true,

// Debugging
verbose: process.env.DEBUG === 'true',
}]
],

reporters: [
'spec', // Keep the spec reporter for console output
['@testplanit/wdio-reporter', {
// Required
domain: process.env.TESTPLANIT_URL || 'https://testplanit.example.com',
apiToken: process.env.TESTPLANIT_API_TOKEN,
projectId: parseInt(process.env.TESTPLANIT_PROJECT_ID || '1'),

// Case ID parsing (default matches [1234] format)
caseIdPattern: /\[(\d+)\]/g,

// Auto-create cases (optional)
autoCreateTestCases: true,
parentFolderId: 100,
templateId: 1,

// Result options
uploadScreenshots: true,
includeStackTrace: true,

// Debugging
verbose: process.env.DEBUG === 'true',
}]
],
};
```

## TypeScript Support

The package includes full TypeScript definitions:

```typescript
import type {
TestPlanItReporterOptions,
TestPlanItServiceOptions,
} from '@testplanit/wdio-reporter';

const serviceOptions: TestPlanItServiceOptions = {
domain: 'https://testplanit.example.com',
apiToken: process.env.TESTPLANIT_API_TOKEN!,
projectId: 1,
runName: 'TypeScript Tests - {date}',
captureScreenshots: true,
};

const reporterOptions: TestPlanItReporterOptions = {
domain: 'https://testplanit.example.com',
apiToken: process.env.TESTPLANIT_API_TOKEN!,
projectId: 1,
autoCreateTestCases: true,
parentFolderId: 10,
templateId: 1,
};
```

## Compatibility

| WebdriverIO Version | Supported |
| -------------------- | ----------- |
| 9.x | Yes |
| 8.x | Yes |

Requires Node.js 18 or later.

## Related Resources

- [API Client](./api-client.md) - Direct API access for custom integrations
- [SDK Overview](./index.md) - Architecture and package overview
- [API Tokens](../api-tokens.md) - Creating and managing API tokens
Loading