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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mands/nx-playwright

v0.6.3

Published

[![MIT License](https://img.shields.io/github/license/marksandspencer/nx-plugins)](https://github.com/marksandspencer/nx-plugins/blob/main/LICENSE.md) ![Build](https://github.com/marksandspencer/nx-plugins/actions/workflows/release.yml/badge.svg) [![npm v

Downloads

39,340

Readme

@mands/nx-playwright

MIT License Build npm version PRs Welcome

An Nx plugin that adds Playwright end-to-end testing using a native runner to your NX workspace.

Setup

Note Don't forget to replace the placeholder <APP-NAME>

Installation

pnpm add --dev @mands/nx-playwright
pnpm playwright install --with-deps

Generate e2e test app

Warning If you have an existing e2e test app, please remove it first pnpm nx generate remove <APP-NAME>-e2e

pnpm nx generate @mands/nx-playwright:project <APP-NAME>-e2e --project <APP-NAME>

Optionally the --includeAxe flag can be included to generate axe-playwright accessibility tests.

Running tests

pnpm nx e2e <APP-NAME>-e2e

Running accessibility tests

pnpm nx e2e <APP-NAME>-e2e --configuration=axe

Execution Flags

nx-playwright has some flags that you can utilize at execution time

  • --browser=BROWSER_TYPE: allowed browser types being chromium, firefox or webkit (or an all type to execute against all 3 types)
  • --testProject: playwright project name to run (NOTE: this is --project option in playwright itself, but it conflicts with nx's option)
  • --config: configuration file. Defaults to playwright.config.ts
  • --format=FORMAT_TYPE: this allows values such as json or html
  • --headed: launches the browser in non-headless mode
  • --debug: runs tests in a browser plus another interactive debugger window that you can pause/play tests
  • --packageRunner: package runner to use for running playwright (npx, pnpm, or yarn), use only when running NX directly, not required when running via package manager (e.g. pnpm nx run your-app-e2e:e2e)
  • --path: path to run tests at. Defaults to src
  • --skipServe: skips the execution of a devServer
  • --timeout=<number>: adds a timeout for your tests in milliseconds
  • --grep=<RegExp|Array<RegExp>>: filter to only run tests with a title matching one of the patterns
  • --grepInvert=<RegExp|Array<RegExp>>: filter to only run tests with a title not matching one of the patterns
  • --ui: launches the browser in ui mode to explore, run and debug tests (preview)

Note These flags can also be used in project.json or nx.json

These flags align with the standard playwright flags, as well as the nx-cypress ones.

Testing this plugin locally

Create a new Nx workspace containing one application. Then run, in the root of this repo:

./local-test.sh -w path/to/workspace -a app-name

⚠️ The flag -C can optionally be used to reverse any changes made to the workspace during the test run. However, this is a potentially destructive operation that performs a stash save before the run and a stash pop at the end of the run.

Example script for testing locally from scratch

git clone [email protected]:marksandspencer/nx-plugins.git

# Create a test workspace and app, and remove the e2e app

pnpm create nx-workspace --name=test-nx --appName=test-app --style=@emotion/styled --preset=next --nxCloud=false --interactive=false
pushd test-nx
pnpm nx generate remove test-app-e2e
git commit -am "Remove test-app-e2e"
popd

# Run the test script
pushd nx-plugins
./local-test.sh -w ../test-nx -a test-app -C
popd