Skip to content

Reusable Helper methods for Playwright Library in Typescript

License

Notifications You must be signed in to change notification settings

vasu31dev/playwright-ts-lib

Repository files navigation

Playwright TypeScript Utility Functions Library

GitHub stars Last Commit Pull Requests npm version Release Notes

About

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.

Table of Contents

Installation

To install the library, run the following command:

npm install vasu-playwright-utils  --save-dev

Usage

Here's a simple example of how you can use the library:

import { click, fill } from 'vasu-playwright-utils';

// Your code here

ESLint

This 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.

Using the config

  1. Use ESLint 9 flat config (eslint.config.mjs at your project root).

  2. In your eslint.config.mjs, spread the library config:

import playwrightLibConfig from 'vasu-playwright-utils/eslint';

export default [...playwrightLibConfig];
  1. Ensure your project has a tsconfig.json at the root (the config uses it for TypeScript parsing).

Overriding rules

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.

Issues and Feedback

If you encounter any issues or have feedback, please Raise an Issue on GitHub.

Contributions

We welcome contributions! Feel free to submit a Pull Request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Reusable Helper methods for Playwright Library in Typescript

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors