0.1.1 • Published 8 months ago

wtr-playwright-commands v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Playwright Commands for Web Test Runner

This contains custom commands you can register with Web Test Runner (WTR) for interacting with Playwright's page object models. This assumes you are using @web/test-runner-playwright for launching your browser via Playwright and running your tests within the page it creates.

Installation

npm install --save-dev wtr-playwright-commands

Command Usages

Each command can be registered separately with WTR. Details on each supported command are given below.

waitForNetworkIdle

Use this to have a test wait for Playwright to receive its network idle load status before resuming.

Configuration

import { waitForNetworkIdlePlugin } from 'wtr-playwright-commands/plugin.js';

export default {
  plugins: [waitForNetworkIdlePlugin()],
  // ... rest of config ...
}

Usage

import { fixture, html } from '@open-wc/testing';
import { waitForNetworkIdle } from 'wtr-playwright-commands';

import '../src/my-element.js';

describe('MyElement', () => {
  it('can wait for network idle', async () => {
    const el = await fixture(html`<my-element></my-element>`);
    await waitForNetworkIdle();

    // ... do assertions that require network activity to complete ...
  });
});
0.1.1

8 months ago

0.1.0

8 months ago