playwright-line-length
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

playwright-line-length

Check line lengths with playwright.

Install

npm install playwright-line-length -D

Add to playwright config

Make two changes in playwright.config.js:

import { expect, defineConfig } from '@playwright/test';
// 1. Add this import
import { lineLengthAssertions } from 'playwright-line-length';

// 2. Add this line
expect.extend(lineLengthAssertions);

export default defineConfig({
  // your usual playwright config properties here
});

Usage

test('check line length', async ({ page }) => {
  await page.goto('https://website.com');

  const article = page.locator('#article-1');
  await expect(article).toHaveMedianLineLength({min: 55, max: 80});
});

API

expect(locator).toHaveMedianLineLength({min: number, max: number})

At least one of min and max are required.

License

MIT

Related

Package Sidebar

Install

npm i playwright-line-length

Weekly Downloads

0

Version

1.4.0

License

MIT

Unpacked Size

11.8 kB

Total Files

7

Last publish

Collaborators

  • psalaets