checkout-test-mcp 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +225 -2
- package/checkout-test-mcp.config.example.yaml +69 -0
- package/dist/app.d.ts +13 -0
- package/dist/app.js +38 -0
- package/dist/app.js.map +1 -0
- package/dist/authoring/fragments.d.ts +18 -0
- package/dist/authoring/fragments.js +61 -0
- package/dist/authoring/fragments.js.map +1 -0
- package/dist/authoring/rules.d.ts +29 -0
- package/dist/authoring/rules.js +380 -0
- package/dist/authoring/rules.js.map +1 -0
- package/dist/authoring/save.d.ts +32 -0
- package/dist/authoring/save.js +418 -0
- package/dist/authoring/save.js.map +1 -0
- package/dist/authoring/test-data.d.ts +7 -0
- package/dist/authoring/test-data.js +41 -0
- package/dist/authoring/test-data.js.map +1 -0
- package/dist/cli/args.d.ts +17 -0
- package/dist/cli/args.js +49 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/demo-store.d.ts +5 -0
- package/dist/cli/demo-store.js +19 -0
- package/dist/cli/demo-store.js.map +1 -0
- package/dist/cli/init.d.ts +8 -0
- package/dist/cli/init.js +78 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/package-root.d.ts +1 -0
- package/dist/cli/package-root.js +26 -0
- package/dist/cli/package-root.js.map +1 -0
- package/dist/compare/compare.d.ts +40 -0
- package/dist/compare/compare.js +193 -0
- package/dist/compare/compare.js.map +1 -0
- package/dist/config/env-file.d.ts +9 -0
- package/dist/config/env-file.js +69 -0
- package/dist/config/env-file.js.map +1 -0
- package/dist/config/load-config.d.ts +6 -0
- package/dist/config/load-config.js +124 -0
- package/dist/config/load-config.js.map +1 -0
- package/dist/errors/tool-error.d.ts +104 -0
- package/dist/errors/tool-error.js +88 -0
- package/dist/errors/tool-error.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect/actions.d.ts +108 -0
- package/dist/inspect/actions.js +358 -0
- package/dist/inspect/actions.js.map +1 -0
- package/dist/inspect/code-scan.d.ts +47 -0
- package/dist/inspect/code-scan.js +371 -0
- package/dist/inspect/code-scan.js.map +1 -0
- package/dist/inspect/crawl.d.ts +121 -0
- package/dist/inspect/crawl.js +555 -0
- package/dist/inspect/crawl.js.map +1 -0
- package/dist/inspect/manager.d.ts +94 -0
- package/dist/inspect/manager.js +604 -0
- package/dist/inspect/manager.js.map +1 -0
- package/dist/inspect/page-kind.d.ts +17 -0
- package/dist/inspect/page-kind.js +58 -0
- package/dist/inspect/page-kind.js.map +1 -0
- package/dist/inspect/probe.d.ts +122 -0
- package/dist/inspect/probe.js +1023 -0
- package/dist/inspect/probe.js.map +1 -0
- package/dist/inspect/report.d.ts +724 -0
- package/dist/inspect/report.js +390 -0
- package/dist/inspect/report.js.map +1 -0
- package/dist/inspect/suggest.d.ts +32 -0
- package/dist/inspect/suggest.js +237 -0
- package/dist/inspect/suggest.js.map +1 -0
- package/dist/inspect/words.d.ts +43 -0
- package/dist/inspect/words.js +397 -0
- package/dist/inspect/words.js.map +1 -0
- package/dist/logger.d.ts +15 -0
- package/dist/logger.js +21 -0
- package/dist/logger.js.map +1 -0
- package/dist/prompts/create-scenario.d.ts +7 -0
- package/dist/prompts/create-scenario.js +109 -0
- package/dist/prompts/create-scenario.js.map +1 -0
- package/dist/prompts/setup-checkout-tests.d.ts +24 -0
- package/dist/prompts/setup-checkout-tests.js +257 -0
- package/dist/prompts/setup-checkout-tests.js.map +1 -0
- package/dist/runner/browser.d.ts +38 -0
- package/dist/runner/browser.js +98 -0
- package/dist/runner/browser.js.map +1 -0
- package/dist/runner/classify.d.ts +22 -0
- package/dist/runner/classify.js +136 -0
- package/dist/runner/classify.js.map +1 -0
- package/dist/runner/executor.d.ts +62 -0
- package/dist/runner/executor.js +673 -0
- package/dist/runner/executor.js.map +1 -0
- package/dist/runner/guard-proxy.d.ts +33 -0
- package/dist/runner/guard-proxy.js +179 -0
- package/dist/runner/guard-proxy.js.map +1 -0
- package/dist/runner/launch.d.ts +12 -0
- package/dist/runner/launch.js +51 -0
- package/dist/runner/launch.js.map +1 -0
- package/dist/runner/locator.d.ts +6 -0
- package/dist/runner/locator.js +46 -0
- package/dist/runner/locator.js.map +1 -0
- package/dist/runner/match.d.ts +17 -0
- package/dist/runner/match.js +50 -0
- package/dist/runner/match.js.map +1 -0
- package/dist/runs/browser-slots.d.ts +21 -0
- package/dist/runs/browser-slots.js +48 -0
- package/dist/runs/browser-slots.js.map +1 -0
- package/dist/runs/manager.d.ts +62 -0
- package/dist/runs/manager.js +691 -0
- package/dist/runs/manager.js.map +1 -0
- package/dist/runs/store.d.ts +30 -0
- package/dist/runs/store.js +98 -0
- package/dist/runs/store.js.map +1 -0
- package/dist/runs/summary.d.ts +3 -0
- package/dist/runs/summary.js +22 -0
- package/dist/runs/summary.js.map +1 -0
- package/dist/safety/card-inputs.d.ts +23 -0
- package/dist/safety/card-inputs.js +54 -0
- package/dist/safety/card-inputs.js.map +1 -0
- package/dist/safety/cards.d.ts +43 -0
- package/dist/safety/cards.js +131 -0
- package/dist/safety/cards.js.map +1 -0
- package/dist/safety/hosts.d.ts +24 -0
- package/dist/safety/hosts.js +73 -0
- package/dist/safety/hosts.js.map +1 -0
- package/dist/safety/production.d.ts +2 -0
- package/dist/safety/production.js +3 -0
- package/dist/safety/production.js.map +1 -0
- package/dist/safety/redact-text.d.ts +13 -0
- package/dist/safety/redact-text.js +76 -0
- package/dist/safety/redact-text.js.map +1 -0
- package/dist/safety/secrets.d.ts +45 -0
- package/dist/safety/secrets.js +136 -0
- package/dist/safety/secrets.js.map +1 -0
- package/dist/safety/test-cards.d.ts +22 -0
- package/dist/safety/test-cards.js +153 -0
- package/dist/safety/test-cards.js.map +1 -0
- package/dist/scenarios/expand.d.ts +27 -0
- package/dist/scenarios/expand.js +161 -0
- package/dist/scenarios/expand.js.map +1 -0
- package/dist/scenarios/params.d.ts +16 -0
- package/dist/scenarios/params.js +97 -0
- package/dist/scenarios/params.js.map +1 -0
- package/dist/scenarios/registry.d.ts +29 -0
- package/dist/scenarios/registry.js +132 -0
- package/dist/scenarios/registry.js.map +1 -0
- package/dist/scenarios/template.d.ts +21 -0
- package/dist/scenarios/template.js +107 -0
- package/dist/scenarios/template.js.map +1 -0
- package/dist/schemas/common.d.ts +69 -0
- package/dist/schemas/common.js +45 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/config.d.ts +175 -0
- package/dist/schemas/config.js +83 -0
- package/dist/schemas/config.js.map +1 -0
- package/dist/schemas/run.d.ts +257 -0
- package/dist/schemas/run.js +106 -0
- package/dist/schemas/run.js.map +1 -0
- package/dist/schemas/scenario.d.ts +3910 -0
- package/dist/schemas/scenario.js +324 -0
- package/dist/schemas/scenario.js.map +1 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.js +32 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/compare-runs.d.ts +71 -0
- package/dist/tools/compare-runs.js +66 -0
- package/dist/tools/compare-runs.js.map +1 -0
- package/dist/tools/get-run-result.d.ts +142 -0
- package/dist/tools/get-run-result.js +110 -0
- package/dist/tools/get-run-result.js.map +1 -0
- package/dist/tools/inspect-target.d.ts +259 -0
- package/dist/tools/inspect-target.js +146 -0
- package/dist/tools/inspect-target.js.map +1 -0
- package/dist/tools/list-scenarios.d.ts +82 -0
- package/dist/tools/list-scenarios.js +145 -0
- package/dist/tools/list-scenarios.js.map +1 -0
- package/dist/tools/result.d.ts +3 -0
- package/dist/tools/result.js +9 -0
- package/dist/tools/result.js.map +1 -0
- package/dist/tools/run-scenario.d.ts +52 -0
- package/dist/tools/run-scenario.js +97 -0
- package/dist/tools/run-scenario.js.map +1 -0
- package/dist/tools/save-scenario.d.ts +64 -0
- package/dist/tools/save-scenario.js +81 -0
- package/dist/tools/save-scenario.js.map +1 -0
- package/dist/util/closest.d.ts +2 -0
- package/dist/util/closest.js +27 -0
- package/dist/util/closest.js.map +1 -0
- package/dist/util/paths.d.ts +6 -0
- package/dist/util/paths.js +75 -0
- package/dist/util/paths.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/examples/demo-store/server.mjs +609 -0
- package/package.json +67 -4
- package/scenarios/demo-store/card-3ds-challenge-fail.yaml +115 -0
- package/scenarios/demo-store/card-success.yaml +82 -0
- package/scenarios/demo-store/fragments/add-to-cart.yaml +37 -0
- package/scenarios/demo-store/fragments/fill-card.yaml +23 -0
- package/scenarios/demo-store/fragments/guest-contact-address.yaml +35 -0
- package/scenarios/demo-store/phone-otp-capture-text.yaml +41 -0
- package/scenarios/demo-store/phone-otp-capture.yaml +37 -0
- package/scenarios/saucedemo/guest-checkout-happy-path.yaml +89 -0
- package/schemas/fragment.schema.json +4356 -0
- package/schemas/scenario.schema.json +5545 -0
- package/test-data/customers/tr-guest.yaml +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ahmet Korkmaz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,226 @@
|
|
|
1
|
-
#
|
|
1
|
+
# checkout-test-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An MCP server that lets AI agents run end-to-end checkout and payment test scenarios against e-commerce **test environments**, and get structured results they can act on.
|
|
4
|
+
|
|
5
|
+
> "Run the 3D Secure failure scenario on staging and tell me what broke."
|
|
6
|
+
|
|
7
|
+
The agent calls `list_scenarios`, starts a run with `run_scenario`, reads the verdict with `get_run_result`, and checks a deploy with `compare_runs`. A failed checkout comes back as a result with a failing step, a category, likely causes, next actions, a screenshot, and the relevant console errors and network failures.
|
|
8
|
+
|
|
9
|
+
Stdio transport. Scenarios in YAML. Playwright (Chromium or Google Chrome).
|
|
10
|
+
|
|
11
|
+
## Safety
|
|
12
|
+
|
|
13
|
+
- The agent sends a **target name**, never a URL. Targets come from the config file.
|
|
14
|
+
- Every browser request goes through a host allowlist. A request to another host is blocked. A navigation to another host stops the run with verdict `blocked`.
|
|
15
|
+
- A host must look like a test environment (`localhost`, `*.test`, or a label such as `staging`, `qa`, `sandbox`). A test target refuses hosts in `production_hosts`.
|
|
16
|
+
- A production target needs `environment: production`. Each tool shows a warning for it, and each new run needs `confirm_production: true` after the user says yes. See [Production targets](#production-targets).
|
|
17
|
+
- Card values come only from a built-in registry of payment providers' published test cards. A card number in a tool argument or a scenario file is refused.
|
|
18
|
+
- Secrets come from environment variables named in the config. Secret-like tool arguments are refused. Logs and results are redacted.
|
|
19
|
+
|
|
20
|
+
## Production targets
|
|
21
|
+
|
|
22
|
+
You can run the scenarios on the live site. A run there makes a real order and a real payment, changes stock, starts shipping, and sends email or SMS to real addresses. The server does not cancel or refund the order.
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
production_hosts: [www.shop.example]
|
|
26
|
+
|
|
27
|
+
targets:
|
|
28
|
+
shop-live:
|
|
29
|
+
environment: production
|
|
30
|
+
profile: my-store
|
|
31
|
+
base_url: https://www.shop.example
|
|
32
|
+
allowed_hosts: [www.shop.example]
|
|
33
|
+
live_cards:
|
|
34
|
+
company-visa:
|
|
35
|
+
number_env: SHOP_LIVE_CARD_NUMBER
|
|
36
|
+
expiry_env: SHOP_LIVE_CARD_EXPIRY
|
|
37
|
+
cvc_env: SHOP_LIVE_CARD_CVC
|
|
38
|
+
behaviour: success
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
1. Set the three env vars for the MCP server process. Never put a card number in the config.
|
|
42
|
+
2. Pass `card: live/company-visa` as a param of `run_scenario`.
|
|
43
|
+
3. The agent asks you before each run. It sends `confirm_production: true` only after you say yes.
|
|
44
|
+
|
|
45
|
+
Details: [docs/design.md, section 12](docs/design.md#12-production-targets).
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
Requirements: Node.js 22.12 or later (26 recommended).
|
|
50
|
+
|
|
51
|
+
1. Make a folder for your checkout tests and set it up:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
mkdir checkout-tests && cd checkout-tests
|
|
55
|
+
npx -y checkout-test-mcp init
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The command writes a config file, example scenarios, and test data. It also installs Chromium. Use `--skip-browser` to skip the browser install.
|
|
59
|
+
|
|
60
|
+
2. Add the server to your client. Use the absolute path of the config file.
|
|
61
|
+
|
|
62
|
+
Claude Desktop (`claude_desktop_config.json`):
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"mcpServers": {
|
|
67
|
+
"checkout-test": {
|
|
68
|
+
"command": "npx",
|
|
69
|
+
"args": ["-y", "checkout-test-mcp", "--config", "/absolute/path/to/checkout-test-mcp.config.yaml"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Claude Code:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
claude mcp add checkout-test -- npx -y checkout-test-mcp --config /absolute/path/to/checkout-test-mcp.config.yaml
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. Start the bundled demo store and ask the agent to run `list_scenarios`:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx checkout-test-mcp demo-store
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The demo store runs on http://localhost:4173. Then ask: "Run card-3ds-challenge-fail on demo-local."
|
|
88
|
+
|
|
89
|
+
To see regression detection, restart the demo store with a bug and run the scenario again:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
DEMO_STORE_BUGS=skip-3ds npx checkout-test-mcp demo-store
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Then ask the agent to compare the two runs.
|
|
96
|
+
|
|
97
|
+
Other bug flags: `cookie-banner` shows a consent dialog over every page. `login-wall` removes the guest checkout.
|
|
98
|
+
|
|
99
|
+
## Claude Desktop extension
|
|
100
|
+
|
|
101
|
+
You can install the server as a Desktop extension. Download `checkout-test-mcp-<version>.mcpb` from the [releases page](https://github.com/ahmetkorkmaz3/checkout-test-mcp/releases) and open the file. Claude Desktop asks for the config file and, optionally, an env file.
|
|
102
|
+
|
|
103
|
+
The extension needs Google Chrome or Playwright Chromium on your computer. Run `npx checkout-test-mcp init` to install Chromium.
|
|
104
|
+
|
|
105
|
+
## Browser
|
|
106
|
+
|
|
107
|
+
The `browser` field of the config picks the browser:
|
|
108
|
+
|
|
109
|
+
| Value | Meaning |
|
|
110
|
+
| ---------- | ----------------------------------------------------------------- |
|
|
111
|
+
| `auto` | Default. Uses Playwright Chromium, then Google Chrome. |
|
|
112
|
+
| `chromium` | Uses Playwright Chromium only. |
|
|
113
|
+
| `chrome` | Uses Google Chrome only. |
|
|
114
|
+
|
|
115
|
+
In `auto` mode, the server switches to Chrome only when Chromium is not installed. Each run result shows `browser: { name, version }`.
|
|
116
|
+
|
|
117
|
+
## Secrets and `env_file`
|
|
118
|
+
|
|
119
|
+
Secrets come from environment variables. The config can also name a dotenv file with `KEY=value` lines:
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
env_file: ./.env # relative to the folder of the config file
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The CLI flag `--env-file <path>` wins over the config field. A variable that is already set in the environment wins over the file. An error about the file names the path and the line number only, never a value. Keep the file out of version control.
|
|
126
|
+
|
|
127
|
+
## Tools
|
|
128
|
+
|
|
129
|
+
| Tool | What it does |
|
|
130
|
+
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
131
|
+
| `list_scenarios` | Lists scenarios, targets, and test card ids. Call it first. |
|
|
132
|
+
| `run_scenario` | Starts a run in the background and returns a `run_id` at once. Needs an `idempotency_key`: the same key never starts a second checkout. |
|
|
133
|
+
| `get_run_result` | Status, verdict (`passed`, `failed`, `error`, `blocked`), failing step, likely causes, next actions, screenshots, console and network failures. `wait_s` waits up to 20 s. |
|
|
134
|
+
| `compare_runs` | Diffs two runs of the same scenario and reports regressions, fixes, and slower steps. |
|
|
135
|
+
| `inspect_target` | Reads a test target (site and, when configured, source code) and suggests scenarios with evidence. One tool starts the job and long polls it with the same key. |
|
|
136
|
+
| `save_scenario` | Checks and writes a scenario, fragment, or test data file, and can start a validation run. |
|
|
137
|
+
|
|
138
|
+
The server also has two prompts: `setup_checkout_tests` and `create_scenario`.
|
|
139
|
+
|
|
140
|
+
Full definitions: [docs/tools.md](docs/tools.md).
|
|
141
|
+
|
|
142
|
+
## Authoring and inspection
|
|
143
|
+
|
|
144
|
+
An agent can write scenarios for a new target. It calls `inspect_target`, reads the suggested scenarios and warnings, writes the YAML, and saves each file with `save_scenario`. Two config blocks turn this on:
|
|
145
|
+
|
|
146
|
+
```yaml
|
|
147
|
+
authoring:
|
|
148
|
+
dir: ./scenarios/local # save_scenario writes here. Must be inside one of scenario_dirs.
|
|
149
|
+
test_data_dir_writable: false
|
|
150
|
+
|
|
151
|
+
targets:
|
|
152
|
+
my-staging:
|
|
153
|
+
# ...
|
|
154
|
+
inspect:
|
|
155
|
+
source_dirs: [../my-storefront] # optional, read-only code scan
|
|
156
|
+
start_paths: ["/"]
|
|
157
|
+
max_pages: 25
|
|
158
|
+
probe_checkout: false
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- Without `authoring`, `save_scenario` refuses with `AUTHORING_DISABLED`.
|
|
162
|
+
- Without `inspect`, `inspect_target` crawls from `/` with defaults, skips the code scan, and does not run the checkout probe.
|
|
163
|
+
- `probe_checkout: true` lets the probe go to the payment step with fictional data. It never pays. On the test site it makes a cart item, a guest account with an `example.test` email, an address, and possibly an unpaid order draft. Turn it on only when this is acceptable.
|
|
164
|
+
- Reports go to `runs_dir/inspections/<id>.json`.
|
|
165
|
+
|
|
166
|
+
## Set up a new shop
|
|
167
|
+
|
|
168
|
+
The server has an MCP prompt that sets up the checkout tests of a new shop with no human help. The agent asks you only for what the tools cannot find.
|
|
169
|
+
|
|
170
|
+
1. Add a target and the `authoring` and `inspect` blocks to the config:
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
authoring:
|
|
174
|
+
dir: ./scenarios/local # inside one of scenario_dirs
|
|
175
|
+
test_data_dir_writable: true # lets the agent write a fictional customer file
|
|
176
|
+
|
|
177
|
+
targets:
|
|
178
|
+
my-staging:
|
|
179
|
+
profile: my-store
|
|
180
|
+
base_url: https://staging.example-shop.test
|
|
181
|
+
allowed_hosts: [staging.example-shop.test]
|
|
182
|
+
third_party_hosts: [] # the agent asks you to add the payment and 3D Secure hosts
|
|
183
|
+
secrets:
|
|
184
|
+
member_email: SHOP_MEMBER_EMAIL # for the member scenario
|
|
185
|
+
member_password: SHOP_MEMBER_PASSWORD
|
|
186
|
+
inspect:
|
|
187
|
+
source_dirs: [../my-storefront] # optional
|
|
188
|
+
probe_checkout: true
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
2. Set the secrets as environment variables before you start the server. Never paste a password into the chat. The agent tells you the names when one is missing.
|
|
192
|
+
3. Run the prompt `setup_checkout_tests` with the target name. In Claude Code: `/setup_checkout_tests my-staging` (the client can show it with a server prefix).
|
|
193
|
+
|
|
194
|
+
The server reads the config once. After a config change, restart the server. The agent waits for the restart before it runs card scenarios.
|
|
195
|
+
|
|
196
|
+
The first setup inspects the target, writes the fragments, and writes and runs the baseline scenarios: guest card, declined card, terms required, and member card, when the report has the evidence. It tries each scenario at most 3 times. It ends with a table of each scenario, what it proves, its verdict, and its run id. Then it lists the offers (for example OTP login, gift card), the missing inputs, and the files. Commit the files yourself.
|
|
197
|
+
|
|
198
|
+
For one more scenario later, run the prompt `create_scenario` with the target and a request, for example "a declined card shows an error". See [docs/tools.md](docs/tools.md#9-prompts).
|
|
199
|
+
|
|
200
|
+
## Scenarios
|
|
201
|
+
|
|
202
|
+
Scenarios are YAML files with steps, Playwright-style locators, expectations, and final outcome checks. See [card-3ds-challenge-fail.yaml](scenarios/demo-store/card-3ds-challenge-fail.yaml) and the format in [docs/scenario-format.md](docs/scenario-format.md). Fragments (`include`) and conditions (`when`) let one scenario cover guest and member checkouts. Editors can use [schemas/scenario.schema.json](schemas/scenario.schema.json) for autocomplete.
|
|
203
|
+
|
|
204
|
+
Shipped examples:
|
|
205
|
+
|
|
206
|
+
| Scenario | Target |
|
|
207
|
+
| -------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
208
|
+
| `card-success` | bundled demo store |
|
|
209
|
+
| `card-3ds-challenge-fail` | bundled demo store |
|
|
210
|
+
| `saucedemo-guest-checkout` | www.saucedemo.com (needs `SAUCEDEMO_USERNAME` and `SAUCEDEMO_PASSWORD`, shown on the site's login page) |
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
npm test # unit + integration
|
|
216
|
+
npm run test:e2e # real browser against the demo store
|
|
217
|
+
npm run lint
|
|
218
|
+
npm run typecheck
|
|
219
|
+
npm run smoke # build and call the server over stdio
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Project rules: [CLAUDE.md](CLAUDE.md).
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# checkout-test-mcp config. Copy to checkout-test-mcp.config.yaml and edit.
|
|
2
|
+
# Paths are relative to this file.
|
|
3
|
+
|
|
4
|
+
runs_dir: .checkout-test-mcp/runs # results, screenshots, traces
|
|
5
|
+
max_parallel_runs: 1
|
|
6
|
+
scenario_dirs: [./scenarios]
|
|
7
|
+
test_data_dir: ./test-data
|
|
8
|
+
headless: true
|
|
9
|
+
|
|
10
|
+
# Optional. A dotenv file with secrets (KEY=value lines). Relative to this file.
|
|
11
|
+
# The --env-file flag wins over this field. A variable already set in the shell wins over the file.
|
|
12
|
+
# env_file: ./.env
|
|
13
|
+
|
|
14
|
+
# Optional. auto uses Playwright Chromium, and the installed Google Chrome if Chromium is missing.
|
|
15
|
+
# browser: auto # or chromium, or chrome
|
|
16
|
+
|
|
17
|
+
targets:
|
|
18
|
+
demo-local:
|
|
19
|
+
description: Bundled demo store on this machine. Start it with "npx checkout-test-mcp demo-store".
|
|
20
|
+
profile: demo-store
|
|
21
|
+
base_url: http://localhost:4173
|
|
22
|
+
allowed_hosts: [localhost]
|
|
23
|
+
|
|
24
|
+
saucedemo:
|
|
25
|
+
description: Public Sauce Labs demo store. No payment step.
|
|
26
|
+
profile: saucedemo
|
|
27
|
+
base_url: https://www.saucedemo.com
|
|
28
|
+
allowed_hosts: [www.saucedemo.com]
|
|
29
|
+
test_id_attribute: data-test
|
|
30
|
+
# www.saucedemo.com has no test label. This flag is accepted only
|
|
31
|
+
# together with a non-empty production_hosts list (see below).
|
|
32
|
+
allow_unlabeled_host: true
|
|
33
|
+
secrets:
|
|
34
|
+
# The site shows these demo values on its login page.
|
|
35
|
+
username: SAUCEDEMO_USERNAME
|
|
36
|
+
password: SAUCEDEMO_PASSWORD
|
|
37
|
+
|
|
38
|
+
# Each target can have an optional "inspect" block for inspect_target.
|
|
39
|
+
# All fields have defaults. An empty block is valid.
|
|
40
|
+
# inspect:
|
|
41
|
+
# source_dirs: [../my-storefront] # read-only code scan
|
|
42
|
+
# start_paths: ["/"] # crawl seeds
|
|
43
|
+
# product_paths: [] # optional hint
|
|
44
|
+
# max_pages: 25 # 1..100
|
|
45
|
+
# probe_checkout: false # true lets the probe click add-to-cart and checkout, never pay
|
|
46
|
+
|
|
47
|
+
# Example for a company staging environment:
|
|
48
|
+
# my-staging:
|
|
49
|
+
# description: Company staging, checkout v2 branch.
|
|
50
|
+
# profile: my-store
|
|
51
|
+
# base_url: https://staging.example-shop.test
|
|
52
|
+
# allowed_hosts: [staging.example-shop.test, api-staging.example-shop.test]
|
|
53
|
+
# third_party_hosts: [sandbox-api.iyzipay.com]
|
|
54
|
+
# secrets:
|
|
55
|
+
# basic_auth_user: STAGING_BASIC_USER
|
|
56
|
+
# basic_auth_pass: STAGING_BASIC_PASS
|
|
57
|
+
# http_credentials:
|
|
58
|
+
# username_secret: basic_auth_user
|
|
59
|
+
# password_secret: basic_auth_pass
|
|
60
|
+
|
|
61
|
+
# Optional. Without this block, save_scenario refuses with AUTHORING_DISABLED.
|
|
62
|
+
# authoring:
|
|
63
|
+
# dir: ./scenarios/local # must be inside one of scenario_dirs
|
|
64
|
+
# test_data_dir_writable: false # true lets save_scenario write test data files
|
|
65
|
+
|
|
66
|
+
# Always refused, even when a target lists them.
|
|
67
|
+
production_hosts:
|
|
68
|
+
- saucelabs.com
|
|
69
|
+
- www.saucelabs.com
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Logger } from './logger.js';
|
|
2
|
+
import type { ResolvedConfig } from './schemas/config.js';
|
|
3
|
+
import type { ServerDeps } from './server.js';
|
|
4
|
+
/** Loads config, scenarios, and run state. Shared by all transports. */
|
|
5
|
+
export declare function bootstrap(opts: {
|
|
6
|
+
configPath?: string;
|
|
7
|
+
config?: ResolvedConfig;
|
|
8
|
+
logger?: Logger;
|
|
9
|
+
/** CLI env file. Wins over config.env_file. A relative path is relative to the working folder. */
|
|
10
|
+
envFile?: string;
|
|
11
|
+
/** Where secrets are read and where the env file is loaded. Default: process.env. */
|
|
12
|
+
env?: NodeJS.ProcessEnv;
|
|
13
|
+
}): Promise<ServerDeps>;
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { loadEnvFile } from './config/env-file.js';
|
|
3
|
+
import { loadConfig } from './config/load-config.js';
|
|
4
|
+
import { InspectionManager } from './inspect/manager.js';
|
|
5
|
+
import { createLogger } from './logger.js';
|
|
6
|
+
import { BrowserSlots } from './runs/browser-slots.js';
|
|
7
|
+
import { RunManager } from './runs/manager.js';
|
|
8
|
+
import { RunStore } from './runs/store.js';
|
|
9
|
+
import { ScenarioRegistry } from './scenarios/registry.js';
|
|
10
|
+
/** Loads config, scenarios, and run state. Shared by all transports. */
|
|
11
|
+
export async function bootstrap(opts) {
|
|
12
|
+
const logger = opts.logger ?? createLogger();
|
|
13
|
+
const config = opts.config ?? (await loadConfig(opts.configPath ?? 'checkout-test-mcp.config.yaml'));
|
|
14
|
+
const env = opts.env ?? process.env;
|
|
15
|
+
// Before the managers: they read secrets from env, and the redactor registers them from there.
|
|
16
|
+
const envFile = opts.envFile ? path.resolve(opts.envFile) : config.env_file;
|
|
17
|
+
if (envFile) {
|
|
18
|
+
const { loaded } = loadEnvFile(envFile, env);
|
|
19
|
+
logger.info('env file loaded', { path: envFile, count: loaded.length });
|
|
20
|
+
}
|
|
21
|
+
const registry = await ScenarioRegistry.load(config.scenario_dirs);
|
|
22
|
+
const store = new RunStore(config.runs_dir);
|
|
23
|
+
const interrupted = await store.init();
|
|
24
|
+
// Runs and inspections share the browser slots, so the server never opens more than max_parallel_runs browsers.
|
|
25
|
+
const slots = new BrowserSlots(config.max_parallel_runs);
|
|
26
|
+
const manager = new RunManager({ config, registry, store, logger, slots, env });
|
|
27
|
+
await manager.recover(interrupted);
|
|
28
|
+
const inspections = new InspectionManager({ config, logger, slots, env });
|
|
29
|
+
await inspections.init();
|
|
30
|
+
logger.info('ready', {
|
|
31
|
+
targets: Object.keys(config.targets),
|
|
32
|
+
scenarios: registry.ids(),
|
|
33
|
+
runs_dir: config.runs_dir,
|
|
34
|
+
recovered_runs: interrupted.length,
|
|
35
|
+
});
|
|
36
|
+
return { config, registry, manager, inspections, logger };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAe,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAI3D,wEAAwE;AACxE,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAQ/B;IACC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,YAAY,EAAE,CAAC;IAC7C,MAAM,MA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AI,EAAE,CAAC;IACzB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE;QACnB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QACpC,SAAS,EAAE,QAAQ,CAAC,GAAG,EAAE;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,cAAc,EAAE,WAAW,CAAC,MAAM;KACnC,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface FragmentSummary {
|
|
2
|
+
/** Relative to the authoring folder, with "/" separators. */
|
|
3
|
+
path: string;
|
|
4
|
+
id: string;
|
|
5
|
+
description: string;
|
|
6
|
+
args: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
default?: string | number;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
/** The prompts list at most this many fragments, so a large folder does not fill the prompt. */
|
|
13
|
+
export declare const MAX_LISTED_FRAGMENTS = 50;
|
|
14
|
+
/**
|
|
15
|
+
* The valid fragments in the authoring folder. An agent with only the MCP tools cannot read the
|
|
16
|
+
* folder, so the prompts show this list. A file that does not parse is left out. Symlinks are not followed.
|
|
17
|
+
*/
|
|
18
|
+
export declare function listFragments(dir: string): Promise<FragmentSummary[]>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { readdir, readFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { parse } from 'yaml';
|
|
4
|
+
import { Fragment } from '../schemas/scenario.js';
|
|
5
|
+
/** The prompts list at most this many fragments, so a large folder does not fill the prompt. */
|
|
6
|
+
export const MAX_LISTED_FRAGMENTS = 50;
|
|
7
|
+
const MAX_FILE_BYTES = 64 * 1024;
|
|
8
|
+
/**
|
|
9
|
+
* The valid fragments in the authoring folder. An agent with only the MCP tools cannot read the
|
|
10
|
+
* folder, so the prompts show this list. A file that does not parse is left out. Symlinks are not followed.
|
|
11
|
+
*/
|
|
12
|
+
export async function listFragments(dir) {
|
|
13
|
+
let entries;
|
|
14
|
+
try {
|
|
15
|
+
entries = await readdir(dir, { withFileTypes: true, recursive: true });
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const files = entries
|
|
21
|
+
.filter((e) => e.isFile() && /\.ya?ml$/.test(e.name))
|
|
22
|
+
.map((e) => path.join(e.parentPath, e.name))
|
|
23
|
+
.sort();
|
|
24
|
+
const out = [];
|
|
25
|
+
for (const file of files) {
|
|
26
|
+
if (out.length >= MAX_LISTED_FRAGMENTS)
|
|
27
|
+
break;
|
|
28
|
+
let text;
|
|
29
|
+
try {
|
|
30
|
+
text = await readFile(file, 'utf8');
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (text.length > MAX_FILE_BYTES || !/^kind:\s*fragment\s*$/m.test(text))
|
|
36
|
+
continue;
|
|
37
|
+
let doc;
|
|
38
|
+
try {
|
|
39
|
+
doc = parse(text);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const parsed = Fragment.safeParse(doc);
|
|
45
|
+
if (!parsed.success)
|
|
46
|
+
continue;
|
|
47
|
+
const f = parsed.data;
|
|
48
|
+
out.push({
|
|
49
|
+
path: path.relative(dir, file).split(path.sep).join('/'),
|
|
50
|
+
id: f.id,
|
|
51
|
+
description: f.description.replace(/\s+/g, ' ').trim(),
|
|
52
|
+
args: Object.entries(f.args).map(([name, a]) => ({
|
|
53
|
+
name,
|
|
54
|
+
description: a.description.replace(/\s+/g, ' ').trim(),
|
|
55
|
+
...(a.default !== undefined ? { default: a.default } : {}),
|
|
56
|
+
})),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return out;
|
|
60
|
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AC3D,CAAC,CAAC;SACJ,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Fragment, Scenario } from '../schemas/scenario.js';
|
|
2
|
+
import { checkTestData } from './test-data.js';
|
|
3
|
+
export interface RuleIssue {
|
|
4
|
+
rule: string;
|
|
5
|
+
severity: 'error' | 'warning';
|
|
6
|
+
/** Dotted YAML path, for example "steps.3.value" or "params.email.default". Test data issues use "line N". */
|
|
7
|
+
path: string;
|
|
8
|
+
message: string;
|
|
9
|
+
fix: string;
|
|
10
|
+
}
|
|
11
|
+
export { checkTestData };
|
|
12
|
+
/**
|
|
13
|
+
* Adds the schema comment line and schema_version. Text edits keep comments and key order.
|
|
14
|
+
* The yaml parser only decides whether the text is a map that lacks schema_version.
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyFixes(text: string, _kind: 'scenario' | 'fragment', schemaPath: string): {
|
|
17
|
+
text: string;
|
|
18
|
+
fixes: string[];
|
|
19
|
+
};
|
|
20
|
+
type HouseInput = {
|
|
21
|
+
kind: 'scenario';
|
|
22
|
+
raw: Scenario;
|
|
23
|
+
expanded: Scenario;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'fragment';
|
|
26
|
+
raw: Fragment;
|
|
27
|
+
};
|
|
28
|
+
/** Runs the house rules. The caller refuses a save on any issue with severity "error". */
|
|
29
|
+
export declare function checkHouseRules(input: HouseInput): RuleIssue[];
|