Simple Playwright Framework

0.0.33 · active · verified Sun Apr 19

The `simple-playwright-framework` (current version 0.0.33) is a lightweight and modular TypeScript-based automation framework built on Microsoft Playwright. It aims to accelerate the setup of scalable UI and API test automation projects by providing a clean architecture, reusable fixtures, and streamlined onboarding processes. Key features include custom Playwright fixtures for authentication and state management, a `scenarioLoader` for environment-driven test data (supporting JSON, API, or DB integration), and a flexible provider registry for various authentication flows. It supports environment-aware configuration, offers reusable helpers for common test scenarios, and integrates with modern reporting tools like Playwright HTML, Allure, and TestRail. The framework also includes a CLI scaffolding tool (`npx init-demo-project`) to generate demo projects with recommended structures, promoting CI/CD readiness through parallel safety and isolated test states. Given its pre-1.0 version, the release cadence is likely agile, with frequent updates that may include API adjustments.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates the initial setup by installing dependencies, scaffolding a new project using the CLI, navigating into it, and then running the generated example Playwright tests using the framework's `scenarioLoader`.

npm install --save-dev @playwright/test playwright
npm install simple-playwright-framework

npx init-demo-project

# Navigate into the generated project
cd demo-project

# Example test from the generated project (e.g., tests/login.spec.ts)
// import { test, expect } from '@playwright/test';
// import { scenarioLoader } from 'simple-playwright-framework';

// test('login works', async ({ page }) => {
//   const data = scenarioLoader(__filename).get("validLogin");
//   await page.goto(data.baseUrl);
//   await page.fill('#username', data.username);
//   await page.fill('#password', data.password);
//   await page.click('#login');
//   await expect(page).toHaveURL(/dashboard/);
// });

# Run tests
npx playwright test

# Or run tests with Playwright UI runner
npx playwright test --ui

view raw JSON →