@astrofoundry/pi-astro 0.2.11 → 0.3.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/extensions/astro-agents/agents/code-reviewer.md +2 -0
- package/extensions/astro-agents/agents/google-tech-lead.md +2 -0
- package/extensions/astro-agents/agents/spec-writer.md +2 -0
- package/extensions/astro-agents/agents/tester-api.md +2 -0
- package/extensions/astro-agents/agents/tester-ui.md +2 -0
- package/extensions/astro-agents/agents/ui-architect.md +2 -0
- package/extensions/astro-agents/agents/ui-design-system.md +2 -0
- package/extensions/astro-agents/agents/ui-frontend-developer.md +2 -0
- package/package.json +1 -1
- package/skills/grimoire/SKILL.md +101 -0
- package/skills/playwright-cli/SKILL.md +278 -0
- package/skills/playwright-cli/references/request-mocking.md +87 -0
- package/skills/playwright-cli/references/running-code.md +232 -0
- package/skills/playwright-cli/references/session-management.md +169 -0
- package/skills/playwright-cli/references/storage-state.md +275 -0
- package/skills/playwright-cli/references/test-generation.md +88 -0
- package/skills/playwright-cli/references/tracing.md +139 -0
- package/skills/playwright-cli/references/video-recording.md +43 -0
- package/skills/postman-cli/SKILL.md +339 -0
- package/skills/postman-cli/references/environments.md +92 -0
- package/skills/postman-cli/references/reporters.md +94 -0
- package/skills/postman-cli/references/request-scripting.md +69 -0
- package/skills/raycast-script-creator/SKILL.md +132 -0
- package/themes/astro.json +76 -0
- package/skills/.gitkeep +0 -0
- package/themes/.gitkeep +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Test Generation
|
|
2
|
+
|
|
3
|
+
Generate Playwright test code automatically as you interact with the browser.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
Every action you perform with `playwright-cli` generates corresponding Playwright TypeScript code.
|
|
8
|
+
This code appears in the output and can be copied directly into your test files.
|
|
9
|
+
|
|
10
|
+
## Example Workflow
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Start a session
|
|
14
|
+
playwright-cli open https://example.com/login
|
|
15
|
+
|
|
16
|
+
# Take a snapshot to see elements
|
|
17
|
+
playwright-cli snapshot
|
|
18
|
+
# Output shows: e1 [textbox "Email"], e2 [textbox "Password"], e3 [button "Sign In"]
|
|
19
|
+
|
|
20
|
+
# Fill form fields - generates code automatically
|
|
21
|
+
playwright-cli fill e1 "user@example.com"
|
|
22
|
+
# Ran Playwright code:
|
|
23
|
+
# await page.getByRole('textbox', { name: 'Email' }).fill('user@example.com');
|
|
24
|
+
|
|
25
|
+
playwright-cli fill e2 "password123"
|
|
26
|
+
# Ran Playwright code:
|
|
27
|
+
# await page.getByRole('textbox', { name: 'Password' }).fill('password123');
|
|
28
|
+
|
|
29
|
+
playwright-cli click e3
|
|
30
|
+
# Ran Playwright code:
|
|
31
|
+
# await page.getByRole('button', { name: 'Sign In' }).click();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Building a Test File
|
|
35
|
+
|
|
36
|
+
Collect the generated code into a Playwright test:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { test, expect } from '@playwright/test';
|
|
40
|
+
|
|
41
|
+
test('login flow', async ({ page }) => {
|
|
42
|
+
// Generated code from playwright-cli session:
|
|
43
|
+
await page.goto('https://example.com/login');
|
|
44
|
+
await page.getByRole('textbox', { name: 'Email' }).fill('user@example.com');
|
|
45
|
+
await page.getByRole('textbox', { name: 'Password' }).fill('password123');
|
|
46
|
+
await page.getByRole('button', { name: 'Sign In' }).click();
|
|
47
|
+
|
|
48
|
+
// Add assertions
|
|
49
|
+
await expect(page).toHaveURL(/.*dashboard/);
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Best Practices
|
|
54
|
+
|
|
55
|
+
### 1. Use Semantic Locators
|
|
56
|
+
|
|
57
|
+
The generated code uses role-based locators when possible, which are more resilient:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
// Generated (good - semantic)
|
|
61
|
+
await page.getByRole('button', { name: 'Submit' }).click();
|
|
62
|
+
|
|
63
|
+
// Avoid (fragile - CSS selectors)
|
|
64
|
+
await page.locator('#submit-btn').click();
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Explore Before Recording
|
|
68
|
+
|
|
69
|
+
Take snapshots to understand the page structure before recording actions:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
playwright-cli open https://example.com
|
|
73
|
+
playwright-cli snapshot
|
|
74
|
+
# Review the element structure
|
|
75
|
+
playwright-cli click e5
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 3. Add Assertions Manually
|
|
79
|
+
|
|
80
|
+
Generated code captures actions but not assertions. Add expectations in your test:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
// Generated action
|
|
84
|
+
await page.getByRole('button', { name: 'Submit' }).click();
|
|
85
|
+
|
|
86
|
+
// Manual assertion
|
|
87
|
+
await expect(page.getByText('Success')).toBeVisible();
|
|
88
|
+
```
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Tracing
|
|
2
|
+
|
|
3
|
+
Capture detailed execution traces for debugging and analysis. Traces include DOM snapshots, screenshots, network activity, and console logs.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Start trace recording
|
|
9
|
+
playwright-cli tracing-start
|
|
10
|
+
|
|
11
|
+
# Perform actions
|
|
12
|
+
playwright-cli open https://example.com
|
|
13
|
+
playwright-cli click e1
|
|
14
|
+
playwright-cli fill e2 "test"
|
|
15
|
+
|
|
16
|
+
# Stop trace recording
|
|
17
|
+
playwright-cli tracing-stop
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Trace Output Files
|
|
21
|
+
|
|
22
|
+
When you start tracing, Playwright creates a `traces/` directory with several files:
|
|
23
|
+
|
|
24
|
+
### `trace-{timestamp}.trace`
|
|
25
|
+
|
|
26
|
+
**Action log** - The main trace file containing:
|
|
27
|
+
- Every action performed (clicks, fills, navigations)
|
|
28
|
+
- DOM snapshots before and after each action
|
|
29
|
+
- Screenshots at each step
|
|
30
|
+
- Timing information
|
|
31
|
+
- Console messages
|
|
32
|
+
- Source locations
|
|
33
|
+
|
|
34
|
+
### `trace-{timestamp}.network`
|
|
35
|
+
|
|
36
|
+
**Network log** - Complete network activity:
|
|
37
|
+
- All HTTP requests and responses
|
|
38
|
+
- Request headers and bodies
|
|
39
|
+
- Response headers and bodies
|
|
40
|
+
- Timing (DNS, connect, TLS, TTFB, download)
|
|
41
|
+
- Resource sizes
|
|
42
|
+
- Failed requests and errors
|
|
43
|
+
|
|
44
|
+
### `resources/`
|
|
45
|
+
|
|
46
|
+
**Resources directory** - Cached resources:
|
|
47
|
+
- Images, fonts, stylesheets, scripts
|
|
48
|
+
- Response bodies for replay
|
|
49
|
+
- Assets needed to reconstruct page state
|
|
50
|
+
|
|
51
|
+
## What Traces Capture
|
|
52
|
+
|
|
53
|
+
| Category | Details |
|
|
54
|
+
|----------|---------|
|
|
55
|
+
| **Actions** | Clicks, fills, hovers, keyboard input, navigations |
|
|
56
|
+
| **DOM** | Full DOM snapshot before/after each action |
|
|
57
|
+
| **Screenshots** | Visual state at each step |
|
|
58
|
+
| **Network** | All requests, responses, headers, bodies, timing |
|
|
59
|
+
| **Console** | All console.log, warn, error messages |
|
|
60
|
+
| **Timing** | Precise timing for each operation |
|
|
61
|
+
|
|
62
|
+
## Use Cases
|
|
63
|
+
|
|
64
|
+
### Debugging Failed Actions
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
playwright-cli tracing-start
|
|
68
|
+
playwright-cli open https://app.example.com
|
|
69
|
+
|
|
70
|
+
# This click fails - why?
|
|
71
|
+
playwright-cli click e5
|
|
72
|
+
|
|
73
|
+
playwright-cli tracing-stop
|
|
74
|
+
# Open trace to see DOM state when click was attempted
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Analyzing Performance
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
playwright-cli tracing-start
|
|
81
|
+
playwright-cli open https://slow-site.com
|
|
82
|
+
playwright-cli tracing-stop
|
|
83
|
+
|
|
84
|
+
# View network waterfall to identify slow resources
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Capturing Evidence
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Record a complete user flow for documentation
|
|
91
|
+
playwright-cli tracing-start
|
|
92
|
+
|
|
93
|
+
playwright-cli open https://app.example.com/checkout
|
|
94
|
+
playwright-cli fill e1 "4111111111111111"
|
|
95
|
+
playwright-cli fill e2 "12/25"
|
|
96
|
+
playwright-cli fill e3 "123"
|
|
97
|
+
playwright-cli click e4
|
|
98
|
+
|
|
99
|
+
playwright-cli tracing-stop
|
|
100
|
+
# Trace shows exact sequence of events
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Trace vs Video vs Screenshot
|
|
104
|
+
|
|
105
|
+
| Feature | Trace | Video | Screenshot |
|
|
106
|
+
|---------|-------|-------|------------|
|
|
107
|
+
| **Format** | .trace file | .webm video | .png/.jpeg image |
|
|
108
|
+
| **DOM inspection** | Yes | No | No |
|
|
109
|
+
| **Network details** | Yes | No | No |
|
|
110
|
+
| **Step-by-step replay** | Yes | Continuous | Single frame |
|
|
111
|
+
| **File size** | Medium | Large | Small |
|
|
112
|
+
| **Best for** | Debugging | Demos | Quick capture |
|
|
113
|
+
|
|
114
|
+
## Best Practices
|
|
115
|
+
|
|
116
|
+
### 1. Start Tracing Before the Problem
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Trace the entire flow, not just the failing step
|
|
120
|
+
playwright-cli tracing-start
|
|
121
|
+
playwright-cli open https://example.com
|
|
122
|
+
# ... all steps leading to the issue ...
|
|
123
|
+
playwright-cli tracing-stop
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 2. Clean Up Old Traces
|
|
127
|
+
|
|
128
|
+
Traces can consume significant disk space:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Remove traces older than 7 days
|
|
132
|
+
find .playwright-cli/traces -mtime +7 -delete
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Limitations
|
|
136
|
+
|
|
137
|
+
- Traces add overhead to automation
|
|
138
|
+
- Large traces can consume significant disk space
|
|
139
|
+
- Some dynamic content may not replay perfectly
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Video Recording
|
|
2
|
+
|
|
3
|
+
Capture browser automation sessions as video for debugging, documentation, or verification. Produces WebM (VP8/VP9 codec).
|
|
4
|
+
|
|
5
|
+
## Basic Recording
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Start recording
|
|
9
|
+
playwright-cli video-start
|
|
10
|
+
|
|
11
|
+
# Perform actions
|
|
12
|
+
playwright-cli open https://example.com
|
|
13
|
+
playwright-cli snapshot
|
|
14
|
+
playwright-cli click e1
|
|
15
|
+
playwright-cli fill e2 "test input"
|
|
16
|
+
|
|
17
|
+
# Stop and save
|
|
18
|
+
playwright-cli video-stop demo.webm
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Best Practices
|
|
22
|
+
|
|
23
|
+
### 1. Use Descriptive Filenames
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Include context in filename
|
|
27
|
+
playwright-cli video-stop recordings/login-flow-2024-01-15.webm
|
|
28
|
+
playwright-cli video-stop recordings/checkout-test-run-42.webm
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Tracing vs Video
|
|
32
|
+
|
|
33
|
+
| Feature | Video | Tracing |
|
|
34
|
+
|---------|-------|---------|
|
|
35
|
+
| Output | WebM file | Trace file (viewable in Trace Viewer) |
|
|
36
|
+
| Shows | Visual recording | DOM snapshots, network, console, actions |
|
|
37
|
+
| Use case | Demos, documentation | Debugging, analysis |
|
|
38
|
+
| Size | Larger | Smaller |
|
|
39
|
+
|
|
40
|
+
## Limitations
|
|
41
|
+
|
|
42
|
+
- Recording adds slight overhead to automation
|
|
43
|
+
- Large recordings can consume significant disk space
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: postman-cli
|
|
3
|
+
description: Runs Postman collections, sends HTTP requests, manages mock servers, lints API specs, and pushes workspace changes from the command line. Use this skill whenever the user wants to run API tests, execute collection runs, send ad-hoc HTTP requests, test endpoints, check if an API is working, hit a URL, run Postman tests against QA or staging, start mock servers, lint OpenAPI specs, manage Postman workspace sync, or do anything curl-like with environment variables and auth. Trigger even when the user says "test my API", "call this endpoint", "run the collection", or "send a request to..." — this skill replaces curl/wget with Postman's full feature set.
|
|
4
|
+
allowed-tools: Bash(postman:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Postman CLI
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# run a collection locally with an environment
|
|
13
|
+
postman collection run ./postman/collections/nada-to-odoo -e ./postman/environments/qa.postman_environment.yaml
|
|
14
|
+
# run a specific folder within a collection
|
|
15
|
+
postman collection run ./postman/collections/nada-to-odoo -i "sale.order"
|
|
16
|
+
# send a quick GET request
|
|
17
|
+
postman request https://api.example.com/health
|
|
18
|
+
# send a POST with body and auth
|
|
19
|
+
postman request POST https://api.example.com/orders --body '{"item":"test"}' --auth-bearer-token "$TOKEN"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Commands
|
|
23
|
+
|
|
24
|
+
### Collection run
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# run entire collection from local path
|
|
28
|
+
postman collection run <collectionPath> [options]
|
|
29
|
+
|
|
30
|
+
# run with environment file
|
|
31
|
+
postman collection run ./collection -e ./env.yaml
|
|
32
|
+
|
|
33
|
+
# run with environment variable overrides
|
|
34
|
+
postman collection run ./collection -e ./env.yaml --env-var "odoo_base_url=https://odoo.example.com" --env-var "odoo_db=test_db"
|
|
35
|
+
|
|
36
|
+
# run with global variables
|
|
37
|
+
postman collection run ./collection -g ./globals.json
|
|
38
|
+
postman collection run ./collection --global-var "api_version=v2"
|
|
39
|
+
|
|
40
|
+
# run specific folder(s) or request(s) by name or ID
|
|
41
|
+
postman collection run ./collection -i "sale.order"
|
|
42
|
+
postman collection run ./collection -i "sale.order" -i "res.partner"
|
|
43
|
+
|
|
44
|
+
# run with iteration data file (JSON or CSV)
|
|
45
|
+
postman collection run ./collection -d ./test-data.csv -n 5
|
|
46
|
+
|
|
47
|
+
# stop on first error
|
|
48
|
+
postman collection run ./collection --bail
|
|
49
|
+
postman collection run ./collection --bail --failure
|
|
50
|
+
|
|
51
|
+
# control timeouts (milliseconds)
|
|
52
|
+
postman collection run ./collection --timeout 60000 --timeout-request 10000 --timeout-script 5000
|
|
53
|
+
|
|
54
|
+
# add delay between requests
|
|
55
|
+
postman collection run ./collection --delay-request 500
|
|
56
|
+
|
|
57
|
+
# verbose output
|
|
58
|
+
postman collection run ./collection --verbose
|
|
59
|
+
|
|
60
|
+
# suppress exit code (always exit 0)
|
|
61
|
+
postman collection run ./collection -x
|
|
62
|
+
|
|
63
|
+
# use custom working directory for relative file paths
|
|
64
|
+
postman collection run ./collection --working-dir ./postman
|
|
65
|
+
|
|
66
|
+
# ignore redirects
|
|
67
|
+
postman collection run ./collection --ignore-redirects
|
|
68
|
+
|
|
69
|
+
# SSL options
|
|
70
|
+
postman collection run ./collection -k
|
|
71
|
+
postman collection run ./collection --ssl-client-cert ./cert.pem --ssl-client-key ./key.pem
|
|
72
|
+
postman collection run ./collection --ssl-extra-ca-certs ./ca.pem
|
|
73
|
+
|
|
74
|
+
# cookie jar
|
|
75
|
+
postman collection run ./collection --cookie-jar ./cookies.json --export-cookie-jar ./cookies-after.json
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Reporters
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# default: CLI reporter only
|
|
82
|
+
postman collection run ./collection
|
|
83
|
+
|
|
84
|
+
# JSON report
|
|
85
|
+
postman collection run ./collection -r json
|
|
86
|
+
|
|
87
|
+
# multiple reporters
|
|
88
|
+
postman collection run ./collection -r cli,json,junit,html
|
|
89
|
+
|
|
90
|
+
# custom export path
|
|
91
|
+
postman collection run ./collection -r json --reporter-json-export ./reports/result.json
|
|
92
|
+
postman collection run ./collection -r junit --reporter-junit-export ./reports/result.xml
|
|
93
|
+
postman collection run ./collection -r html --reporter-html-export ./reports/result.html
|
|
94
|
+
|
|
95
|
+
# newman-compatible JSON structure
|
|
96
|
+
postman collection run ./collection -r json --reporter-json-structure newman
|
|
97
|
+
|
|
98
|
+
# omit sensitive data from reports
|
|
99
|
+
postman collection run ./collection -r json --reporter-json-omitRequestBodies --reporter-json-omitResponseBodies
|
|
100
|
+
postman collection run ./collection -r json --reporter-json-omitHeaders
|
|
101
|
+
postman collection run ./collection -r json --reporter-json-omitAllHeadersAndBody
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Reports are saved to `./postman-cli-reports/` by default. Only the CLI reporter is supported for v3 format (YAML) collections. JSON, JUnit, and HTML reporters require v2 format (JSON) collections.
|
|
105
|
+
|
|
106
|
+
### Send a single request
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# basic GET
|
|
110
|
+
postman request https://api.example.com/users
|
|
111
|
+
|
|
112
|
+
# explicit method
|
|
113
|
+
postman request GET https://api.example.com/users
|
|
114
|
+
postman request POST https://api.example.com/users
|
|
115
|
+
postman request PUT https://api.example.com/users/1
|
|
116
|
+
postman request PATCH https://api.example.com/users/1
|
|
117
|
+
postman request DELETE https://api.example.com/users/1
|
|
118
|
+
|
|
119
|
+
# with headers
|
|
120
|
+
postman request https://api.example.com/data -H "Content-Type:application/json" -H "X-API-Key:abc123"
|
|
121
|
+
|
|
122
|
+
# with body (inline, from file, or from stdin)
|
|
123
|
+
postman request POST https://api.example.com/users --body '{"name":"John"}'
|
|
124
|
+
postman request POST https://api.example.com/users --body @data.json
|
|
125
|
+
echo '{"name":"John"}' | postman request POST https://api.example.com/users --body -
|
|
126
|
+
|
|
127
|
+
# multipart form data
|
|
128
|
+
postman request POST https://api.example.com/upload -f "name=John" -f "avatar=@photo.jpg"
|
|
129
|
+
|
|
130
|
+
# with environment file (resolves {{variables}} in URL, headers, body)
|
|
131
|
+
postman request POST https://{{base_url}}/api/users -e dev.postman_environment.json --body '{"name":"{{test_user}}"}'
|
|
132
|
+
|
|
133
|
+
# authentication
|
|
134
|
+
postman request https://api.example.com/data --auth-bearer-token "mytoken123"
|
|
135
|
+
postman request https://api.example.com/data --auth-basic-username user --auth-basic-password pass
|
|
136
|
+
postman request https://api.example.com/data --auth-apikey-key "X-API-Key" --auth-apikey-value "abc123" --auth-apikey-in header
|
|
137
|
+
|
|
138
|
+
# with pre-request and post-response scripts
|
|
139
|
+
postman request POST https://api.example.com/login --body '{"user":"admin","pass":"secret"}' \
|
|
140
|
+
--script-post-request "const token = pm.response.json().token; console.log('Token:', token);"
|
|
141
|
+
|
|
142
|
+
# timeout and retries
|
|
143
|
+
postman request https://api.example.com/health --timeout 5000 --retry 3 --retry-delay 1000
|
|
144
|
+
|
|
145
|
+
# redirect control
|
|
146
|
+
postman request https://api.example.com/redirect --redirects-ignore
|
|
147
|
+
postman request https://api.example.com/redirect --redirects-max 5
|
|
148
|
+
|
|
149
|
+
# output control
|
|
150
|
+
postman request https://api.example.com/data --response-only
|
|
151
|
+
postman request https://api.example.com/data --verbose
|
|
152
|
+
postman request https://api.example.com/data --debug
|
|
153
|
+
postman request https://api.example.com/data --output response.json
|
|
154
|
+
|
|
155
|
+
# pipe response to other tools
|
|
156
|
+
postman request https://api.example.com/data --response-only | jq '.results[]'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Authentication
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# sign in via browser
|
|
163
|
+
postman login
|
|
164
|
+
|
|
165
|
+
# sign in with API key (for CI/CD)
|
|
166
|
+
postman login --with-api-key ABCD-1234-1234-1234-1234-1234
|
|
167
|
+
|
|
168
|
+
# EU data residency
|
|
169
|
+
postman login --with-api-key ABCD-1234-1234-1234-1234-1234 --region eu
|
|
170
|
+
|
|
171
|
+
# sign out
|
|
172
|
+
postman logout
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Collection migration
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# migrate v2.1 (JSON) collection to v3 (YAML) format
|
|
179
|
+
postman collection migrate ./my-collection.json
|
|
180
|
+
postman collection migrate ./my-collection.json --output ./path/to/new-collection
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Mock servers
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# start a local mock server from a manifest file
|
|
187
|
+
postman mock run ./mock-manifest.json
|
|
188
|
+
|
|
189
|
+
# start mock in background, run collection against it, then stop
|
|
190
|
+
postman mock run ./postman/mocks/odoo-mock.json &
|
|
191
|
+
MOCK_PID=$!
|
|
192
|
+
postman collection run ./postman/collections/nada-to-odoo \
|
|
193
|
+
-e ./postman/environments/qa.postman_environment.yaml \
|
|
194
|
+
--env-var "odoo_base_url=http://localhost:3000"
|
|
195
|
+
kill $MOCK_PID
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Spec linting
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# lint a local API specification file
|
|
202
|
+
postman spec lint ./openapi.yaml
|
|
203
|
+
postman spec lint ./openapi.json
|
|
204
|
+
|
|
205
|
+
# lint by specification ID (requires login)
|
|
206
|
+
postman spec lint 12345678-abcd-1234-abcd-1234567890ab
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Flows
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# list all flows
|
|
213
|
+
postman flows list
|
|
214
|
+
|
|
215
|
+
# run a flow from a local file
|
|
216
|
+
postman flows run ./path/to/flow.json
|
|
217
|
+
|
|
218
|
+
# deploy a flow (required before triggering)
|
|
219
|
+
postman flows deploy <flowId>
|
|
220
|
+
|
|
221
|
+
# trigger a deployed flow
|
|
222
|
+
postman flows trigger <flowId>
|
|
223
|
+
|
|
224
|
+
# update a deployed flow's settings
|
|
225
|
+
postman flows update <flowId>
|
|
226
|
+
|
|
227
|
+
# list run history
|
|
228
|
+
postman flows list-runs
|
|
229
|
+
|
|
230
|
+
# analyze a specific flow run
|
|
231
|
+
postman flows get-run
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Workspace sync
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# validate and prepare local collections/environments for push
|
|
238
|
+
postman workspace prepare
|
|
239
|
+
|
|
240
|
+
# push local changes to Postman workspace
|
|
241
|
+
postman workspace push
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Basic
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# version
|
|
248
|
+
postman --version
|
|
249
|
+
|
|
250
|
+
# help
|
|
251
|
+
postman --help
|
|
252
|
+
postman <command> --help
|
|
253
|
+
postman collection run --help
|
|
254
|
+
|
|
255
|
+
# global options (available on all commands)
|
|
256
|
+
postman --silent <command>
|
|
257
|
+
postman --color off <command>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Exit codes
|
|
261
|
+
|
|
262
|
+
- `0` — Success (all tests passed, or for `request`: 2xx-3xx response)
|
|
263
|
+
- `N` — Number of failed tests (e.g., exit code 3 means 3 tests failed)
|
|
264
|
+
- `1` — General error (invalid options, file not found, network error)
|
|
265
|
+
|
|
266
|
+
## Project-specific usage
|
|
267
|
+
|
|
268
|
+
This project stores Postman collections and environments in the `postman/` directory:
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
postman/
|
|
272
|
+
collections/
|
|
273
|
+
nada-to-odoo/ # Nada API calls to Odoo
|
|
274
|
+
delivery.carrier/
|
|
275
|
+
product.template/
|
|
276
|
+
res.partner/
|
|
277
|
+
sale.order/
|
|
278
|
+
stock.location/
|
|
279
|
+
stock.quant/
|
|
280
|
+
odoo-to-nada/ # Odoo webhook push calls to Nada
|
|
281
|
+
environments/
|
|
282
|
+
qa.postman_environment.yaml
|
|
283
|
+
flows/
|
|
284
|
+
globals/
|
|
285
|
+
mocks/
|
|
286
|
+
specs/
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Run the nada-to-odoo collection against QA
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
postman collection run ./postman/collections/nada-to-odoo \
|
|
293
|
+
-e ./postman/environments/qa.postman_environment.yaml \
|
|
294
|
+
--env-var "odoo_base_url=https://odoo-qa.drops.com" \
|
|
295
|
+
--env-var "odoo_db=drops_qa"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Run only the sale.order folder
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
postman collection run ./postman/collections/nada-to-odoo \
|
|
302
|
+
-e ./postman/environments/qa.postman_environment.yaml \
|
|
303
|
+
-i "sale.order" \
|
|
304
|
+
--env-var "odoo_base_url=https://odoo-qa.drops.com"
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Run the odoo-to-nada collection (webhook push tests)
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
postman collection run ./postman/collections/odoo-to-nada \
|
|
311
|
+
-e ./postman/environments/qa.postman_environment.yaml \
|
|
312
|
+
--env-var "nada_base_url=https://nada-qa.drops.me"
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Generate a JSON report for CI
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
postman collection run ./postman/collections/nada-to-odoo \
|
|
319
|
+
-e ./postman/environments/qa.postman_environment.yaml \
|
|
320
|
+
-r cli,json \
|
|
321
|
+
--reporter-json-export ./postman-cli-reports/nada-to-odoo.json
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Quick ad-hoc request to Odoo
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
postman request POST "https://odoo-qa.drops.com/json/2/res.partner/search_read" \
|
|
328
|
+
--auth-bearer-token "$ODOO_API_TOKEN" \
|
|
329
|
+
-H "Content-Type:application/json" \
|
|
330
|
+
-H "X-Odoo-Database:drops_qa" \
|
|
331
|
+
--body '{"domain": [["is_company","=",true]], "fields": ["name","email"], "limit": 5}' \
|
|
332
|
+
--response-only | jq .
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Specific tasks
|
|
336
|
+
|
|
337
|
+
* **Reporters and report customization** [references/reporters.md](references/reporters.md) — Read when generating CI reports, customizing output format, or omitting sensitive data from exports
|
|
338
|
+
* **Request scripting and chaining** [references/request-scripting.md](references/request-scripting.md) — Read when writing post-response scripts, chaining multiple requests, or using the pm.* API
|
|
339
|
+
* **Environment and variable management** [references/environments.md](references/environments.md) — Read when working with environment files, variable precedence, Vault secrets, or CLI overrides
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Environment and Variable Management
|
|
2
|
+
|
|
3
|
+
The Postman CLI resolves `{{variable}}` placeholders in URLs, headers, and request bodies using environment files and CLI overrides.
|
|
4
|
+
|
|
5
|
+
## Variable precedence (highest to lowest)
|
|
6
|
+
|
|
7
|
+
1. `--env-var` CLI overrides
|
|
8
|
+
2. `--global-var` CLI overrides
|
|
9
|
+
3. Environment file (`-e`)
|
|
10
|
+
4. Globals file (`-g`)
|
|
11
|
+
5. Postman Vault secrets (only available when signed in)
|
|
12
|
+
|
|
13
|
+
## Environment files
|
|
14
|
+
|
|
15
|
+
Environment files are YAML or JSON. Specify with `-e`:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
postman collection run ./collection -e ./postman/environments/qa.postman_environment.yaml
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Example environment file (YAML):
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
name: QA
|
|
25
|
+
values:
|
|
26
|
+
- key: odoo_base_url
|
|
27
|
+
value: "https://odoo-qa.drops.com"
|
|
28
|
+
enabled: true
|
|
29
|
+
description: "Base URL without trailing slash"
|
|
30
|
+
- key: odoo_db
|
|
31
|
+
value: "drops_qa"
|
|
32
|
+
enabled: true
|
|
33
|
+
- key: _odoo_partner_id
|
|
34
|
+
value: ""
|
|
35
|
+
enabled: true
|
|
36
|
+
description: "Script-managed — set after running Create Partner"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## CLI variable overrides
|
|
40
|
+
|
|
41
|
+
Override individual variables without modifying the environment file:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# override environment variables
|
|
45
|
+
postman collection run ./collection -e ./env.yaml \
|
|
46
|
+
--env-var "odoo_base_url=https://odoo-staging.drops.com" \
|
|
47
|
+
--env-var "odoo_db=drops_staging"
|
|
48
|
+
|
|
49
|
+
# override global variables
|
|
50
|
+
postman collection run ./collection \
|
|
51
|
+
--global-var "api_version=v2" \
|
|
52
|
+
--global-var "timeout=30000"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Globals files
|
|
56
|
+
|
|
57
|
+
Global variables have lower precedence than environment variables and can be overridden by them:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
postman collection run ./collection -g ./postman/globals/globals.json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Variable resolution in requests
|
|
64
|
+
|
|
65
|
+
Variables are resolved in:
|
|
66
|
+
- URLs: `{{odoo_base_url}}/json/2/sale.order/create`
|
|
67
|
+
- Headers: `Authorization: Bearer {{odoo_api_token}}`
|
|
68
|
+
- Body: `{"partner_id": {{_odoo_partner_id}}}`
|
|
69
|
+
|
|
70
|
+
## Script-managed variables
|
|
71
|
+
|
|
72
|
+
Variables prefixed with `_` are set dynamically during collection runs via scripts:
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
// in post-response script
|
|
76
|
+
pm.environment.set('_odoo_order_id', pm.response.json());
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
These are used to chain requests within a collection run (e.g., create a partner, then use the partner ID to create an order).
|
|
80
|
+
|
|
81
|
+
## Postman Vault
|
|
82
|
+
|
|
83
|
+
Secrets like `vault:odoo_api_token` and `vault:nada_x_odoo_api_key` are stored in the Postman Vault (not in environment files). They are only available when signed in to Postman. For local runs without sign-in, pass secrets via `--env-var`:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
postman collection run ./collection -e ./env.yaml \
|
|
87
|
+
--env-var "odoo_api_token=$ODOO_API_TOKEN"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Exporting variables after a run
|
|
91
|
+
|
|
92
|
+
The Postman CLI does not support exporting the final environment state after a collection run. Script-managed variables (set via `pm.environment.set()`) are only available within the scope of the current run and are not persisted to the environment file.
|