Frontend testing
Frontend plugins use Playwright for end-to-end testing through the shared @checkstack/test-utils-frontend package. This page covers configuration, writing tests, and running them against your local dev servers.
E2E Testing with Playwright
Section titled “E2E Testing with Playwright”For end-to-end testing of frontend plugins, use Playwright through the same @checkstack/test-utils-frontend package.
Quick Setup
Section titled “Quick Setup”1. Create playwright.config.ts
Section titled “1. Create playwright.config.ts”import { createPlaywrightConfig } from "@checkstack/test-utils-frontend/playwright";
export default createPlaywrightConfig({ baseURL: "http://localhost:5173",});2. Create E2E Tests
Section titled “2. Create E2E Tests”Create an e2e/ directory and add test files with .e2e.ts extension:
Important: Use
.e2e.tsextension (not.spec.tsor.test.ts) to ensure E2E tests are not picked up bybun testwhen running unit tests from the monorepo root. The.e2e.tspattern is specifically excluded from Bun’s default test discovery.
import { test, expect } from "@checkstack/test-utils-frontend/playwright";
test.describe("Login Page", () => { test("should display the login page", async ({ page }) => { await page.goto("/login"); await expect(page.locator("h1")).toBeVisible(); });});3. Add Test Script
Section titled “3. Add Test Script”{ "scripts": { "test:e2e": "bunx playwright test" }}Running E2E Tests
Section titled “Running E2E Tests”Prerequisites: Both frontend and backend dev servers must be running.
# Terminal 1: Start backendcd core/backend && bun run dev
# Terminal 2: Start frontendcd core/frontend && bun run dev
# Terminal 3: Run E2E testscd plugins/your-plugin && bun run test:e2eInstalling Playwright Browsers
Section titled “Installing Playwright Browsers”On first run, install the required browsers:
bunx playwright install chromiumConfiguration Options
Section titled “Configuration Options”createPlaywrightConfig({ baseURL: "http://localhost:5173", // Frontend URL testDir: "./e2e", // Test directory webServer: { // Optional: auto-start dev server command: "bun run dev", url: "http://localhost:5173", reuseExistingServer: true, },});Best Practices
Section titled “Best Practices”- Use flexible selectors - Prefer
data-testid, roles, or text content over CSS classes - Test user workflows - Focus on complete user journeys rather than individual elements
- Keep tests independent - Each test should be able to run in isolation
- Use page objects - For complex pages, extract common interactions into helpers