Expressive, fluent end-to-end browser testing. User interaction, page assertions, and JavaScript testing, powered by Puppeteer but with a developer-friendly API.
Chainable methods like visit().type().press().
See what your user sees with headless or headed modes.
Use the browse helper to spin up a browser instance. It automatically handles launching and closing the browser.
1// tests/browser/login.test.ts2import { browse } from "canxjs/testing";3import { describe, test } from "bun:test";45describe("Login Flow", () => {6test("user can login", async () => {7await browse(async (browser) => {8await browser.visit("/login")9.type("email", "test@example.com")10.type("password", "password")11.press("Login")12.waitForText("Dashboard")13.assertPathIs("/dashboard")14.assertSee("Welcome, Test User");15});16});17});
1await browse(async (browser) => {2// Navigation3await browser.visit("/");4await browser.back();5await browser.refresh();67// Interaction8await browser.type("input[name=search]", "Laptop");9await browser.click("#search-btn");10await browser.press("Enter");11await browser.check("terms");1213// Assertions14await browser.assertSee("Results");15await browser.assertDontSee("Error");16await browser.assertPathIs("/search");17await browser.assertTitle("Search Results - My App");1819// Waiting20await browser.waitFor(".modal");21await browser.waitForText("Success");22});