@devassure/cli 1.0.10 → 1.0.13
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 +190 -3
- package/dist/index.js +74 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# DevAssure
|
|
1
|
+
# DevAssure Invisible (QA) Agent CLI
|
|
2
2
|
|
|
3
|
-
Command-line interface for DevAssure
|
|
3
|
+
Command-line interface for DevAssure Invisible (QA) Agent - executes end to end UI tests from natural language instructions and csv files. CLI can be used to run tests by integrating into CI/CD pipelines.
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
- Node.js 18+
|
|
@@ -155,7 +155,7 @@ default:
|
|
|
155
155
|
|
|
156
156
|
### Maintenance
|
|
157
157
|
|
|
158
|
-
- **`devassure cleanup`** - Clean up
|
|
158
|
+
- **`devassure cleanup`** - Clean up execution history to free up space
|
|
159
159
|
- `--retain-days <days>` - Retain sessions from the last N days
|
|
160
160
|
- `--retain-sessions <count>` - Retain the last N sessions
|
|
161
161
|
- If no options provided, prompts to delete all sessions
|
|
@@ -451,6 +451,193 @@ steps:
|
|
|
451
451
|
- Verify if the manager user is added
|
|
452
452
|
```
|
|
453
453
|
|
|
454
|
+
## Library tools
|
|
455
|
+
|
|
456
|
+
Library tools are inbuilt tools that users can include in the project by listing the required tools in a `library.yaml` file.
|
|
457
|
+
|
|
458
|
+
**Sample library.yaml** (e.g. `.devassure/library.yaml`):
|
|
459
|
+
|
|
460
|
+
```yaml
|
|
461
|
+
tools:
|
|
462
|
+
- 'authenticator'
|
|
463
|
+
- 'faker:*'
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### faker
|
|
467
|
+
|
|
468
|
+
Faker provides realistic synthetic data generators for tests:
|
|
469
|
+
|
|
470
|
+
| Tool-key | Description |
|
|
471
|
+
|------|-------------|
|
|
472
|
+
| `*first_name*` | Generate a random first name |
|
|
473
|
+
| `*last_name*` | Generate a random last name |
|
|
474
|
+
| `*full_name*` | Generate a random full name |
|
|
475
|
+
| `*email*` | Generate a random email address |
|
|
476
|
+
| `*phone*` | Generate a random phone number |
|
|
477
|
+
|
|
478
|
+
### authenticator
|
|
479
|
+
|
|
480
|
+
Authenticator provides TOTP (Time-based One-Time Password) helpers:
|
|
481
|
+
|
|
482
|
+
| Tool-key | Description |
|
|
483
|
+
|------|-------------|
|
|
484
|
+
| `get_authenticator_otp` | Generate a TOTP code from an authenticator secret. The authenticator secret must be passed to generate the code. |
|
|
485
|
+
|
|
486
|
+
## Tools
|
|
487
|
+
|
|
488
|
+
Tools let you run custom commands or programs and consume their output. The configuration lives in `.devassure/tools/index.yaml`.
|
|
489
|
+
|
|
490
|
+
**Requirement:** `tools/index.yaml` is required for tools to work. It must exist at `.devassure/tools/index.yaml` (relative to your project path).
|
|
491
|
+
|
|
492
|
+
Tools can run any command or program; the runner executes the command and consumes its output. For custom code or scripts, put the tool code inside the `.devassure/tools` folder and reference the execution command in `tools/index.yaml` (e.g. `exec: node script.js` or `exec: npm run myTool`).
|
|
493
|
+
|
|
494
|
+
**Note:** You can use any programming language or program. You are responsible for setting up dependencies (e.g. Node.js, Python, venv, system binaries).
|
|
495
|
+
|
|
496
|
+
### Mandatory fields
|
|
497
|
+
|
|
498
|
+
Each tool must have **name**, **description**, and **exec**:
|
|
499
|
+
|
|
500
|
+
| Field | Description |
|
|
501
|
+
|-------|-------------|
|
|
502
|
+
| **name** | Unique identifier for the tool (e.g. used when invoking the tool). |
|
|
503
|
+
| **description** | Short description of what the tool does. |
|
|
504
|
+
| **exec** | Command(s) to run. Can be a single line or a multi-line string. Supports `${argName}` substitution for args. |
|
|
505
|
+
|
|
506
|
+
Optional per-tool fields include **cwd** and **args** (see below).
|
|
507
|
+
|
|
508
|
+
**Minimal example:**
|
|
509
|
+
|
|
510
|
+
```yaml
|
|
511
|
+
tools:
|
|
512
|
+
- name: "getProjectDetails"
|
|
513
|
+
description: "Get project details from api"
|
|
514
|
+
cwd: "api-tools"
|
|
515
|
+
args:
|
|
516
|
+
- name: projectId
|
|
517
|
+
type: string
|
|
518
|
+
exec: npm run getProjectDetails ${projectId}
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
- **cwd** (optional): Working directory for the command. It is relative to the **tools folder** (`.devassure/tools`). If omitted, the working directory is the tools folder. Absolute paths are also supported.
|
|
522
|
+
- **args** (optional): List of parameters. Each has `name` and `type`; see [Supported arg types and optional args](#supported-arg-types-and-optional-args) below.
|
|
523
|
+
|
|
524
|
+
### Optional top-level configuration: settings and setup
|
|
525
|
+
|
|
526
|
+
**settings:** Default options applied to every **tool** run and every **setup** step. For all fields except **env**, the value on the tool or setup step is used when present; values in `settings` are fallback when the tool or step does not define that field. For **env**, the list of environment variables is **merged**: settings env vars and the tool/setup step env vars are combined (tool/setup entries override settings when the same key is used).
|
|
527
|
+
|
|
528
|
+
**setup:** Optional list of steps run once per session before scenario executions start (e.g. install dependencies). Each step can specify `name`, `cwd`, `exec`, and any of the settings fields; inheritance from `settings` applies when a step omits a field.
|
|
529
|
+
|
|
530
|
+
### cwd behavior
|
|
531
|
+
|
|
532
|
+
- **Relative:** Resolved from the **tools folder** (e.g. `cwd: "api-tools"` → `.devassure/tools/api-tools`).
|
|
533
|
+
- **Default:** If `cwd` is not provided, the working directory is the tools folder.
|
|
534
|
+
- **Absolute:** Absolute paths are supported (e.g. `cwd: "/opt/scripts"`).
|
|
535
|
+
|
|
536
|
+
### Settings and tool/setup options
|
|
537
|
+
|
|
538
|
+
| Option | Applies to | Description |
|
|
539
|
+
|--------|------------|-------------|
|
|
540
|
+
| **timeoutSec** | Tool / setup | Maximum execution time in seconds (e.g. `10`). |
|
|
541
|
+
| **output.start** / **output.end** | Tool / setup | Markers in stdout; only content **between** these markers is captured as the tool output. Strongly recommended when the process prints a lot of extra content (logs, progress). Your script should print the actual result between these markers. |
|
|
542
|
+
| **env** | Tool / setup | List of `KEY: value` environment variables added or overridden for the process. |
|
|
543
|
+
| **ignore_failure** | Tool / setup | If `true`, a non-zero exit or failure does not fail the run (e.g. optional setup). Default is `false`. |
|
|
544
|
+
|
|
545
|
+
#### Output start and end markers
|
|
546
|
+
|
|
547
|
+
When the command prints a lot of unwanted content (logs, progress, debug), use **output.start** and **output.end** in `settings` (or on the tool). The runner captures only the stdout between these two markers. Print the markers and the necessary output from your script.
|
|
548
|
+
|
|
549
|
+
**JavaScript example:** print the markers, then the result, then the end marker:
|
|
550
|
+
|
|
551
|
+
```javascript
|
|
552
|
+
// In your script (e.g. getProjectDetails.js)
|
|
553
|
+
const startMarker = "__TOOL_OUTPUT_START__";
|
|
554
|
+
const endMarker = "__TOOL_OUTPUT_END__";
|
|
555
|
+
|
|
556
|
+
// ... do work, then:
|
|
557
|
+
console.log(startMarker);
|
|
558
|
+
console.log(JSON.stringify(result));
|
|
559
|
+
console.log(endMarker);
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
In `tools/index.yaml` you would set `output.start` and `output.end` to match (e.g. `__TOOL_OUTPUT_START__` and `__TOOL_OUTPUT_END__`).
|
|
563
|
+
|
|
564
|
+
### Supported arg types and optional args
|
|
565
|
+
|
|
566
|
+
**Supported types:** `string`, `number`, `boolean`, `object`. Use `type` in each arg.
|
|
567
|
+
|
|
568
|
+
**Optional args:** Add `optional: true` to an arg. If not provided, it may be omitted or passed empty depending on how you use it in `exec` (e.g. `"${projectName}"` for an optional string).
|
|
569
|
+
|
|
570
|
+
**Example with multiple types and one optional arg:**
|
|
571
|
+
|
|
572
|
+
```yaml
|
|
573
|
+
tools:
|
|
574
|
+
- name: "exampleTool"
|
|
575
|
+
description: "Example with string, number, boolean, object args"
|
|
576
|
+
args:
|
|
577
|
+
- name: id
|
|
578
|
+
type: string
|
|
579
|
+
- name: count
|
|
580
|
+
type: number
|
|
581
|
+
- name: verbose
|
|
582
|
+
type: boolean
|
|
583
|
+
- name: options
|
|
584
|
+
type: object
|
|
585
|
+
- name: projectName
|
|
586
|
+
type: string
|
|
587
|
+
optional: true
|
|
588
|
+
exec: node run.js ${id} ${count} ${verbose} "${options}" "${projectName}"
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### exec format
|
|
592
|
+
|
|
593
|
+
- **Single line:** `exec: npm run getProjectDetails ${projectId}`
|
|
594
|
+
- **Multi-line:** Use YAML multi-line (e.g. `exec: |` with following lines). Useful for running several commands in sequence (e.g. warmup, main command, cleanup):
|
|
595
|
+
|
|
596
|
+
```yaml
|
|
597
|
+
exec: |
|
|
598
|
+
npm run warmupTestingProcess
|
|
599
|
+
npm run getProjectDetails ${projectId} "${projectName}"
|
|
600
|
+
npm run cleanupTestingProcess
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### Full example (tools/index.yaml)
|
|
604
|
+
|
|
605
|
+
The following example shows **settings** (timeoutSec, output markers, env, ignore_failure), **setup** (one step with cwd and exec), and **tools** with optional arg and multi-line exec:
|
|
606
|
+
|
|
607
|
+
```yaml
|
|
608
|
+
settings:
|
|
609
|
+
timeoutSec: 10
|
|
610
|
+
output:
|
|
611
|
+
start: "__TOOL_OUTPUT_START__"
|
|
612
|
+
end: "__TOOL_OUTPUT_END__"
|
|
613
|
+
env:
|
|
614
|
+
- BUILD_ENV: "dev"
|
|
615
|
+
- DB_NAME: "legacy-db"
|
|
616
|
+
ignore_failure: false
|
|
617
|
+
setup:
|
|
618
|
+
- name: "Install dependencies"
|
|
619
|
+
cwd: "api-tools"
|
|
620
|
+
exec: "npm install"
|
|
621
|
+
tools:
|
|
622
|
+
- name: "getProjectDetails"
|
|
623
|
+
description: "Get project details from api"
|
|
624
|
+
cwd: "api-tools"
|
|
625
|
+
args:
|
|
626
|
+
- name: projectId
|
|
627
|
+
type: string
|
|
628
|
+
- name: projectName
|
|
629
|
+
type: string
|
|
630
|
+
optional: true
|
|
631
|
+
exec: |
|
|
632
|
+
npm run warmupTestingProcess
|
|
633
|
+
npm run getProjectDetails ${projectId} "${projectName}"
|
|
634
|
+
npm run cleanupTestingProcess
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
## Proxy
|
|
638
|
+
|
|
639
|
+
If the `HTTP_PROXY` or `HTTPS_PROXY` environment variables are set, the CLI will use them to proxy requests.
|
|
640
|
+
|
|
454
641
|
## FAQ
|
|
455
642
|
|
|
456
643
|
**How to add new test cases?**
|