Skip to content

Documentation

Everything you need to get started with TestRunner.

Installation

Get started with TestRunner in your project. We support npm, yarn, and pnpm.

Using npm

npm install -D @testrunner/core

Using yarn

yarn add -D @testrunner/core

Using pnpm

pnpm add -D @testrunner/core

Configuration

Create a testrunner.config.ts file in your project root:

import { defineConfig } from '@testrunner/core';

export default defineConfig({
  testDir: './tests',
  baseURL: 'http://localhost:3000',
  timeout: 30000,
  retries: 2,
  workers: 4,
  reporter: ['html', 'json'],
});

Write Your First Test

Create a test file at tests/example.spec.ts:

import { test, expect } from '@testrunner/core';

test('homepage has correct title', async ({ page }) => {
  await page.goto('/');
  await expect(page).toHaveTitle(/My App/);
});

test('user can log in', async ({ page }) => {
  await page.goto('/login');
  await page.fill('[name="email"]', 'user@example.com');
  await page.fill('[name="password"]', 'password123');
  await page.click('button[type="submit"]');
  await expect(page).toHaveURL('/dashboard');
});

Run the test

npx testrunner run

API Reference

Core methods available in TestRunner.

page.goto(url) async

Navigate to a URL. Waits for the page to load completely.

page.click(selector) async

Click an element. Waits for the element to be visible and enabled.

page.fill(selector, value) async

Fill an input field with text. Clears existing content first.

expect(locator).toBeVisible() async

Assert that an element is visible on the page.

Need help?

Join our Discord community or reach out to support.