npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@playwright-extensions/core

v0.0.3

Published

A collection of useful Playwright extensions

Downloads

13

Readme

Playwright Extensions

A collection of useful Playwright extensions for testing and automation.

Installation

npm install @playwright-extensions/core

Usage

import { LocatorRace } from '@playwright-extensions/core';

Extensions

Element Events

Track created, changed, and deleted events for specific element locators efficiently using a native browser-side MutationObserver mapped securely via internal Playwright engine references.

This avoids performance heavy network round-trips for multiple status checks, and safely tracks old and new string changes directly in a buffered array.

Warning: You must enable this via your test configuration explicitly setting watchElements: true.

import { test, expect } from '@playwright-extensions/core';

// Enable the Watcher Plugin
test.use({ watchElements: true });

test('element change tracking', async ({ page }) => {
  const listLocator = page.locator('#item-list li');
  
  // 1. Hook the watcher in the background
  const watcher = await page.watchElement('my-list-items', listLocator);

  // 2. Take UI Actions securely without racing the framework
  await page.click('#modify-item-btn'); 

  // 3. Resolve exact element interactions using `.first()`, `.last()`, or `.nth()`
  // Note: Unindexed calls natively enforce strict mode!
  const changedData = await watcher.waitForEvent('changed').first();
  
  expect(changedData.type).toBe('changed');
  console.log(changedData.changes[0].oldValue); // "New Item"
  
  watcher.unwatch();
});

Query Response & API Locators

Extract variable data natively from the hidden backbone network requests triggered by page loads, without waiting on standard heavy UI integrations. Supports parsing architectures out of the box via json, xml, or regex mechanisms.

import { test, expect } from '@playwright-extensions/core';

test('verify data in network and ui', async ({ page }) => {
  // Query JSONPath from any intercepted background fetch
  const name = await page.queryResponse(
    /api\/user/, 
    '$.data.user.name', 
    'json'
  ).first();

  // Create standard Playwright locators that resolve dynamically 
  // via payload extractions matching a Regex pattern over an endpoint!
  const productLabel = page.locator(
    /\/api\/product/, 
    '<Name>(.*)</Name>', 
    'regex'
  );

  await expect(productLabel).toBeVisible();
});

LocatorRace.race() - Race Multiple Locators

Polls locator visibility in a loop until the first element becomes visible. Enforces strict mode: if multiple locators are visible in the same check, it throws.

Basic Usage

import { LocatorRace } from '@playwright-extensions/core';

const winner = await LocatorRace.race([
  page.locator('#a'),
  page.locator('#b'),
]);

await winner.click();

Strict Mode

Throws if multiple locators are visible simultaneously:

const winner = await LocatorRace.race([
  page.locator('#first'),
  page.locator('#second'),
]);
// Throws: "Strict mode violation: multiple locators found visible..."

Options

const winner = await LocatorRace.race(
  [page.locator('#a'), page.locator('#b')],
  {
    timeout: 5000,        // Max wait time (default: 0 = no timeout)
    pollInterval: 100,    // Check interval in ms (default: 100)
  }
);

page.raceLocator() - Race via Page Fixture

A page fixture extension that delegates to LocatorRace.race(). Use the fixture from @playwright-extensions/core to get page.raceLocator():

import { test, expect } from '@playwright-extensions/core';

test('race locators', async ({ page }) => {
  const winner = await page.raceLocator([
    page.locator('#a'),
    page.locator('#b'),
  ]);
  await winner.click();
});

Options work the same way:

const winner = await page.raceLocator(
  [page.locator('#a'), page.locator('#b')],
  { timeout: 5000, pollInterval: 100 }
);

Development

npm install
npm run build
npm test

License

MIT