Sponsored Link
Looking for a unified way to  viewmonitor, and  debug Playwright Test Automation runs?
Try the Playwright Dashboard by today. Use the coupon code PWSOL10 for a 12 month 10% discount.

TOOL: Playwright-Cli-Select For Quick Targeted Test Runs via CLI

Have you ever struggled to run specific tests from the command line? I've had the want to run 2-3 tests from the command line together and struggled to autocomplete my way through building the proper command manually.

Good News Everybody

With this new tool I don't have to craft the perfect command line anymore I now have access to a nice command line selector to pick and choose exactly what I want to run!

GitHub - dennisbergevin/playwright-cli-select: Playwright interactive cli prompts to select and run specs, tests or tags
Playwright interactive cli prompts to select and run specs, tests or tags - dennisbergevin/playwright-cli-select

Set it all up

To get the cli tool installed it's quite simple! This command installs the dependency and updates your package.json file.

npm install --save-dev playwright-cli-select

Then you can run the cli tool with

npx playwright-cli-select run

My Experience

What I really like about this tool is the flexibility offered! The readme provides a ton of easy to follow examples on how you can customize your run command. All of this can easily be added to your package.json script in order to have a simple npm run cli command, below I've created so the command automatically selects the first specs option for me.

// package.json

{
  "scripts": {
    "cli": "npx playwright-cli-select run --specs",
    "test": "npx playwright test"
  }
}

Once you've rung the command and you are in the cli interface, you will need to use Tab as the "select" key. This was a small learning curve as by default I was just trying to press Enter and that actually allows you to "Proceed" Thankfully I read the interface and there were clear instructions on what the buttons do!

If you ever do get stuck or want to explore the tool without reading the docs on GitHub you also have access to npx playwright-cli-select run --help a help flag which providers all the different options at your fingertips!

Overall I am a fan, and with very little effort on my end I'll have an easy way to run multiple spec files together via this tool. I plan to add this to all of my past, present, and future playwright projects! Check it out in action below.

0:00
/0:41

Want to Learn More?

🎭 playwright-cli-select
Problem context Playwright comes out of the box with a collection of ways to run test…

If you find this tool valuable go give it a ⭐️ on GitHub and let Dennis Bergevin know how it helped!


Thanks for reading! If you found this helpful, reach out and let me know on LinkedIn or consider buying me a cup of coffee. If you want more content delivered to you in your inbox subscribe below, and be sure to leave a ❤️ to show some love.