Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] playwright init should support a non-interactive mode with arguments specified on the command line. #11843

Closed
EvanCarroll opened this issue Feb 3, 2022 · 6 comments

Comments

@EvanCarroll
Copy link

EvanCarroll commented Feb 3, 2022

  • npm init playwright runs an interactive program that initializes a playwright project.
  • CI doesn't work well with interactive prompts
  • There is no supported method to run npm init without interactivity.

It would be nice if

  • users could run npx create-playwright --lang TypeScript --dir tests --github --install-deps to specify or override all the default options explicitly in the command line.
  • users could run npx create-playwright -y or --yes (which is the convention for npm init) to disable interactive prompting and accept all the defaults
@EvanCarroll EvanCarroll changed the title [Feature] playwright init arguments. [Feature] playwright init should support a non-interactive mode with arguments specified on the command line. Feb 3, 2022
@bitdeft
Copy link

bitdeft commented Sep 23, 2022

And updates on this?

@deviantintegral
Copy link

I ran into this working on integrating Playwright with ddev. For tests, we need to commit a playwright skeleton as a fixture instead of initializing it from latest. I would have preferred to have the option to run npm init at least in HEAD tests to know if anything has broken upstream.

Lullabot/ddev-playwright#1

@dmoughabghab
Copy link

Agree we need this

@mxschmitt
Copy link
Member

This is already there, see:

Usage: npx create-playwright@latest [options] [rootDir]
    Available options are:
      --help: print this message
      --browser=<name>: browsers to use in default config (default: 'chromium,firefox,webkit')
      --no-browsers: do not download browsers (can be done manually via 'npx playwright install')
      --install-deps: install dependencies (default: false)
      --next: install @next version of Playwright
      --beta: install @beta version of Playwright
      --ct: install Playwright Component testing
      --quiet: do not ask for interactive input prompts
      --gha: install GitHub Actions
      --lang=<js>: language to use (default: 'TypeScript'. Potential values: 'js', 'TypeScript')

We use it e.g. for the VSCode integration when creating projects: npm init playwright -- --quiet --install-deps --gha --browser chromium

@deviantintegral
Copy link

I could have sworn I looked for CLI parameters before, but this doesn't look to be a new feature... so 🤷 ? Thanks for the update.

But I have a thought. Even with a parameter, you have to specify --quiet for a question to be ignored.

❯ npx create-playwright@latest --lang=TypeScript
Getting started with writing end-to-end tests with Playwright:
Initializing project in '.'
? Do you want to use TypeScript or JavaScript? …
❯ TypeScript
  JavaScript

# Hangs here...

I think I probably read --quiet without reading the description. Usually --quiet means to suppress logging output, not to change anything in terms of interactivity.

@mxschmitt shall I file a new issue with details?

@andy-lcm
Copy link

andy-lcm commented Jun 19, 2024

I agree with @deviantintegral --quiet seems wrong here. Suggestion: --defaults should trigger non-interactive mode, using defaults for all values which were not specified on the command line. --quiet should reduce the amount of output in some way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants