@nhonh/qabot 0.6.0 → 0.6.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Hoài Nhớ
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 ADDED
@@ -0,0 +1,406 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/QABot-AI%20Powered%20QA-7c3aed?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0id2hpdGUiPjxwYXRoIGQ9Ik05LjQgMTYuNkw0LjggMTJsNC42LTQuNkw4IDZsLTYgNiA2IDYgMS40LTEuNHptNS4yIDBsNC42LTQuNi00LjYtNC42TDE2IDZsNiA2LTYgNi0xLjQtMS40eiIvPjwvc3ZnPg==&logoColor=white" alt="QABot" />
3
+ </p>
4
+
5
+ <h1 align="center">QABot</h1>
6
+
7
+ <p align="center">
8
+ <strong>AI-Powered Universal QA Automation Tool</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ Import any project. AI analyzes structure. Run tests across all layers. Zero config.
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://www.npmjs.com/package/@nhonh/qabot"><img src="https://img.shields.io/npm/v/@nhonh/qabot?color=cb3837&logo=npm" alt="npm version" /></a>
17
+ <a href="https://www.npmjs.com/package/@nhonh/qabot"><img src="https://img.shields.io/npm/dw/@nhonh/qabot?color=cb3837&logo=npm&label=downloads%2Fweek" alt="npm downloads/week" /></a>
18
+ <a href="https://www.npmjs.com/package/@nhonh/qabot"><img src="https://img.shields.io/npm/dt/@nhonh/qabot?color=cb3837&logo=npm&label=total%20downloads" alt="total downloads" /></a>
19
+ <a href="https://github.com/hoainho/qabot/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@nhonh/qabot?color=blue" alt="license" /></a>
20
+ <a href="https://nodejs.org"><img src="https://img.shields.io/node/v/@nhonh/qabot?color=339933&logo=node.js&logoColor=white" alt="node version" /></a>
21
+ <a href="https://github.com/hoainho/qabot"><img src="https://img.shields.io/github/stars/hoainho/qabot?style=social" alt="GitHub stars" /></a>
22
+ </p>
23
+
24
+ ---
25
+
26
+ ## Why QABot?
27
+
28
+ Testing is the most critical part of software development, but setting up and maintaining test infrastructure across frameworks, layers, and environments is painfully repetitive. **QABot eliminates that friction.**
29
+
30
+ Point QABot at **any** project — React, Next.js, Vue, Angular, .NET, Python, or Node.js — and it will **auto-detect** your framework, test runners, features, and environments. Then it runs tests across **unit, integration, and E2E layers** from a single CLI. Need test cases? QABot's AI engine analyzes your code and **generates production-ready tests** using OpenAI, Claude, Gemini, or 4 other providers.
31
+
32
+ ---
33
+
34
+ ## Features
35
+
36
+ - **AI-Powered Test Analysis** — AI analyzes your source code and generates comprehensive test cases. Supports OpenAI, Anthropic Claude, Google Gemini, DeepSeek, Groq, Ollama (local), and custom proxy endpoints.
37
+
38
+ - **Smart Project Detection** — Auto-detects project type (React, Next.js, Vue, Angular, .NET, Python, Node.js), framework, bundler, state management, and auth provider. Zero configuration needed.
39
+
40
+ - **Universal Test Runner** — Runs Jest, Vitest, Playwright, Cypress, pytest, xUnit, and dotnet-test from a single CLI. No more switching between different test commands.
41
+
42
+ - **Beautiful HTML Reports** — Generates interactive HTML + JSON reports with pass/fail/skip statistics, duration tracking, and historical run comparison.
43
+
44
+ - **E2E Test Generation** — AI generates Playwright E2E tests from feature descriptions with automatic error detection and self-healing fix capabilities.
45
+
46
+ - **Multi-Layer Testing** — Run unit, integration, and E2E tests separately or together. Filter by layer with `--layer unit` or run everything at once.
47
+
48
+ - **Environment Management** — Detect and switch between local, staging, and production environments. Each environment gets its own config and credentials.
49
+
50
+ - **Use Case Driven** — Import use cases from Markdown, Gherkin Feature files, or plain text docs. Map them directly to test coverage.
51
+
52
+ - **Extensible Runner System** — Plugin-based architecture makes it easy to add support for new test frameworks. Each runner extends a common `BaseRunner` interface.
53
+
54
+ - **Multi-AI Provider** — Switch AI providers instantly. Configure during `qabot init` or change anytime in `qabot.config.json`. Supports 7 providers including local Ollama.
55
+
56
+ ---
57
+
58
+ ## Quick Start
59
+
60
+ ### Install
61
+
62
+ ```bash
63
+ # Install globally
64
+ npm install -g @nhonh/qabot
65
+
66
+ # Or use npx (no install needed)
67
+ npx @nhonh/qabot --help
68
+ ```
69
+
70
+ ### Initialize
71
+
72
+ ```bash
73
+ cd your-project
74
+ qabot init
75
+ ```
76
+
77
+ QABot scans your project and generates a `qabot.config.json`:
78
+
79
+ ```
80
+ ╔═══════════════════════════════════╗
81
+ ║ QABot - Project Analysis ║
82
+ ╠═══════════════════════════════════╣
83
+ ║ Project: my-react-app ║
84
+ ║ Type: react-spa ║
85
+ ║ Framework: React 18 ║
86
+ ║ Runners: Jest, Playwright ║
87
+ ║ Features: 12 detected ║
88
+ ║ Unit Tests: 45 files ║
89
+ ║ E2E Tests: 8 files ║
90
+ ╚═══════════════════════════════════╝
91
+ ```
92
+
93
+ ### Run Tests
94
+
95
+ ```bash
96
+ # Run all tests
97
+ qabot run
98
+
99
+ # Run tests for a specific feature
100
+ qabot run auth
101
+
102
+ # Run only unit tests
103
+ qabot run --layer unit
104
+
105
+ # Run E2E tests against staging
106
+ qabot run --layer e2e --env staging
107
+
108
+ # Run with coverage
109
+ qabot run --coverage
110
+
111
+ # Verbose output
112
+ qabot run --verbose
113
+ ```
114
+
115
+ ### Generate Tests with AI
116
+
117
+ ```bash
118
+ # Generate test cases for a feature
119
+ qabot generate login
120
+
121
+ # Generate E2E tests
122
+ qabot generate checkout --layer e2e
123
+ ```
124
+
125
+ ---
126
+
127
+ ## CLI Commands
128
+
129
+ | Command | Description |
130
+ |---|---|
131
+ | `qabot init` | Analyze project and generate configuration |
132
+ | `qabot init -y` | Initialize with all defaults (no prompts) |
133
+ | `qabot run [feature]` | Run tests for all or a specific feature |
134
+ | `qabot run --layer <layers>` | Run specific test layers (unit, integration, e2e) |
135
+ | `qabot test` | Run tests with advanced options |
136
+ | `qabot list` | Show detected features, test frameworks, and coverage |
137
+ | `qabot generate <feature>` | AI-generate test cases for a feature |
138
+ | `qabot report` | Open the latest HTML test report |
139
+ | `qabot auth` | Configure authentication for E2E tests |
140
+
141
+ ---
142
+
143
+ ## Supported Frameworks
144
+
145
+ | Category | Supported |
146
+ |---|---|
147
+ | **Frontend** | React, Next.js, Vue, Angular |
148
+ | **Backend** | Node.js, .NET, Python |
149
+ | **Test Runners** | Jest, Vitest, Playwright, Cypress, pytest, xUnit, dotnet-test |
150
+ | **AI Providers** | OpenAI, Anthropic Claude, Google Gemini, DeepSeek, Groq, Ollama, Custom Proxy |
151
+ | **Languages** | JavaScript, TypeScript, Python, C# |
152
+ | **Package Managers** | npm, yarn, pnpm, pip, dotnet |
153
+
154
+ ---
155
+
156
+ ## Multi-Layer Testing
157
+
158
+ QABot organizes tests into three distinct layers, each serving a specific purpose:
159
+
160
+ ### Unit Tests
161
+ Validate individual functions, components, and modules in isolation. Fast feedback loop, run in milliseconds.
162
+
163
+ ```bash
164
+ qabot run --layer unit
165
+ ```
166
+
167
+ ### Integration Tests
168
+ Test how modules interact with each other, including API calls, database queries, and service communication.
169
+
170
+ ```bash
171
+ qabot run --layer integration
172
+ ```
173
+
174
+ ### E2E Tests
175
+ Full user journey simulation in a real browser. Tests the complete application stack from the user's perspective.
176
+
177
+ ```bash
178
+ qabot run --layer e2e --env staging
179
+ ```
180
+
181
+ ### Test Priority System
182
+
183
+ QABot assigns priorities to help you focus on what matters most:
184
+
185
+ | Priority | Meaning | Example |
186
+ |---|---|---|
187
+ | **P0** | Critical — Must pass before deploy | Login, Payment, Core API |
188
+ | **P1** | High — Important user journeys | Registration, Search, Profile |
189
+ | **P2** | Medium — Standard features | Settings, Notifications |
190
+ | **P3** | Low — Edge cases and cosmetic | Tooltips, Animations |
191
+
192
+ ---
193
+
194
+ ## AI Test Generation
195
+
196
+ QABot's AI engine doesn't just suggest test names — it generates **complete, runnable test code**.
197
+
198
+ ### How It Works
199
+
200
+ 1. **Analyze** — AI reads your source code and understands component behavior, API contracts, and edge cases
201
+ 2. **Generate** — Produces full test files compatible with your test runner (Jest, Vitest, Playwright, etc.)
202
+ 3. **Auto-Fix** — If generated tests fail on first run, AI reads the error output and automatically fixes the code
203
+ 4. **Batch Support** — Handles large codebases by batching test generation (up to 8 test cases per batch)
204
+
205
+ ### Supported AI Providers
206
+
207
+ | Provider | Model | Setup |
208
+ |---|---|---|
209
+ | **OpenAI** | GPT-4o | `OPENAI_API_KEY` |
210
+ | **Anthropic** | Claude Sonnet 4 | `ANTHROPIC_API_KEY` |
211
+ | **Google** | Gemini 2.5 Flash | `GEMINI_API_KEY` |
212
+ | **DeepSeek** | DeepSeek Chat | `DEEPSEEK_API_KEY` |
213
+ | **Groq** | Llama 3.3 70B | `GROQ_API_KEY` |
214
+ | **Ollama** | Llama 3 (local) | No key needed |
215
+ | **Custom Proxy** | Any model | `PROXY_API_KEY` + `baseUrl` |
216
+
217
+ Configure during initialization:
218
+
219
+ ```bash
220
+ qabot init
221
+ # Select your AI provider when prompted
222
+ ```
223
+
224
+ Or set in `qabot.config.json`:
225
+
226
+ ```json
227
+ {
228
+ "ai": {
229
+ "provider": "anthropic",
230
+ "model": "claude-sonnet-4-20250514",
231
+ "apiKeyEnv": "ANTHROPIC_API_KEY"
232
+ }
233
+ }
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Configuration
239
+
240
+ QABot uses a `qabot.config.json` file in your project root. Generated automatically by `qabot init`.
241
+
242
+ ```json
243
+ {
244
+ "project": {
245
+ "name": "my-app",
246
+ "type": "react-spa"
247
+ },
248
+ "environments": {
249
+ "local": { "url": "http://localhost:3000" },
250
+ "staging": { "url": "https://staging.myapp.com" }
251
+ },
252
+ "layers": {
253
+ "unit": {
254
+ "runner": "jest",
255
+ "command": "npx jest {pattern}",
256
+ "testMatch": "**/*.test.*"
257
+ },
258
+ "e2e": {
259
+ "runner": "playwright",
260
+ "command": "npx playwright test {pattern}",
261
+ "testDir": "e2e/tests"
262
+ }
263
+ },
264
+ "features": {
265
+ "auth": { "src": "src/features/auth", "priority": "P0" },
266
+ "dashboard": { "src": "src/pages/Dashboard", "priority": "P1" },
267
+ "settings": { "src": "src/pages/Settings", "priority": "P2" }
268
+ },
269
+ "reporting": {
270
+ "outputDir": "./qabot-reports",
271
+ "openAfterRun": true,
272
+ "history": true,
273
+ "formats": ["html", "json"]
274
+ },
275
+ "ai": {
276
+ "provider": "openai",
277
+ "model": "gpt-4o",
278
+ "apiKeyEnv": "OPENAI_API_KEY"
279
+ },
280
+ "useCases": {
281
+ "dir": "./docs/use-cases",
282
+ "formats": ["md", "feature", "txt"]
283
+ }
284
+ }
285
+ ```
286
+
287
+ ---
288
+
289
+ ## Reports
290
+
291
+ QABot generates beautiful interactive reports after each test run:
292
+
293
+ - **HTML Report** — Visual dashboard with pass/fail charts, duration breakdown, and test details
294
+ - **JSON Report** — Machine-readable results for CI/CD integration
295
+ - **Historical Tracking** — Compare results across runs to spot regressions
296
+ - **Auto-Open** — Reports open in your browser automatically (configurable)
297
+
298
+ View reports anytime:
299
+
300
+ ```bash
301
+ qabot report
302
+ ```
303
+
304
+ Reports are saved to `./qabot-reports/` organized by date and feature.
305
+
306
+ ---
307
+
308
+ ## Environment Variables
309
+
310
+ Create a `.env` file in your project root (see `.env.example`):
311
+
312
+ ```env
313
+ # AI Providers (set the one you use)
314
+ OPENAI_API_KEY=sk-your-key-here
315
+ ANTHROPIC_API_KEY=sk-ant-your-key-here
316
+ GEMINI_API_KEY=your-gemini-key-here
317
+ DEEPSEEK_API_KEY=your-deepseek-key-here
318
+ GROQ_API_KEY=gsk_your-groq-key-here
319
+ PROXY_API_KEY=your-proxy-key-here
320
+
321
+ # E2E Test Credentials
322
+ E2E_TEST_EMAIL=testuser@example.com
323
+ E2E_TEST_PASSWORD=your-test-password
324
+ ```
325
+
326
+ ---
327
+
328
+ ## Architecture
329
+
330
+ ```
331
+ qabot/
332
+ ├── bin/
333
+ │ └── qabot.js # CLI entry point
334
+ ├── src/
335
+ │ ├── ai/ # AI engine & prompt builders
336
+ │ │ ├── ai-engine.js # Multi-provider AI client
337
+ │ │ ├── prompt-builder.js # Test analysis/generation prompts
338
+ │ │ └── usecase-parser.js # Use case file parser
339
+ │ ├── analyzers/ # Project analysis
340
+ │ │ ├── project-analyzer.js
341
+ │ │ ├── test-detector.js
342
+ │ │ ├── feature-detector.js
343
+ │ │ └── env-detector.js
344
+ │ ├── cli/commands/ # CLI command handlers
345
+ │ ├── core/ # Config, constants, logger
346
+ │ ├── e2e/ # E2E test generation
347
+ │ ├── executor/ # Test execution engine
348
+ │ ├── reporter/ # HTML/JSON report generation
349
+ │ ├── runners/ # Test framework runners
350
+ │ │ ├── base-runner.js # Runner interface
351
+ │ │ ├── jest-runner.js
352
+ │ │ ├── vitest-runner.js
353
+ │ │ ├── playwright-runner.js
354
+ │ │ ├── pytest-runner.js
355
+ │ │ └── dotnet-runner.js
356
+ │ └── utils/
357
+ ├── templates/ # Config templates
358
+ └── tests/ # QABot's own test suite
359
+ ```
360
+
361
+ ---
362
+
363
+ ## Contributing
364
+
365
+ Contributions are welcome! Here's how to get started:
366
+
367
+ 1. Fork the repository
368
+ 2. Create a feature branch: `git checkout -b feature/my-feature`
369
+ 3. Make your changes
370
+ 4. Run the test suite: `npm test`
371
+ 5. Commit your changes: `git commit -m "feat: add my feature"`
372
+ 6. Push to the branch: `git push origin feature/my-feature`
373
+ 7. Open a Pull Request
374
+
375
+ ### Development
376
+
377
+ ```bash
378
+ git clone https://github.com/hoainho/qabot.git
379
+ cd qabot
380
+ npm install
381
+ npm test
382
+ npm run dev
383
+ ```
384
+
385
+ ---
386
+
387
+ ## Roadmap
388
+
389
+ - [ ] GitHub Actions integration (auto-run on PR)
390
+ - [ ] Slack/Discord notifications for test results
391
+ - [ ] Visual regression testing support
392
+ - [ ] Test coverage mapping and gap analysis
393
+ - [ ] Custom reporter plugins
394
+ - [ ] CI/CD pipeline templates
395
+
396
+ ---
397
+
398
+ ## License
399
+
400
+ [MIT](./LICENSE) - Copyright (c) 2025 Hoai Nho
401
+
402
+ ---
403
+
404
+ <p align="center">
405
+ Made with ❤️ by <a href="https://github.com/hoainho">Hoai Nho</a>
406
+ </p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nhonh/qabot",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "AI-powered universal QA automation tool. Import any project, AI analyzes and runs tests across all layers.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -28,8 +28,16 @@
28
28
  "test-report",
29
29
  "cli"
30
30
  ],
31
- "author": "GearGames",
31
+ "author": "Hoài Nhớ <nhoxtvt@gmail.com> (https://github.com/hoainho)",
32
32
  "license": "MIT",
33
+ "homepage": "https://hoainho.github.io/qabot",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/hoainho/qabot.git"
37
+ },
38
+ "bugs": {
39
+ "url": "https://github.com/hoainho/qabot/issues"
40
+ },
33
41
  "engines": {
34
42
  "node": ">=18.0.0"
35
43
  },
@@ -33,6 +33,7 @@ export function registerTestCommand(program) {
33
33
  .option("--headed", "Run browser in headed mode (visible)")
34
34
  .option("--no-fix", "Skip auto-fix on failure")
35
35
  .option("--skip-gen", "Skip test generation, run existing specs only")
36
+ .option("-u, --url <url>", "Target URL (overrides environment config)")
36
37
  .option("--use-cases <dir>", "Directory containing use case documents")
37
38
  .option("--model <model>", "AI model to use")
38
39
  .option("-d, --dir <path>", "Project directory", process.cwd())
@@ -51,7 +52,7 @@ async function runTest(feature, options) {
51
52
  const profile = await analyzeProject(projectDir);
52
53
  const envConfig =
53
54
  config.environments?.[options.env] || config.environments?.default;
54
- const baseUrl = envConfig?.url || "http://localhost:3000";
55
+ const baseUrl = options.url || envConfig?.url || "http://localhost:3000";
55
56
 
56
57
  logger.header("QABot \u2014 E2E Automation Test");
57
58
  logger.blank();
@@ -1,4 +1,4 @@
1
- export const VERSION = "0.6.0";
1
+ export const VERSION = "0.6.1";
2
2
  export const TOOL_NAME = "qabot";
3
3
 
4
4
  export const PROJECT_TYPES = [