@ns3/nx-playwright

5.2.0 • Public • Published

NX Playwright

A plugin to run playwright e2e tests in nx monorepo.

⚠️ Deprecation Notice ⚠️

Nx released their own Playwright Plugin: @nx/playwright. It is advised to use it instead of this package.

Install

npm i -D @ns3/nx-playwright

Generate

nx generate @ns3/nx-playwright:project my-desktop-e2e --project my-destkop

Providing project flag will generate a config that targets this frontend application.

Run project

npx nx run my-desktop-e2e:e2e

It works similarly to cypress runner in a sense that you can pass dev server options:

export interface StartDevServerOptions {
  devServerTarget?: string;
  skipServe?: boolean;
  baseUrl?: string;
  watch?: boolean; // Runs Playwright in UI mode
}

With --watch flag it runs Playwright in UI mode.

baseUrl is passed as BASE_URL env variable.

Apart from that, there is a command option which is generated with playwright test. It is done like that to allow you to replace it with different command or different runner altogether like playwright-watch, or playwright show-trace etc.

npx nx run my-desktop-e2e:e2e --command "playwright show-trace"

This executor passes every arg to playwright runner including nameless ones In case there is a name conflict between Playwright and Nx/Executor params simply suffix them with _:

npx nx run my-desktop-e2e:e2e app.spec.ts --debug # all args passed to Playwright
npx nx run my-desktop-e2e:e2e --help_ # help conflicts with Nx help so we pass it as help_

Readme

Keywords

none

Package Sidebar

Install

npm i @ns3/nx-playwright

Weekly Downloads

1,517

Version

5.2.0

License

MIT

Unpacked Size

21.9 kB

Total Files

26

Last publish

Collaborators

  • bielik20