playwright-ts-lib is a TypeScript library that provides reusable helper methods for the Playwright Library. It aims to simplify common tasks and enhance the efficiency of automated testing workflows.
To install the library, run the following command:
npm install vasu-playwright-utils --save-devHere's a simple example of how you can use the library:
import { click, fill } from 'vasu-playwright-utils';
// Your code hereThis library ships a shareable ESLint config for Playwright TypeScript projects. Install the library (it includes the required ESLint plugins), then extend the config in your project and override any rules as needed.
-
Use ESLint 9 flat config (
eslint.config.mjsat your project root). -
In your
eslint.config.mjs, spread the library config:
import playwrightLibConfig from 'vasu-playwright-utils/eslint';
export default [...playwrightLibConfig];- Ensure your project has a
tsconfig.jsonat the root (the config uses it for TypeScript parsing).
Add config objects after the spread to override or relax rules:
import playwrightLibConfig from 'vasu-playwright-utils/eslint';
export default [
...playwrightLibConfig,
// Override specific rules
{
rules: {
'playwright/no-focused-test': 'warn',
'playwright/no-wait-for-timeout': 'off',
'no-console': 'off',
},
},
// Or override only for certain files
{
files: ['tests/**/*.ts'],
rules: {
'playwright/expect-expect': 'error',
},
},
];Later entries in the config array override earlier ones, so your overrides take precedence.
If you encounter any issues or have feedback, please Raise an Issue on GitHub.
We welcome contributions! Feel free to submit a Pull Request on GitHub.
This project is licensed under the MIT License. See the LICENSE file for details.