1.0.6 • Published 5 months ago

playwright-cli-select v1.0.6

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

playwright-cli-select demo

Features

  • ❓ New interactive CLI prompts to select and run specs, tests or tags
  • 🎭 A new playwright test command to allow user to pass desired arguments

External Resources

Table of Contents


Installation

Install the following package:

npm install --save-dev playwright-cli-select
# within your Playwright repository as dev dependency

Or:

npm install -g playwright-cli-select
# global install

Run mode

Run the following command in your Playwright repository:

npx playwright-cli-select run

If you want to skip straight to selecting specs, titles and/or tags:

npx playwright-cli-select run --specs
# skips straight to spec selection
npx playwright-cli-select run --titles
# skips to test title selection
npx playwright-cli-select run --tags
# skips to tag selection
npx playwright-cli-select run --titles --tags
# skips to test title selection, followed by tag selection
# Any combination of `--specs`, `--titles` and/or `--tags` parameters is permitted.

playwright-cli-select --specs --titles --tags demo


Command line arguments

You can also include more cli arguments similar to npx playwright test:

npx playwright-cli-select run --project firefox webkit

Using last failed

Passing Playwright's --last-failed parameter filters the available selections in each prompt to the last failed tests.

Using this package, you can further drill down on specific tests within the last failed tests:

npx playwright-cli-select run --last-failed

playwright-cli-select --last-failed demo


Using only changed

Passing Playwright's --only-changed parameter filters available selections to the changed tests detected.

To specify a specific subset of changed tests rather than running entire changed test files:

npx playwright-cli-select run --only-changed

playwright-cli-select --only-changed demo


UI mode

You can append the --ui or --headed parameters to open a browser and view selected specs, test titles and/or tags:

npx playwright-cli-select run --ui

Or:

npx playwright-cli-select run --titles --headed
# Example of choosing only test titles to run headed

Keyboard controls

KeysAction
UpMove to selection above current
DownMove to selection below current
TabSelect current
Ctrl + aSelect all
BackspaceRemove selection
EnterProceed
Ctrl + cExit

Note: You can also filter choices displayed in list by typing


Help mode

To open the cli help menu, pass the --help flag:

npx playwright-cli-select run --help

playwright-cli-select help menu


Submit focused

When no other options are already selected, automatically select the currently focused option with Enter.

To enable this feature, pass the following flag:

npx playwright-cli-select run --submit-focused

Optional path to test list json

This package uses the npx playwright test --list --reporter=json command to gather information about Playwright tests.

If you prefer or already house the data from this command in a file, pass the path to the file via the --json-data-path parameter:

npx playwright-cli-select run --json-data-path data/sample-test-list.json

Using a custom playwright config file

If you want to use a custom Playwright config, pass it via the -c or --config flag:

npx playwright-cli-select run --config playwright.staging.config.js

Or:

npx playwright-cli-select run -c playwright.dev.config.js

Setting up a npm script

For convenience, you may desire to house the npx command within an npm script in your project's package.json, including any desired cli arguments:

  "scripts": {
    "pw:select": "npx playwright-cli-select run --project=firefox"
  }

Contributions

Feel free to open a pull request or drop any feature request or bug in the issues.

Please see more details in the contributing doc.

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago