npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@automite/bdd-playwright-framework

v1.0.5

Published

BDD test automation framework using CucumberJS, Playwright, and TypeScript

Downloads

692

Readme

@automite/bdd-playwright-framework

A BDD (Behavior-Driven Development) test automation framework built with CucumberJS, Playwright, and TypeScript. This framework provides a solid foundation for writing maintainable, scalable automated tests using Gherkin syntax.

Features

  • BDD Testing: Write tests in Gherkin syntax using CucumberJS
  • Modern Browser Automation: Powered by Playwright for reliable cross-browser testing
  • TypeScript Support: Full TypeScript support for type-safe test code
  • Page Object Model: Built-in BasePage class for implementing POM pattern
  • Custom World: Extensible BaseWorld class for scenario context management
  • Lifecycle Hooks: Pre-configured Cucumber hooks for test setup and teardown
  • Logging Utility: Simple logging utility for test debugging
  • Configurable: Environment-based configuration for flexible test execution

Installation

yarn add @automite/bdd-playwright-framework

Project Structure

framework/
├── src/
│   ├── core/
│   │   ├── BaseWorld.ts       # Custom World class for Cucumber
│   │   ├── TestRunner.ts      # Test execution manager
│   │   └── hooks.ts           # Cucumber lifecycle hooks
│   ├── pages/
│   │   └── BasePage.ts        # Base Page class for POM
│   ├── utils/
│   │   └── logger.ts          # Logging utility
│   └── index.ts               # Main entry point
├── dist/                      # Compiled JavaScript output
├── package.json
├── tsconfig.json
└── README.md

Core Components

BaseWorld

The BaseWorld class extends Cucumber's World class and provides scenario context management. It includes:

  • Page object management
  • Scenario initialization
  • Resource cleanup
import { BaseWorld } from '@automite/bdd-playwright-framework';

class CustomWorld extends BaseWorld {
  // Add custom scenario context
}

BasePage

The BasePage class provides common page interaction methods:

  • Navigation (navigateToUrl, navigate)
  • Element interaction (clickElement, fillText, clearElement)
  • Element verification (waitForElement, isElementVisible, getElementText)
  • Selector-based shortcuts (click, fill, getText)
import { BasePage } from '@automite/bdd-playwright-framework';

class LoginPage extends BasePage {
  async login(username: string, password: string) {
    await this.fill('#username', username);
    await this.fill('#password', password);
    await this.click('#login-button');
  }
}

setupHooks

Configures Cucumber lifecycle hooks with browser management:

  • BeforeAll: Launches browser and creates context
  • AfterAll: Closes browser and context
  • Before: Creates new page for each scenario
  • After: Closes page after scenario
import { setupHooks, BaseWorld } from '@automite/bdd-playwright-framework';

setupHooks(BaseWorld);

Logger

Simple logging utility with multiple log levels:

import { logger } from '@automite/bdd-playwright-framework';

logger.info('Information message');
logger.error('Error message');
logger.warn('Warning message');
logger.debug('Debug message'); // Only when DEBUG=true

Usage

Basic Setup

  1. Create a custom World class:
// tests/support/CustomWorld.ts
import { BaseWorld } from '@automite/bdd-playwright-framework';

export class CustomWorld extends BaseWorld {
  // Add custom properties and methods
}
  1. Setup hooks in your support file:
// tests/support/hooks.ts
import { setupHooks } from '@automite/bdd-playwright-framework';
import { CustomWorld } from './CustomWorld';

setupHooks(CustomWorld);
  1. Create page objects:
// tests/pages/LoginPage.ts
import { BasePage } from '@automite/bdd-playwright-framework';

export class LoginPage extends BasePage {
  async login(username: string, password: string) {
    await this.fill('#user-name', username);
    await this.fill('#password', password);
    await this.click('#login-button');
  }
}
  1. Write step definitions:
// tests/steps/login.steps.ts
import { Given, When, Then } from '@cucumber/cucumber';
import { CustomWorld } from '../support/CustomWorld';
import { LoginPage } from '../pages/LoginPage';

Given('I am on the login page', async function (this: CustomWorld) {
  const loginPage = new LoginPage(this.page);
  await loginPage.navigateToUrl('https://example.com/login');
});

When('I enter credentials', async function (this: CustomWorld) {
  const loginPage = new LoginPage(this.page);
  await loginPage.login('[email protected]', 'password');
});

Environment Variables

Configure the framework using environment variables:

# Browser configuration
BROWSER=chromium              # Browser type (chromium, firefox, webkit)
HEADLESS=true                 # Run in headless mode
SLOW_MO=0                     # Slow down actions (ms)
VIEWPORT_WIDTH=1280           # Viewport width
VIEWPORT_HEIGHT=720           # Viewport height
VIEWPORT_PRESET=desktop       # Viewport preset

# Timeouts
NAVIGATION_TIMEOUT=30000     # Navigation timeout (ms)
ACTION_TIMEOUT=10000         # Action timeout (ms)

# Debugging
DEBUG=true                    # Enable debug logs
ENABLE_TRACING=false          # Enable Playwright tracing

Scripts

# Build the framework
yarn build

# Build in watch mode
yarn dev

# Clean build artifacts
yarn clean

Dependencies

  • @cucumber/cucumber: ^9.5.1
  • @playwright/test: ^1.40.1

Development

The framework is written in TypeScript and requires compilation before use:

yarn build

This compiles the TypeScript source files to the dist directory.

License

MIT

Author

[email protected]

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.