Skip to content
Open
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
80 changes: 79 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://stand-with-ukraine.pp.ua)

[<img src="https://img.shields.io/badge/slack-@codeceptjs-purple.svg?logo=slack">](https://join.slack.com/t/codeceptjs/shared_invite/enQtMzA5OTM4NDM2MzA4LWE4MThhN2NmYTgxNTU5MTc4YzAyYWMwY2JkMmZlYWI5MWQ2MDM5MmRmYzZmYmNiNmY5NTAzM2EwMGIwOTNhOGQ) [<img src="https://img.shields.io/badge/discourse-codeceptjs-purple">](https://codecept.discourse.group) [![NPM version][npm-image]][npm-url] [<img src="https://img.shields.io/badge/dockerhub-images-blue.svg?logo=codeceptjs">](https://hub.docker.com/r/codeceptjs/codeceptjs)
[![AI features](https://img.shields.io/badge/AI-features?logo=openai&logoColor=white)](https://github.com/codeceptjs/CodeceptJS/edit/3.x/docs/ai.md) [![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)
[![AI features](https://img.shields.io/badge/AI-features?logo=openai&logoColor=white)](https://github.com/codeceptjs/CodeceptJS/edit/3.x/docs/ai.md) [![MCP Server](https://img.shields.io/badge/MCP-server?logo=anthropic&logoColor=white)](https://github.com/codeceptjs/CodeceptJS/blob/main/docs/mcp.md) [![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)

## Build Status

Expand Down Expand Up @@ -276,6 +276,84 @@ Full support for Gherkin scenarios with proper feature formatting:

The HTML reporter generates self-contained reports that can be easily shared with your team. Learn more about configuration and features in the [HTML Reporter documentation](https://codecept.io/plugins/#htmlreporter).

## MCP Server

CodeceptJS includes a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that enables AI agents (like Claude, ChatGPT) to interact with and control your tests programmatically. This allows AI to:

- **List all tests** in your project
- **List all available actions** (I.* methods) from enabled helpers
- **Run arbitrary CodeceptJS code** and capture artifacts (ARIA snapshots, screenshots, HTML, logs)
- **Run specific tests** with AI-friendly trace files generated by the aiTrace plugin
- **Run tests step by step** for detailed debugging and analysis
- **Control browser sessions** (start/stop)

### Features

- **AI-Friendly Trace Files**: When enabled, the aiTrace plugin generates comprehensive trace files with screenshots, HTML, ARIA snapshots, browser logs, and HTTP requests
- **Real-time Monitoring**: Get trace file URLs at the start of test execution so AI can monitor tests in real-time
- **Artifact Capture**: Automatically capture ARIA snapshots, page source, console logs, and more
- **Browser Management**: Automatic or manual browser lifecycle control
- **Timeout Control**: Configurable timeouts for all operations

### Quick Start

1. Install the MCP SDK:
```sh
npm install @modelcontextprotocol/sdk
```

2. Configure your MCP client (e.g., Claude Desktop):
```json
{
"mcpServers": {
"codeceptjs": {
"command": "node",
"args": ["path/to/codeceptjs/bin/mcp-server.js"]
}
}
}
```

3. Enable the aiTrace plugin in `codecept.conf.js`:
```javascript
plugins: {
aiTrace: {
enabled: true
}
}
```

### Usage Examples

**List all tests:**
```json
{
"name": "list_tests"
}
```

**Run CodeceptJS code:**
```json
{
"name": "run_code",
"arguments": {
"code": "await I.amOnPage('/'); await I.see('Welcome')"
}
}
```

**Run a test with trace:**
```json
{
"name": "run_test",
"arguments": {
"test": "tests/login_test.js"
}
}
```

Learn more about the MCP Server in the [MCP documentation](https://github.com/codeceptjs/CodeceptJS/blob/main/docs/mcp.md).

## PageObjects

CodeceptJS provides the most simple way to create and use page objects in your test.
Expand Down
Loading