Skip to content

Playwright export

Compile a plain-English Tripwire suite into a standalone Playwright .spec.ts you can drop into any repo with @playwright/test — no Tripwire runtime, no LLM at runtime.

This neutralizes the most common objection to AI-driven testing — "non-deterministic, not reproducible, locked-in." The answer: use AI at authoring and healing time, and deterministic Playwright at run time when you want it.

Export via the API

bash
curl http://127.0.0.1:8400/api/v1/suites/signup-login.tripwire.yaml/export

The endpoint returns the spec as text/plain. Save it into your Playwright project:

bash
curl http://127.0.0.1:8400/api/v1/suites/signup-login.tripwire.yaml/export \
  -o tests/signup-login.spec.ts

What you get

Each case becomes a test(...); the suite becomes a test.describe(...). Steps become a comment plus a best-effort action; expectations become real Playwright assertions:

ts
// Generated from a Tripwire suite. Portable Playwright spec — no Tripwire
// runtime required. Locators and assertions are best-effort; review before use.
import { test, expect } from '@playwright/test';

test.describe('Signup & Login', () => {
  test('A new user can sign up', async ({ page }) => {
    await page.goto('http://localhost:8500');
    // step: Open the sign-up page
    // step: Enter email and password
    // await page.getByLabel('field').fill('value');
    // step: Click 'Create account'
    await page.getByRole('button', { name: 'Create account' })
      .or(page.getByText('Create account')).first().click();

    // assert: a confirmation 'Account created' is shown
    await expect(page.locator('body')).toContainText('Account created');
  });
});

How checks compile

Deterministic checks map straight to Playwright assertions:

CheckCompiles to
url (path_is / contains)await expect(page).toHaveURL(...)
visible_text (contains)await expect(locator).toContainText(...)
visible_text (equals + selector_hint)await expect(locator).toHaveText(...)
element_visible (selector_hint)await expect(locator).toBeVisible()
absent_text (any_of)await expect(body).not.toContainText(...) per string

Assertions with no deterministic check export as a clearly-marked // TODO assert: comment carrying the plain-English text, so a human can finish them. Likewise, steps export their action when the target is obvious (a quoted phrase or a Capitalized run) and a // (no obvious target — fill in the locator) hint otherwise.

When to use it

  • You want determinism in CI. Author and heal in Tripwire; run the exported spec in your existing Playwright pipeline.
  • You're migrating in. Keep your Playwright project; let Tripwire generate first drafts.
  • You want zero lock-in. The export is plain @playwright/test — yours to keep, edit, and run with no Tripwire dependency.

Best-effort, review before relying on it

The compiler derives locators and actions from prose, so the output is a strong starting point, not a guaranteed-green spec. Review the generated locators and finish any // TODO assertions before wiring it into a gate.

Related: URL → test generation · Checks reference · CI

Tripwire — AI-native, self-healing E2E testing. Terms · Privacy · Legal Notice