microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.93k stars 3.67k forks source link

[Feature]: `create-playwright` option `--no-gha` to skip GitHub Actions workflow question #33243

Open karlhorky opened 3 weeks ago

karlhorky commented 3 weeks ago

šŸš€ Feature Request

Add --no-gha option to create-playwright to be able to skip the question of creating the GitHub Actions workflow, instead of requiring interactive input from the user

Already opened a PR for this, but it was closed because there's no companion issue yet:

Example

$ pnpm create playwright
Getting started with writing end-to-end tests with Playwright:
Initializing project in '.'
āœ” Do you want to use TypeScript or JavaScript? Ā· TypeScript
āœ” Where to put your end-to-end tests? Ā· tests
āœ” Add a GitHub Actions workflow? (y/N) Ā· false
āœ– Install Playwright browsers (can be done manually via 'pnpm exec playwright install')? (Y/n) Ā· true

$ pnpm create playwright --no-gha
Getting started with writing end-to-end tests with Playwright:
Initializing project in '.'
āœ” Do you want to use TypeScript or JavaScript? Ā· TypeScript
āœ” Where to put your end-to-end tests? Ā· tests
āœ– Install Playwright browsers (can be done manually via 'pnpm exec playwright install')? (Y/n) Ā· true

Motivation

Be able to run the script in a more automated, zero-config way, instead of having to input details interactively as a user.

tphillips-ict commented 2 weeks ago

I am not really sure how removing one question from a list of 4 makes the initialisation more script-friendly. Maybe the responses to the questions should be able to be given on the command-line when running create playwright Does --quiet achieve the same effect?

karlhorky commented 2 weeks ago

I am not really sure how removing one question from a list of 4 makes the initialisation more script-friendly.

Almost all of the other questions are already able to be passed via flags.

Unfortunately, the Playwright team declined one of the others I proposed:

If I remember correctly, with --no-gha and --test-dir, it would enable create-playwright to be run non-interactively (in a configurable way, which --quiet is not - see below).

Maybe the responses to the questions should be able to be given on the command-line when running create playwright

Yes, agreed. This is a common pattern with scaffolding CLIs like create-next-app - all interactive questions should be specifiable via command line flags too.

Does --quiet achieve the same effect?

No, the --quiet flag is an unconfigurable list of defaults. (exception being the TEST_OPTIONS environment variable, which is discouraged (undocumented and internal))