Playwright Test

Run unit tests with several runners or benchmark inside real browsers with playwright.
Alternatives To Playwright Test
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Frameworkbenchmarks6,978
3 days ago121otherJava
Source for the TechEmpower Framework Benchmarks project
Watermill5,6321048 hours ago40June 20, 202277mitGo
Building event-driven applications the easy way in Go.
Sysbench5,167
20 days ago1February 27, 2018160gpl-2.0C
Scriptable database and system performance benchmark
Eventemitter32,966437,2192,963a month ago33August 27, 20209mitJavaScript
EventEmitter3 - Because there's also a number 2. And we're faster.
Awesome Http Benchmark2,697
4 months ago10mit
HTTP(S) benchmark tools, testing/debugging, & restAPI (RESTful)
Yet Another Bench Script2,356
a month agowtfplShell
YABS - a simple bash script to estimate Linux server performance using fio, iperf3, & Geekbench
Phoronix Test Suite2,016
8 days ago1February 27, 2018113gpl-3.0PHP
The Phoronix Test Suite open-source, cross-platform automated testing/benchmarking software.
Go Web Framework Benchmark1,875
25 days ago1February 14, 202118apache-2.0Go
:zap: Go web framework benchmark
Stretch1,8375116 months ago17July 04, 201945mitRust
High performance flexbox implementation written in rust
Deepmoji1,331
a year ago9mitPython
State-of-the-art deep learning model for analyzing sentiment, emotion, sarcasm etc.
Alternatives To Playwright Test
Select To Compare


Alternative Project Comparisons
Readme

playwright-test NPM Version NPM Downloads NPM License tests

Run mocha, zora, uvu, tape and benchmark.js scripts inside real browsers with playwright.

Install

$ npm install playwright-test

Usage

$ playwright-test [files] [options]
# or
$ pw-test [files] [options]

Options

Description
    Run mocha, zora, uvu, tape and benchmark.js scripts inside real browsers with `playwright`.

  Usage
    $ playwright-test [files] [options]

  Options
    -r, --runner       Test runner. Options: mocha, tape, zora, uvu, none and benchmark.  (default mocha)
    -b, --browser      Browser to run tests. Options: chromium, firefox, webkit.  (default chromium)
    -m, --mode         Run mode. Options: main, worker.  (default main)
    -d, --debug        Debug mode, keeps browser window open.
    -w, --watch        Watch files for changes and re-run tests.
    -i, --incognito    Use incognito window to run tests.
    -e, --extension    Use extension background_page to run tests.
    --cov              Enable code coverage in istanbul format. Outputs '.nyc_output/coverage-pw.json'.
    --before           Path to a script to be loaded on a separate tab before the main script.
    --sw               Path to a script to be loaded in a service worker.
    --assets           Assets to be served by the http server.  (default process.cwd())
    --cwd              Current directory.  (default process.cwd())
    --extensions       File extensions allowed in the bundle.  (default js,cjs,mjs,ts,tsx)
    --config           Path to the config file
    -v, --version      Displays current version
    -h, --help         Displays this message


  Examples
    $ playwright-test test.js --runner tape
    $ playwright-test test --debug
    $ playwright-test "test/**/*.spec.js" --browser webkit --mode worker --incognito --debug

    $ playwright-test bench.js --runner benchmark
    # Uses benchmark.js to run your benchmark see playwright-test/mocks/benchmark.js for an example.

    $ playwright-test test --cov && npx nyc report --reporter=html
    # Enable code coverage in istanbul format which can be used by nyc.

    $ playwright-test "test/**/*.spec.js" --debug --before ./mocks/before.js
    # Run a script in a separate tab check ./mocks/before.js for an example.
    # Important: You need to call `self.PW_TEST.beforeEnd()` to start the main script.

  Runner Options
    All arguments passed to the cli not listed above will be fowarded to the runner.
    $ playwright-test test.js --runner mocha --bail --grep 'should fail'

    To send a `false` flag use --no-bail.
    Check https://mochajs.org/api/mocha for `mocha` options or `npx mocha --help`.

  Notes
    DEBUG env var filtering for 'debug' package logging will work as expected.
    $ DEBUG:app playwright-test test.js

    Do not let your shell expand globs, always wrap them.
    $ playwright-test "test/**" GOOD
    $ playwright-test test/** BAD

Flow control

All test runners support automatic flow control, which means you don't need to call special function or trigger any event in your tests to stop the run. The none runner does not support flow control.

To manually stop the run you can use process.exit:

process.exit(0) // stops the run and exits with success
process.exit(1) // stops the run and exits with failure

Config

The config file needs to be commonjs for now, so if your package is pure ESM you need to use .cjs extension.

Configuration can be done with cli flags or config files.

'package.json', // using property `pw-test` or `playwright-test`
`.playwright-testrc.json`,
`.playwright-testrc.js`,
`playwright-test.config.js`,
`.playwright-testrc.cjs`,
`playwright-test.config.cjs`,
`.pw-testrc.json`,
`.pw-testrc.js`,
`pw-test.config.js`,
`.pw-testrc.cjs`,
`pw-test.config.cjs`,

The config type can be imported from the entrypoint.

import type { RunnerOptions } from 'playwright-test'

Interface

export interface RunnerOptions {
  cwd: string
  assets: string
  browser: 'chromium' | 'firefox' | 'webkit'
  debug: boolean
  mode: 'main' | 'worker'
  incognito: boolean
  input?: string[]
  extension: boolean
  runnerOptions: any
  before?: string
  sw?: string
  cov: false
  extensions: string
  buildConfig: BuildOptions
  buildSWConfig: BuildOptions
  beforeTests: (opts: RunnerOptions) => Promise<unknown>
  afterTests: (
    opts: RunnerOptions,
    beforeTestsOutput: unknown
  ) => Promise<unknown>
}

Run in CI

Check our CI config .github/workflows/main.yml and the playwright Github Action

License

MIT Hugo Dias

Popular Benchmark Projects
Popular Testing Projects
Popular Software Performance Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Typescript
Testing
Ci
Benchmark
Code Coverage
Mocha
Testing Tools
Istanbul
Tape