-
Notifications
You must be signed in to change notification settings - Fork 744
chore: Add integration tests for CLI args to form fields #643
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
base: main
Are you sure you want to change the base?
chore: Add integration tests for CLI args to form fields #643
Conversation
d4f46ef
to
57973ab
Compare
57973ab
to
3947fa6
Compare
330b67a
to
b86d5fd
Compare
Thanks for adding these! I think we're good to merge these if you want to remove the extra comments. |
e8f464e
to
e4dc087
Compare
Ensures Playwright itself has the configuration needed for the Inspector. Also allows future env without additional clutter in `package.json`.
e4dc087
to
31f2a8b
Compare
Use different server startup commands in Playwright to allow tests that command line arguments initialize form inputs as intended. A full integration test is used because the Inspector comprises multiple components (package bin entry point, start command, webClient, server), making benefit to test-effort higher, and less dependent on implementation details. The webServer start command uses the package entry point to ensure tests follow the exact user experience provided by: `npx @m/inspector [...]` Playwright's `webServer.command` cannot be [re]configured after it has started, so multiple Playwright invocations are necessary. To do this, use an environment variable and a command-generating function (instead of multiple config files). Test tagging (`@cli`) is used to select which tests execute, while keeping the entire test suite together. Future: Playwright has a feature under consideration to permit a web server per project, which might simplify the config: microsoft/playwright#22496
- Remove `@cli` tag, otherwise these tests will run twice, once with each scenario. Untagged, they run as part of the main e2e tests. - Use the `APP_URL`, consistent with other e2e tests.
31f2a8b
to
8f05dfb
Compare
This is ready, but I'm uncertain how to proceed, and how much value is here or how much effort This PR aims to cover the user-experience -- A simple testing approach is used: two scenarios, with different CLI options, result in identical UI In this PR as env switch (process.env.CLI_TEST_SCENARIO) {
case "file":
return "npx . --config client/e2e/fixtures/everything-server.json --server everything";
case "inline":
return "npx . -e FOO=bar -e BAZ=bat npm --silent --prefix /path/to/mcp/servers/src/everything run start";
default:
return "npm run dev";
} controlled from "test:e2e:cli-file": "CLI_TEST_SCENARIO=file playwright test --grep @cli e2e",
"test:e2e:cli-inline": "CLI_TEST_SCENARIO=inline playwright test --grep @cli e2e", Combinations of new and mutually exclusive CLI options need a new Playwright web server startup command(s). Also, when command line options result in different UI state, then additional test tags would be added to run only the tests for that state. When more command line options are added (recently, In addition, it looks like the existing CLI tests are not testing CLI parsing, but rather query param handling (via overrides in configUtils.ts), but I could be missing something. Query param handling tests overlap conceptually with the existing default UI values (i.e., no query params) tests in A few options:
If not 1 or 2, maintainer feedback would be appreciated. :) Is this worthwhile? How much should |
Add Playwright tests to cover command line argument parsing into form fields.
Motivation and Context
Command line arguments were not populating form fields as expected, which was fixed by #641. Add tests to prevent another regression.
How Has This Been Tested?
Running tests with
npm run test:e2e
will execute these new tests.Breaking Changes
None
Types of changes
Checklist