prompttest 1.3.2 → 1.3.4
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/README.md +99 -11
- package/dist/bin/prompttest.js +142 -142
- package/dist/index.js +122 -122
- package/dist/lib/recorder.d.ts +19 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
### 📑 Quick Navigation
|
|
17
|
-
- [🚀
|
|
17
|
+
- [🚀 Quick Start & CLI Workflows](#-quick-start--cli-workflows)
|
|
18
|
+
- [📂 Outputs, Reports & Screenshots](#-outputs-reports--screenshots)
|
|
18
19
|
- [✍️ Writing Plain-English Tests](#️-writing-plain-english-tests)
|
|
19
20
|
- [📖 Syntax Reference](#-syntax-reference)
|
|
20
21
|
- [🛠 CLI Command Reference](#-cli-command-reference)
|
|
@@ -38,33 +39,120 @@
|
|
|
38
39
|
|
|
39
40
|
---
|
|
40
41
|
|
|
41
|
-
## 🚀
|
|
42
|
+
## 🚀 Quick Start & CLI Workflows
|
|
42
43
|
|
|
43
44
|
### Prerequisites
|
|
44
45
|
- **Node.js 18.0.0+**
|
|
45
46
|
- **Android ADB** installed and accessible in your system `PATH`
|
|
46
|
-
- An Android device or emulator with **USB Debugging** enabled
|
|
47
|
+
- An Android device (USB or Wi-Fi) or emulator with **USB Debugging** enabled
|
|
47
48
|
|
|
48
|
-
###
|
|
49
|
-
|
|
49
|
+
### Install in Your Mobile Project
|
|
50
|
+
You can run PromptTest instantly with `npx` or install it as a dev dependency:
|
|
51
|
+
```bash
|
|
52
|
+
# In your React Native, Expo, Flutter, or Android project:
|
|
53
|
+
npm install --save-dev prompttest
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### 5 Core CLI Workflows
|
|
59
|
+
|
|
60
|
+
#### 1. Environment Diagnostic Check
|
|
61
|
+
Before running tests, verify your ADB connectivity, connected devices, and permissions:
|
|
50
62
|
```bash
|
|
51
63
|
npx prompttest doctor
|
|
52
64
|
```
|
|
53
65
|
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
#### 2. Zero-Code Autonomous Exploration (AI App Crawl)
|
|
67
|
+
Crawl bottom tabs, lists, and forms automatically to discover bugs, crashes, or React Native red-screens without writing a single line of test code:
|
|
56
68
|
```bash
|
|
57
|
-
npx prompttest explore
|
|
69
|
+
npx prompttest explore com.yourcompany.app
|
|
58
70
|
```
|
|
71
|
+
*Tip: `explore` is its own top-level command. Pass `--max-screens=30` or `--safety-mode=strict` to customize.*
|
|
59
72
|
|
|
60
|
-
|
|
61
|
-
|
|
73
|
+
#### 3. Interactive Record & Replay
|
|
74
|
+
Record your natural interactions on a physical phone directly into a reusable test spec:
|
|
62
75
|
```bash
|
|
63
|
-
|
|
76
|
+
npx prompttest record specs/login.txt
|
|
77
|
+
```
|
|
78
|
+
- Tap buttons and type in input fields on your phone; PromptTest auto-generates conversational English test steps.
|
|
79
|
+
- **Append mode**: Add `--append` to add more steps to an existing spec without overwriting.
|
|
80
|
+
- **Safety backup**: If the target file already exists, PromptTest automatically creates a `.bak` backup before modifying.
|
|
81
|
+
|
|
82
|
+
#### 4. Run Plain-English Test Specs
|
|
83
|
+
Execute test specifications with fail-fast validation and locator self-healing:
|
|
84
|
+
```bash
|
|
85
|
+
npx prompttest run specs/login.txt com.yourcompany.app
|
|
86
|
+
```
|
|
87
|
+
Power flags:
|
|
88
|
+
- `--heal`: Automatically self-heal altered counts and dynamic locators.
|
|
89
|
+
- `--video`: Record an MP4 video of the execution session.
|
|
90
|
+
- `--screenshots`: Capture high-resolution visual evidence at every step.
|
|
91
|
+
- `--fresh`: Cold-restart the target app before execution begins.
|
|
92
|
+
- `--embed-screenshots`: Embed screenshots directly into a standalone, shareable HTML report.
|
|
93
|
+
|
|
94
|
+
#### 5. Interactive Live REPL Playground
|
|
95
|
+
Experiment with commands live in your terminal against your connected device:
|
|
96
|
+
```bash
|
|
97
|
+
npx prompttest repl com.yourcompany.app
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### ⚠️ CLI Command Disambiguation Table
|
|
103
|
+
|
|
104
|
+
To avoid common syntax errors, remember that `explore`, `record`, and `repl` are **standalone commands**:
|
|
105
|
+
|
|
106
|
+
| Goal | ✅ Correct CLI Command | ❌ Common Mistake |
|
|
107
|
+
| :--- | :--- | :--- |
|
|
108
|
+
| **Autonomous App Crawling** | `npx prompttest explore <pkg>` | `npx prompttest run explore` |
|
|
109
|
+
| **Record from Phone Touches** | `npx prompttest record <spec.txt>` | `npx prompttest run record` |
|
|
110
|
+
| **Run Existing Spec File** | `npx prompttest run <spec.txt> [pkg]` | `npx prompttest <spec.txt>` |
|
|
111
|
+
| **Interactive Live Terminal** | `npx prompttest repl [pkg]` | `npx prompttest run repl` |
|
|
112
|
+
| **Diagnostic Health Check** | `npx prompttest doctor` | `npx prompttest run doctor` |
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### 📦 Recommended `package.json` Scripts
|
|
117
|
+
|
|
118
|
+
Add these convenient shortcuts to your project's `package.json`:
|
|
119
|
+
```json
|
|
120
|
+
"scripts": {
|
|
121
|
+
"test:mobile": "prompttest run specs/smoke.txt com.yourcompany.app --heal",
|
|
122
|
+
"test:explore": "prompttest explore com.yourcompany.app --max-screens=25",
|
|
123
|
+
"test:record": "prompttest record specs/new_flow.txt",
|
|
124
|
+
"test:doctor": "prompttest doctor"
|
|
125
|
+
}
|
|
64
126
|
```
|
|
65
127
|
|
|
66
128
|
---
|
|
67
129
|
|
|
130
|
+
## 📂 Outputs, Reports & Screenshots
|
|
131
|
+
|
|
132
|
+
Whenever PromptTest runs (`run`, `explore`, or `record`), all outputs are automatically organized inside an **`output/`** folder at your project root:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
your-mobile-project/
|
|
136
|
+
├── node_modules/
|
|
137
|
+
├── specs/
|
|
138
|
+
│ └── login.txt
|
|
139
|
+
├── output/ <-- 📂 Created automatically
|
|
140
|
+
│ ├── login-report.html <-- 🌐 Interactive visual HTML report
|
|
141
|
+
│ ├── login-junit.xml <-- 🤖 CI/CD JUnit test results
|
|
142
|
+
│ ├── login-report.md <-- 📝 Markdown summary for PR comments
|
|
143
|
+
│ ├── login-results.json <-- 📊 Structured raw JSON execution metrics
|
|
144
|
+
│ ├── step_1_tap_sign_in.png <-- 📸 High-res visual screenshots
|
|
145
|
+
│ ├── login-recording.mp4 <-- 🎥 Full MP4 video (when using --video)
|
|
146
|
+
│ └── screenshots/ <-- 📸 Screen transition photos from record sessions
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Viewing & Sharing Reports:
|
|
150
|
+
- **Interactive HTML Dashboard (`output/<spec>-report.html`)**: Double-click to open in any browser. Features step-by-step audit timelines, latency timings, and failure triage bundles.
|
|
151
|
+
- **CI/CD Integration (`output/<spec>-junit.xml`)**: Standard JUnit format natively recognized by GitHub Actions, GitLab CI, Jenkins, and CircleCI.
|
|
152
|
+
- **Zero-Dependency Sharing (`--embed-screenshots`)**: Generates a single standalone HTML report with all images inlined via Base64 data URIs. Email or Slack it directly to teammates without missing image links!
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
68
156
|
## ✍️ Writing Plain-English Tests
|
|
69
157
|
|
|
70
158
|
Test specifications are simple text files containing numbered steps written in conversational English.
|