npm.io
0.1.18 • Published 4d ago

@testmuai/playwright-bindings

Licence
MIT
Version
0.1.18
Deps
5
Size
485 kB
Vulns
0
Weekly
2.8K

@testmuai/playwright-bindings

Thin runtime for testmu-style Playwright tests in TypeScript/JavaScript. Companion to testmuai-playwright-bindings (Python).

Install

npm install @testmuai/playwright-bindings playwright

Usage

import testmu, { resolveVar, setVar } from "@testmuai/playwright-bindings";
import { expect } from "@playwright/test";

testmu.configure({
  build: "build-123",
  name: "Login Test",
  variables: { email: "user@test.com" },
  testParams: { BASE_URL: "https://example.com" },
});

testmu.test("Login flow", async (page) => {
  testmu.step("Navigate");
  await page.goto(await resolveVar("${BASE_URL}"));
  testmu.done();

  testmu.step("Fill credentials");
  await page.locator("#email").fill(await resolveVar("{{email}}"));
  testmu.done();
});

testmu.run();

Env vars

Var Purpose
TESTMU_RUN_TARGET local (default) or cloud
LT_USERNAME, LT_ACCESS_KEY LambdaTest credentials (enables ATMS + vision)
TESTMU_SMART 1 enables vision/heal (validated at run() — requires LT creds)

Build

npm run build       # tsc → dist/
npm test            # vitest run
npm run typecheck   # tsc --noEmit

Keywords