testronaut 1.0.2 β†’ 1.0.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.
Files changed (2) hide show
  1. package/README.md +133 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,133 @@
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 field with ${process.env.USERNAME} and password field with ${process.env.PASSWORD}.
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
+
59
+ Pass in credentials using an .env file
60
+
61
+ You can chain multiple phases:
62
+
63
+ ```
64
+ import { runMissions } from 'testronaut';
65
+ import { loginMission } from './login.mission.js';
66
+ import { logoutMission } from './logout.mission.js';
67
+ import { navigateToContactFormMission } from './navigateToContactForm.mission.js';
68
+
69
+ export const fillContactFormMission =
70
+ `Input the text "example@example.com" in the email field.
71
+ Input the phone number (555)555-5555 into the phone number field.
72
+ Click the submit button.
73
+ Upon submission success there should be a toast notification indicating the form information was saved successfully.
74
+ If found, report SUCCESS. Otherwise, report FAILURE.`
75
+
76
+ export async function executeMission() {
77
+ await runMissions({
78
+ preMission: [loginMission, navigateToContactFormMission],
79
+ mission: fillContactFormMission,
80
+ postMission: logoutMission,
81
+ });
82
+ }
83
+ ```
84
+
85
+ ### πŸƒ Running Missions
86
+ Run all missions in the missions/ directory:
87
+
88
+ ```
89
+ testronaut
90
+ ```
91
+ Run a specific file:
92
+
93
+ ```
94
+ testronaut missions/login.mission.js
95
+ ```
96
+
97
+ 🧰 Available Helpers
98
+
99
+ ```
100
+ runMissions({ preMission, mission, postMission })
101
+ ```
102
+ – Runs test phases
103
+
104
+ ```
105
+ mission(name, fn) and objective(desc, workflow)
106
+ ```
107
+ – Optional suite syntax
108
+
109
+ ```
110
+ runSuite(objectives)
111
+ ```
112
+ – Executes all registered test objectives
113
+
114
+ ### πŸ§ͺ Under the Hood
115
+ Uses Playwright for browser automation
116
+
117
+ Interacts with OpenAI’s GPT-4o via Function Calling
118
+
119
+ Supports modular tool definitions via CHROME_TOOL_MAP
120
+
121
+ πŸ”§ Developing Locally
122
+ Clone and install locally:
123
+
124
+ ```
125
+ npm install
126
+ npm link
127
+ ```
128
+ Now you can use testronaut in any local project.
129
+
130
+ ### πŸ“„ License
131
+ MIT
132
+
133
+ πŸ€– Built with ❀️ by Shane Fast
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testronaut",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
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": "ISC",
19
+ "license": "MIT",
20
20
  "description": "",
21
21
  "dependencies": {
22
22
  "@dqbd/tiktoken": "^1.0.21",