Skip to content

danbao/testring

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1,461 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

testring

license npm CI Coverage Maintainability Rating

A modern, high-performance automated UI testing framework for Node.js 22+.

Project Overview

testring is a testing framework designed for automated testing of web applications. It provides:

  • ๐Ÿš€ High Performance โ€” Multi-process parallel test execution
  • ๐Ÿ”ง Extensible โ€” Rich plugin system architecture
  • ๐ŸŒ Multi-Browser โ€” Chrome, Firefox, Safari, and Edge via Playwright
  • ๐Ÿ› ๏ธ Developer Friendly โ€” ESM-first, TypeScript-native, complete development toolchain

Project Structure

testring/
โ”œโ”€โ”€ core/              # Core modules (~20 packages) โ€” Framework foundation
โ”‚   โ”œโ”€โ”€ api/           # Test API controllers
โ”‚   โ”œโ”€โ”€ cli/           # Command-line interface (citty)
โ”‚   โ”œโ”€โ”€ logger/        # Distributed logging system
โ”‚   โ”œโ”€โ”€ transport/     # Inter-process communication
โ”‚   โ”œโ”€โ”€ test-worker/   # Test worker processes
โ”‚   โ”œโ”€โ”€ reporter/      # Test result reporting
โ”‚   โ””โ”€โ”€ ...            # Other core modules
โ”œโ”€โ”€ packages/          # Extension packages โ€” Plugins and tools
โ”‚   โ”œโ”€โ”€ plugin-playwright-driver/  # Playwright browser driver
โ”‚   โ”œโ”€โ”€ plugin-babel/              # Babel transpilation plugin
โ”‚   โ”œโ”€โ”€ plugin-fs-store/           # File system store plugin
โ”‚   โ”œโ”€โ”€ web-application/           # Web application testing
โ”‚   โ”œโ”€โ”€ devtool-frontend/          # Developer tools frontend
โ”‚   โ””โ”€โ”€ ...                        # Other extension packages
โ”œโ”€โ”€ docs/              # Documentation
โ”œโ”€โ”€ utils/             # Build and maintenance utilities
โ””โ”€โ”€ README.md

Core Modules (core/)

Core modules provide the framework's foundational functionality:

  • API Layer โ€” Test execution and control interfaces
  • CLI โ€” Command-line interface built with citty (subcommands: run, init, plugin)
  • Process Management โ€” Multi-process test execution and communication
  • File System โ€” Test file discovery and reading
  • Logging System โ€” Distributed logging and management
  • Plugin System โ€” Extensible plugin architecture
  • Reporter โ€” Test result reporting and output formatting

Extension Packages (packages/)

Extension packages provide additional functionality:

  • Playwright Driver โ€” Browser automation via Playwright
  • Babel Plugin โ€” Test file transpilation
  • FS Store โ€” File system storage for test artifacts
  • Web Application โ€” Web application-specific testing features
  • Developer Tools โ€” Debugging and monitoring tools

Quick Start

Prerequisites

  • Node.js 22 or later
  • pnpm 10+

Installation

# Install the main framework
pnpm add testring

# Install Playwright driver
pnpm add @testring/plugin-playwright-driver

# Optional: Babel plugin for transpilation
pnpm add @testring/plugin-babel

# Optional: File system store
pnpm add @testring/plugin-fs-store

Basic Configuration

Create a .testringrc configuration file (JSON):

{
  "tests": "./tests/**/*.spec.js",
  "plugins": [
    "@testring/plugin-playwright-driver"
  ],
  "workerLimit": 2,
  "retryCount": 3
}

Or use .testringrc.js / .testringrc.cjs for JavaScript configuration:

// .testringrc.js
export default {
  tests: './tests/**/*.spec.js',
  plugins: ['@testring/plugin-playwright-driver'],
  workerLimit: 2,
  retryCount: 3,
};

Writing Tests

// tests/example.spec.js
describe('Example Test', () => {
  it('should be able to access the homepage', async () => {
    await browser.url('https://example.com');

    const title = await browser.getTitle();
    expect(title).toBe('Example Domain');
  });
});

Running Tests

# Run all tests
testring run

# Run specific tests
testring run --tests "./tests/login.spec.js"

# Set parallel execution
testring run --workerLimit 4

# Debug mode
testring run --logLevel debug

Key Features

Multi-Process Parallel Execution

  • Run multiple tests simultaneously across isolated worker processes
  • Intelligent load balancing
  • Process isolation prevents test interference

Multi-Browser Support via Playwright

  • Chrome, Firefox, Safari, Edge
  • Headless mode support
  • Mobile browser emulation

Plugin System

  • Official plugins for common use cases
  • Simple plugin development API (@testring/plugin-api)
  • Composable plugin architecture

Development Tools

  • Visual debugging interface
  • Real-time test monitoring
  • Detailed test reports

Development

Project Setup

# Clone the project
git clone https://github.com/danbao/testring.git
cd testring

# Install dependencies
pnpm install

# Build the project
pnpm run build:main

# Run unit tests
pnpm run test:unit

# Run all tests (unit + E2E headless)
pnpm test

Build Commands

# Full build (all packages, uses turbo)
pnpm run build

# Build main packages only (excludes e2e, devtool)
pnpm run build:main

Test Commands

# Unit tests (vitest)
pnpm run test:unit

# Unit tests in watch mode
pnpm run test:unit:watch

# Unit tests with coverage
pnpm run test:unit:coverage

# E2E tests with coverage
pnpm run test:e2e:coverage:lcov

Linting

# Lint all files (eslint)
pnpm run lint

# Auto-fix lint issues
pnpm run lint:fix

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the project
  2. Create a feature branch
  3. Submit your changes
  4. Create a Pull Request

License

MIT License โ€” See the LICENSE file for details.

Support

๐ŸŒ Cloudflare Worker for Test Fixtures

่ฟ™ไธช้กน็›ฎๅŒ…ๅซไธ€ไธช็‹ฌ็ซ‹็š„ Cloudflare Worker๏ผŒๆไพ›ๅœจ็บฟๆต‹่ฏ•็Žฏๅขƒ๏ผš

cloudflare-worker/
โ”œโ”€โ”€ build.js          # ๆž„ๅปบ่„šๆœฌ
โ”œโ”€โ”€ wrangler.toml      # Worker ้…็ฝฎ
โ”œโ”€โ”€ package.json       # ไพ่ต–็ฎก็†
โ”œโ”€โ”€ static-fixtures/   # ๆต‹่ฏ•้กต้ขๆบๆ–‡ไปถ (24ไธช)
โ”œโ”€โ”€ worker.js          # ็”Ÿๆˆ็š„ไปฃ็  (gitignored)
โ””โ”€โ”€ README.md          # ่ฏฆ็ป†ๆ–‡ๆกฃ

ๅฟซ้€Ÿๅผ€ๅง‹

cd cloudflare-worker
pnpm install
pnpm run build
pnpm run deploy

่ฏฆ็ป†ไฟกๆฏ่ฏทๆŸฅ็œ‹ cloudflare-worker/README.md

About

RingCentral TestRing

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • TypeScript 84.1%
  • JavaScript 13.6%
  • HTML 1.9%
  • Other 0.4%