testronaut 1.0.2 β 1.0.3
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 +130 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# π§βπ Testronaut
|
|
2
|
+
|
|
3
|
+
**Testronaut** is an autonomous testing framework powered by OpenAI function calling and browser automation. It allows you to define mission-based tests in plain English, then runs them through a real browser to validate UI workflows.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## π Features
|
|
8
|
+
|
|
9
|
+
- Run real-world UI flows using missions written as plain strings or functions
|
|
10
|
+
- Execute entire suites with `runMissions`
|
|
11
|
+
- Uses GPT-4o + Playwright to reason and interact with your app
|
|
12
|
+
- Dynamic DOM injection and retry logic
|
|
13
|
+
- Built-in throttling for OpenAI rate limits
|
|
14
|
+
- Modular design β define tools and memory handling as you like
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## π¦ Installation
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
npm install -g testronaut
|
|
22
|
+
```
|
|
23
|
+
Or use with npx:
|
|
24
|
+
```
|
|
25
|
+
npx testronaut
|
|
26
|
+
```
|
|
27
|
+
π Directory Structure
|
|
28
|
+
Your project should include a missions/ folder with mission files like:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
missions/
|
|
32
|
+
βββ login.mission.js
|
|
33
|
+
βββ logout.mission.js
|
|
34
|
+
βββ dashboard.mission.js
|
|
35
|
+
```
|
|
36
|
+
Each file exports a mission string or function and invokes runMissions.
|
|
37
|
+
|
|
38
|
+
### βοΈ Writing a Mission File
|
|
39
|
+
Create a file in your missions/ directory, e.g. missions/login.mission.js:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
import { runMissions } from 'testronaut';
|
|
43
|
+
|
|
44
|
+
export const loginMission = `
|
|
45
|
+
Click on the login button.
|
|
46
|
+
Fill in the username and password fields.
|
|
47
|
+
Submit the form.
|
|
48
|
+
Wait for the dashboard to appear.
|
|
49
|
+
Report SUCCESS if the dashboard is loaded, otherwise report FAILURE.
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
export async function executeMission() {
|
|
53
|
+
await runMissions({
|
|
54
|
+
mission: loginMission
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
You can chain multiple phases:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
import { runMissions } from 'testronaut';
|
|
62
|
+
import { loginMission } from './login.mission.js';
|
|
63
|
+
import { logoutMission } from './logout.mission.js';
|
|
64
|
+
import { navigateToContactFormMission } from './navigateToContactForm.mission.js';
|
|
65
|
+
|
|
66
|
+
export const fillContactFormMission =
|
|
67
|
+
`Input the text "example@example.com" in the email field.
|
|
68
|
+
Input the phone number (555)555-5555 into the phone number field.
|
|
69
|
+
Click the submit button.
|
|
70
|
+
Upon submission success there should be a toast notification indicating the form information was saved successfully.
|
|
71
|
+
If found, report SUCCESS. Otherwise, report FAILURE.`
|
|
72
|
+
|
|
73
|
+
export async function executeMission() {
|
|
74
|
+
await runMissions({
|
|
75
|
+
preMission: [loginMission, navigateToContactFormMission],
|
|
76
|
+
mission: fillContactFormMission,
|
|
77
|
+
postMission: logoutMission,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### π Running Missions
|
|
83
|
+
Run all missions in the missions/ directory:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
testronaut
|
|
87
|
+
```
|
|
88
|
+
Run a specific file:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
testronaut missions/login.mission.js
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
π§° Available Helpers
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
runMissions({ preMission, mission, postMission })
|
|
98
|
+
```
|
|
99
|
+
β Runs test phases
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
mission(name, fn) and objective(desc, workflow)
|
|
103
|
+
```
|
|
104
|
+
β Optional suite syntax
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
runSuite(objectives)
|
|
108
|
+
```
|
|
109
|
+
β Executes all registered test objectives
|
|
110
|
+
|
|
111
|
+
### π§ͺ Under the Hood
|
|
112
|
+
Uses Playwright for browser automation
|
|
113
|
+
|
|
114
|
+
Interacts with OpenAIβs GPT-4o via Function Calling
|
|
115
|
+
|
|
116
|
+
Supports modular tool definitions via CHROME_TOOL_MAP
|
|
117
|
+
|
|
118
|
+
π§ Developing Locally
|
|
119
|
+
Clone and install locally:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
npm install
|
|
123
|
+
npm link
|
|
124
|
+
```
|
|
125
|
+
Now you can use testronaut in any local project.
|
|
126
|
+
|
|
127
|
+
### π License
|
|
128
|
+
MIT
|
|
129
|
+
|
|
130
|
+
π€ Built with β€οΈ by Shane Fast
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testronaut",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"main": "./runner/testronaut.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"testronaut": "./bin/cli.js"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"start": "node ./bin/cli.js"
|
|
17
17
|
},
|
|
18
18
|
"author": "",
|
|
19
|
-
"license": "
|
|
19
|
+
"license": "MIT",
|
|
20
20
|
"description": "",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@dqbd/tiktoken": "^1.0.21",
|