playwright-fluent-chain
v1.1.0
Published
A strictly chainable, proxy-driven fluent API wrapper around Playwright
Maintainers
Readme
Playwright Fluent Chain 🚀
A strictly chainable, proxy-driven fluent API wrapper around Playwright. Write beautiful, unbroken end-to-end user flows without intermediate await statements on every single line.
🌟 Features
- Strictly Chainable: Chain actions (
goto,click,type) and assertions sequentially. - Single
awaitArchitecture: Put a singleawaitat the beginning of your expression to execute the entire chain sequentially. - Dynamic Proxy Driven: Leverages JavaScript Proxies to forward all current and future Playwright
Pagemethods automatically out-of-the-box. - Zero Configuration: Drop-in replacement with a native Playwright test fixture wrapper (
fpage). - Full TypeScript Support: Complete auto-complete engine compliance out-of-the-box.
📦 Installation
Install the package via NPM along with its peer dependency, @playwright/test:
npm install playwright-fluent-chain @playwright/test --save-dev
Example
import { test, expect } from 'playwright-fluent-chain';
test('End-to-end user login and dashboard verification', async ({ fpage }) => {
// A single await executes the entire sequence sequentially!
await fpage
.goto('[https://example.com/login](https://example.com/login)')
.type('#username', 'automation_engineer')
.type('#password', 'SuperSecretPassword123')
.click('#login-submit')
.assertText('#welcome-banner', 'Welcome back, Engineer!')
.click('#logout-btn');
});