Skip to main content

BDD Exports

OpenQA provides integrations for Playwright-BDD and Cucumber.js.

Playwright-BDD

Quick Import

import 'openqa/bdd/playwright-bdd';
This single import:
  • Registers a catch-all step that handles any Gherkin step
  • Routes all steps to the AI agent

Named Exports

import { 
  test,           // Extended Playwright test
  Given,          // BDD step helper
  When,           // BDD step helper
  Then,           // BDD step helper
  Step,           // Generic step helper
  createAIStep,   // Custom AI step factory
  AIStep          // Pre-configured catch-all step
} from 'openqa/bdd/playwright-bdd';

createAIStep()

Create a custom AI step with specific options:
import { createAIStep } from 'openqa/bdd/playwright-bdd';

createAIStep({
  verbose: false,
  agentType: 'langchain',
  provider: 'openai',
  model: 'gpt-4o',
  pattern: /^I (.*)$/  // Custom pattern
});
OptionTypeDefaultDescription
verbosebooleantrueEnable logging
agentTypestring'claude'Agent type
providerstring-LLM provider
modelstring-Model name
patternRegExp/^(.*)$/Step pattern

AIStep

Pre-configured step that matches any text:
import { AIStep } from 'openqa/bdd/playwright-bdd';
// AIStep is automatically registered

Cucumber.js

Quick Import

import 'openqa/bdd/cucumber';
This sets up:
  • Browser lifecycle (launch/close)
  • Catch-all step definitions
  • AI agent integration
Browser management is automatic—each scenario gets a fresh context.