Registry / testing / simple-playwright-framework

simple-playwright-framework

JSON →
library0.0.33jsnpmunverified

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.

npm install simple-playwright-framework
INSTALL
IMPORT
SIG · SIMPLE-PLAYWRIGHT-
S
simple-playwright-framework
testingjavascriptv0.0.33
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

scenarioLoader
✓ import { scenarioLoader } from 'simple-playwright-framework';
✗ const scenarioLoader = require('simple-playwright-framework').scenarioLoader;
The framework is ESM-first and ships TypeScript types. Prefer named ESM imports. CommonJS `require` will not work directly without transpilation.
initDemoProject
✓ npx init-demo-project
This is a CLI command to scaffold a new project, invoked via `npx`, not a direct importable symbol in JavaScript/TypeScript.
test, expect (Playwright base)
✓ import { test, expect } from '@playwright/test';
While `simple-playwright-framework` provides custom fixtures, the base `test` and `expect` utilities are typically imported directly from `@playwright/test` unless the framework explicitly exports its own augmented `test` object (which is not shown here).

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
Debug
Known issues
breakingEarlier versions experienced 'Compiled JS confusion' which led to module resolution changes, moving output to 'dist' and enforcing root-level exports. This likely necessitated updating import paths or build configurations for users upgrading from older pre-1.0 versions.
fix
Ensure your `tsconfig.json` and build tools correctly resolve modules from `simple-playwright-framework`. Check the latest documentation or scaffold a new project (`npx init-demo-project`) to see the correct import paths and configurations.
affects: <0.0.33
gotchaThe framework emphasizes correct usage of its custom fixtures and helpers. Users might inadvertently bypass these by importing Playwright's base `test` object or not properly configuring `playwright.config.ts` to utilize framework-provided extensions.
fix
Always refer to the framework's documentation and the generated `playwright.config.ts` from the `init-demo-project` CLI for how to properly extend Playwright's base `test` object and import framework utilities.
affects: >=0.0.1
gotchaAs a pre-1.0 (0.0.x) package, `simple-playwright-framework` does not strictly adhere to Semantic Versioning. Minor or even patch releases may introduce breaking changes to the API without a major version increment.
fix
Exercise caution when upgrading. Review release notes carefully for any breaking changes and pin exact versions in `package.json` for critical projects. Perform thorough regression testing after any update.
affects: >=0.0.1
gotchaThe framework is designed for parallel safety by advocating 'test-scoped' state and avoiding 'global mutation'. Improper handling of shared state across tests or Playwright workers can lead to flaky or inconsistent test results.
fix
Ensure all necessary test state is initialized within individual tests or `beforeEach` hooks provided by Playwright, avoiding mutable global variables or shared resources that are not properly isolated for parallel execution.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'simple-playwright-framework' or its corresponding type declarations.
The package is either not installed, or your module resolver (TypeScript compiler, bundler, or Node.js runtime) cannot locate the package correctly. This was a known issue in earlier versions related to module bundling.
fix
Run `npm install simple-playwright-framework`. Verify your `tsconfig.json`'s `moduleResolution` and `baseUrl`/`paths` settings are compatible with an ESM-first package. If using CommonJS, ensure you are using dynamic `import()` or configuring your build tools for ESM compatibility.
TypeError: scenarioLoader is not a function
This error typically indicates that `scenarioLoader` was not correctly imported or is not available from the imported module. This can occur with incorrect `require` syntax in CommonJS contexts or if module bundling/tree-shaking inadvertently removes the export.
fix
Ensure you are using the correct ESM import syntax: `import { scenarioLoader } from 'simple-playwright-framework';`. Avoid CommonJS `require` statements directly. Verify the package is installed and at a version that exports `scenarioLoader`.
Playwright test run failed: No tests found
This occurs when `playwright` cannot locate any test files. This might be due to running the `npx playwright test` command from an incorrect directory (not the project root) or if the `playwright.config.ts` file has an incorrect `testMatch` pattern.
fix
After scaffolding, navigate into the generated `demo-project` directory (e.g., `cd demo-project`). Confirm that your `playwright.config.ts` has a `testMatch` property that correctly identifies your test files (e.g., `testMatch: '**/*.spec.ts'`).
Upgrade
Version history
0.0.33latest on npm
Audit
Dependencies
@playwright/testrequiredCore Playwright testing library, required for test execution and assertions.
playwrightrequiredPlaywright browser automation library, providing browser contexts and page interactions.
Agent activity
8 hits · last 30 days
node
6
Resources
simple-playwright-framework — npm install simple-playwright-framework · libregistry