testdriverai 6.0.23 → 6.0.24-canary.fffd04a.0
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/.github/workflows/acceptance-tests.yml +5 -1
- package/docs/action/ami.mdx +4 -3
- package/docs/action/performance.mdx +26 -8
- package/docs/action/secrets.mdx +11 -31
- package/docs/apps/chrome-extensions.mdx +1 -1
- package/docs/apps/desktop-apps.mdx +11 -8
- package/docs/apps/static-websites.mdx +7 -7
- package/docs/bugs/jira.mdx +12 -75
- package/docs/cli/overview.mdx +6 -6
- package/docs/commands/exec.mdx +32 -37
- package/docs/commands/focus-application.mdx +13 -2
- package/docs/commands/hover-image.mdx +29 -5
- package/docs/commands/hover-text.mdx +10 -16
- package/docs/commands/if.mdx +24 -21
- package/docs/commands/match-image.mdx +17 -9
- package/docs/commands/press-keys.mdx +55 -3
- package/docs/commands/remember.mdx +13 -9
- package/docs/commands/run.mdx +10 -4
- package/docs/commands/scroll-until-image.mdx +25 -11
- package/docs/commands/scroll-until-text.mdx +17 -10
- package/docs/commands/scroll.mdx +22 -8
- package/docs/commands/type.mdx +6 -6
- package/docs/commands/wait-for-image.mdx +20 -7
- package/docs/commands/wait-for-text.mdx +14 -12
- package/docs/commands/wait.mdx +8 -1
- package/docs/docs.json +4 -6
- package/docs/exporting/junit.mdx +3 -3
- package/docs/exporting/playwright.mdx +2 -2
- package/docs/features/auto-healing.mdx +3 -3
- package/docs/features/generation.mdx +2 -4
- package/docs/features/parallel-testing.mdx +3 -13
- package/docs/features/reusable-snippets.mdx +3 -3
- package/docs/features/selectorless.mdx +8 -2
- package/docs/features/visual-assertions.mdx +2 -2
- package/docs/getting-started/ci.mdx +42 -51
- package/docs/getting-started/cli.mdx +3 -9
- package/docs/getting-started/editing.mdx +13 -10
- package/docs/getting-started/running.mdx +7 -2
- package/docs/getting-started/vscode.mdx +4 -7
- package/docs/guide/assertions.mdx +2 -4
- package/docs/guide/authentication.mdx +8 -10
- package/docs/guide/code.mdx +14 -12
- package/docs/guide/environment-variables.mdx +13 -12
- package/docs/guide/lifecycle.mdx +39 -31
- package/docs/guide/variables.mdx +30 -20
- package/docs/guide/waiting.mdx +2 -2
- package/docs/importing/csv.mdx +3 -4
- package/docs/importing/jira.mdx +6 -12
- package/docs/importing/testrail.mdx +6 -6
- package/docs/integrations/electron.mdx +30 -56
- package/docs/integrations/netlify.mdx +9 -12
- package/docs/integrations/vercel.mdx +6 -42
- package/docs/interactive/explore.mdx +8 -10
- package/docs/interactive/run.mdx +9 -4
- package/docs/interactive/save.mdx +2 -2
- package/docs/overview/comparison.mdx +68 -60
- package/docs/overview/performance.mdx +0 -1
- package/docs/overview/what-is-testdriver.mdx +1 -1
- package/docs/scenarios/log-in.mdx +2 -2
- package/docs/security/platform.mdx +4 -2
- package/docs/snippets/test-prereqs.mdx +1 -1
- package/docs/snippets/tests/assert-replay.mdx +7 -5
- package/docs/snippets/tests/assert-yaml.mdx +2 -3
- package/docs/snippets/tests/exec-js-replay.mdx +7 -5
- package/docs/snippets/tests/exec-js-yaml.mdx +3 -4
- package/docs/snippets/tests/exec-shell-replay.mdx +7 -5
- package/docs/snippets/tests/exec-shell-yaml.mdx +4 -5
- package/docs/snippets/tests/hover-image-replay.mdx +7 -5
- package/docs/snippets/tests/hover-image-yaml.mdx +4 -6
- package/docs/snippets/tests/hover-text-replay.mdx +7 -5
- package/docs/snippets/tests/hover-text-with-description-replay.mdx +7 -5
- package/docs/snippets/tests/hover-text-with-description-yaml.mdx +4 -10
- package/docs/snippets/tests/hover-text-yaml.mdx +2 -3
- package/docs/snippets/tests/match-image-replay.mdx +7 -5
- package/docs/snippets/tests/match-image-yaml.mdx +6 -6
- package/docs/snippets/tests/press-keys-replay.mdx +7 -5
- package/docs/snippets/tests/press-keys-yaml.mdx +5 -6
- package/docs/snippets/tests/remember-replay.mdx +7 -5
- package/docs/snippets/tests/remember-yaml.mdx +25 -6
- package/docs/snippets/tests/scroll-replay.mdx +7 -5
- package/docs/snippets/tests/scroll-until-image-replay.mdx +7 -0
- package/docs/snippets/tests/scroll-until-image-yaml.mdx +14 -0
- package/docs/snippets/tests/scroll-until-text-replay.mdx +7 -5
- package/docs/snippets/tests/scroll-until-text-yaml.mdx +4 -8
- package/docs/snippets/tests/scroll-yaml.mdx +4 -13
- package/docs/snippets/tests/type-repeated-replay.mdx +7 -5
- package/docs/snippets/tests/type-repeated-yaml.mdx +2 -3
- package/docs/snippets/tests/type-replay.mdx +7 -5
- package/docs/snippets/tests/type-yaml.mdx +2 -5
- package/docs/snippets/tests/wait-for-image-replay.mdx +7 -0
- package/docs/snippets/tests/wait-for-image-yaml.mdx +18 -0
- package/docs/snippets/tests/wait-for-text-replay.mdx +7 -0
- package/docs/snippets/tests/wait-for-text-yaml.mdx +18 -0
- package/docs/snippets/tests/wait-replay.mdx +7 -0
- package/docs/snippets/tests/wait-yaml.mdx +13 -0
- package/docs/styles.css +46 -0
- package/package.json +3 -9
- package/testdriver/edge-cases/prompt-nested.yaml +2 -1
- package/docs/action/setup.mdx +0 -120
- package/docs/interactive/assert.mdx +0 -65
- package/docs/interactive/dry.mdx +0 -58
- package/docs/interactive/generate.mdx +0 -55
- package/docs/interactive/undo.mdx +0 -58
- package/docs/snippets/comments.mdx +0 -1
- package/docs/snippets/tests/prompt-replay.mdx +0 -5
- package/docs/snippets/tests/prompt-yaml.mdx +0 -10
- package/docs/snippets/yml-warning.mdx +0 -4
|
@@ -14,7 +14,11 @@ jobs:
|
|
|
14
14
|
gather-test-files:
|
|
15
15
|
name: Gather Test Files
|
|
16
16
|
runs-on: ubuntu-latest
|
|
17
|
-
if:
|
|
17
|
+
if: >
|
|
18
|
+
(github.event_name == 'workflow_dispatch') ||
|
|
19
|
+
(github.ref == 'refs/heads/main') ||
|
|
20
|
+
(github.event_name == 'pull_request_review' &&
|
|
21
|
+
(github.event.review.state == 'approved' || github.event.review.state == 'changes_requested'))
|
|
18
22
|
outputs:
|
|
19
23
|
test_files: ${{ steps.test_list.outputs.files }}
|
|
20
24
|
steps:
|
package/docs/action/ami.mdx
CHANGED
|
@@ -6,9 +6,10 @@ icon: "image"
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<Tip>
|
|
9
|
-
This guide is specifically for
|
|
10
|
-
to the shared TestDriver AMI.
|
|
11
|
-
your account manager for more
|
|
9
|
+
This guide is specifically for [Enterprise Plan
|
|
10
|
+
customers](/account/enterprise) who have access to the shared TestDriver AMI.
|
|
11
|
+
If you are on a different plan, please contact your account manager for more
|
|
12
|
+
information.
|
|
12
13
|
</Tip>
|
|
13
14
|
|
|
14
15
|
<Steps>
|
|
@@ -28,15 +28,28 @@ Parallel testing allows you to split your test actions into multiple files and r
|
|
|
28
28
|
manageable pieces. To run multiple separate tests, use a test matrix strategy.
|
|
29
29
|
</Warning>
|
|
30
30
|
|
|
31
|
-
Example
|
|
31
|
+
#### Example
|
|
32
32
|
|
|
33
|
-
```yaml
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
```yaml .github/workflows/testdriver.yaml focus={3-9, 14}
|
|
34
|
+
run tests:
|
|
35
|
+
name: Run tests in parallel
|
|
36
|
+
strategy:
|
|
37
|
+
matrix:
|
|
38
|
+
test_file:
|
|
39
|
+
- tests/login.yaml
|
|
40
|
+
- tests/search.yaml
|
|
41
|
+
- tests/cart.yaml
|
|
42
|
+
steps:
|
|
43
|
+
- name: Checkout repository
|
|
44
|
+
uses: actions/checkout@v4
|
|
45
|
+
|
|
46
|
+
- name: Run the tests
|
|
47
|
+
run: npx testdriverai@latest run testdriver/${{ matrix.test_file }}
|
|
48
|
+
env:
|
|
49
|
+
FORCE_COLOR: 3
|
|
50
|
+
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
51
|
+
TD_WEBSITE: https://testdriver-sandbox.vercel.app
|
|
52
|
+
TD_THIS_FILE: ${{ matrix.test }}
|
|
40
53
|
```
|
|
41
54
|
|
|
42
55
|
---
|
|
@@ -55,6 +68,11 @@ action: click
|
|
|
55
68
|
method: turbo
|
|
56
69
|
```
|
|
57
70
|
|
|
71
|
+
<Note>
|
|
72
|
+
`turbo` is the default method that is currently implemented. The other method
|
|
73
|
+
being `ai`
|
|
74
|
+
</Note>
|
|
75
|
+
|
|
58
76
|
---
|
|
59
77
|
|
|
60
78
|
### 3. Use `async` asserts
|
package/docs/action/secrets.mdx
CHANGED
|
@@ -25,8 +25,8 @@ To securely use secrets in your TestDriver test files, replace hardcoded values
|
|
|
25
25
|
|
|
26
26
|
### Example test file
|
|
27
27
|
|
|
28
|
-
```yaml
|
|
29
|
-
version:
|
|
28
|
+
```yaml login.yaml highlight={11, 12, 21, 22}
|
|
29
|
+
version: 6.0.0
|
|
30
30
|
steps:
|
|
31
31
|
- prompt: sign in with username and password
|
|
32
32
|
commands:
|
|
@@ -48,6 +48,10 @@ steps:
|
|
|
48
48
|
action: click
|
|
49
49
|
- command: type
|
|
50
50
|
text: ${TD_PASSWORD}
|
|
51
|
+
- command: hover-text
|
|
52
|
+
text: Log In
|
|
53
|
+
description: log in button
|
|
54
|
+
action: click
|
|
51
55
|
```
|
|
52
56
|
|
|
53
57
|
---
|
|
@@ -69,42 +73,18 @@ For detailed instructions, refer to the [GitHub Docs on using secrets](https://d
|
|
|
69
73
|
|
|
70
74
|
When running TestDriver tests via the CLI in GitHub Actions, supply your secrets in the `env` section of the workflow step.
|
|
71
75
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
permissions:
|
|
78
|
-
actions: read
|
|
79
|
-
contents: read
|
|
80
|
-
statuses: write
|
|
81
|
-
pull-requests: write
|
|
82
|
-
|
|
83
|
-
jobs:
|
|
84
|
-
test:
|
|
85
|
-
name: "TestDriver"
|
|
86
|
-
steps:
|
|
87
|
-
- name: Check out repository
|
|
88
|
-
uses: actions/checkout@v4
|
|
89
|
-
|
|
90
|
-
- name: Run TestDriver
|
|
91
|
-
run: npx testdriverai@latest run tests/signin.yaml --headless
|
|
92
|
-
env:
|
|
93
|
-
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
94
|
-
TD_USERNAME: ${{ secrets.TD_USERNAME }}
|
|
95
|
-
TD_PASSWORD: ${{ secrets.TD_PASSWORD }}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
---
|
|
76
|
+
<Card title="Adding secrets to CI" icon="link" href="/guide/authentication">
|
|
77
|
+
Check out our authentication page to see how to add secrets in your CI
|
|
78
|
+
workflow.
|
|
79
|
+
</Card>
|
|
99
80
|
|
|
100
81
|
## Best practices
|
|
101
82
|
|
|
102
83
|
- **Use Descriptive Names**: Name your secrets clearly (for example, `TD_USERNAME`, `TD_PASSWORD`) to make them easy to identify.
|
|
103
84
|
- **Rotate Secrets Regularly**: Update your secrets periodically to enhance security.
|
|
104
85
|
- **Limit Access**: Only provide access to secrets for workflows and team members that require them.
|
|
105
|
-
- **Mask Secrets**: Ensure all secrets are masked in logs by using the `TD_` prefix.
|
|
106
86
|
|
|
107
|
-
|
|
87
|
+
## <Note>To ensure all secrets are masked in logs, use the `TD_` prefix.</Note>
|
|
108
88
|
|
|
109
89
|
## Notes
|
|
110
90
|
|
|
@@ -29,7 +29,7 @@ TestDriver provides a powerful solution for testing Chrome extensions. With our
|
|
|
29
29
|
|
|
30
30
|
## Getting started
|
|
31
31
|
|
|
32
|
-
You can test a preinstalled extension or test by installing an extension. If the extension is in development mode, turn this on by checking the "Developer mode" checkbox in the Chrome extensions page. From there you can load the unpacked extension by selecting the folder where your extension is located. To download the files onto the VM if you are performing a test on cloud hosted runners, see the [Lifecycle](/guide/lifecycle
|
|
32
|
+
You can test a preinstalled extension or test by installing an extension. If the extension is in development mode, turn this on by checking the "Developer mode" checkbox in the Chrome extensions page. From there you can load the unpacked extension by selecting the folder where your extension is located. To download the files onto the VM if you are performing a test on cloud hosted runners, see the [Lifecycle](/guide/lifecycle) docs.
|
|
33
33
|
|
|
34
34
|
## Sample test steps
|
|
35
35
|
|
|
@@ -46,28 +46,29 @@ TestDriver supports a wide range of desktop applications, including:
|
|
|
46
46
|
|
|
47
47
|
## Installation
|
|
48
48
|
|
|
49
|
-
To use TestDriver with desktop applications, no special setup is needed. Simply run the local agent to interact with applications on your local machine, or add instructions to `
|
|
49
|
+
To use TestDriver with desktop applications, no special setup is needed. Simply run the local agent to interact with applications on your local machine, or add instructions to `provision.yaml` to tell the runner to launch or install the application. Here is an example that performs a calculation on a calculator app:
|
|
50
50
|
|
|
51
|
-
```yaml
|
|
52
|
-
version:
|
|
51
|
+
```yaml testdriver/lifecycle/provision.yaml
|
|
52
|
+
version: 6.0.0
|
|
53
53
|
steps:
|
|
54
54
|
- prompt: launch a calculator
|
|
55
55
|
commands:
|
|
56
56
|
- command: exec
|
|
57
57
|
lang: pwsh
|
|
58
|
-
code:
|
|
58
|
+
code: |
|
|
59
|
+
start /B calc.exe
|
|
59
60
|
timeout /t 5
|
|
60
61
|
- command: wait-for-text
|
|
61
62
|
text: "calculator"
|
|
62
63
|
timeout: 30000
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
A `
|
|
66
|
+
A `calculator.yaml` file might look like this:
|
|
66
67
|
|
|
67
|
-
```yaml
|
|
68
|
-
version:
|
|
68
|
+
```yaml calculator.yaml
|
|
69
|
+
version: 6.0.0
|
|
69
70
|
steps:
|
|
70
|
-
- prompt:
|
|
71
|
+
- prompt: perform the operation 2 + 2 = on the calculator that is opened
|
|
71
72
|
commands:
|
|
72
73
|
- command: focus-application
|
|
73
74
|
name: galculator
|
|
@@ -83,6 +84,8 @@ steps:
|
|
|
83
84
|
- command: hover-image
|
|
84
85
|
description: equals button on the calculator
|
|
85
86
|
action: click
|
|
87
|
+
- command: assert
|
|
88
|
+
expected: 4 is displayed as the result
|
|
86
89
|
```
|
|
87
90
|
|
|
88
91
|
## Conclusion
|
|
@@ -28,27 +28,27 @@ To get started with testing static websites using TestDriver, follow these steps
|
|
|
28
28
|
1. [**Follow our quick start guide to set up your TestDriver account.**](/getting-started/setup)
|
|
29
29
|
2. **Create a new test project** in your TestDriver dashboard.
|
|
30
30
|
3. **Add your static website URL** to the test settings.
|
|
31
|
-
It looks like this in the `
|
|
31
|
+
It looks like this in the `provision.yaml` file:
|
|
32
32
|
|
|
33
|
-
```yaml
|
|
34
|
-
version:
|
|
33
|
+
```yaml testdriver/lifecycle/provision.yaml
|
|
34
|
+
version: 6.0.0
|
|
35
35
|
steps:
|
|
36
36
|
- prompt: launch chrome
|
|
37
37
|
commands:
|
|
38
38
|
- command: exec
|
|
39
39
|
lang: pwsh
|
|
40
|
-
code:
|
|
40
|
+
code: |
|
|
41
41
|
Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "${TD_WEBSITE}"
|
|
42
42
|
exit
|
|
43
43
|
- command: wait-for-text
|
|
44
|
-
text:
|
|
44
|
+
text: ${TD_WEBSITE}
|
|
45
45
|
timeout: 30000
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
Set the `TD_WEBSITE` environment variable to the URL of your static website. This will allow TestDriver to launch the browser and navigate to your website. You can do this by adding this `
|
|
48
|
+
Set the `TD_WEBSITE` environment variable to the URL of your static website. This will allow TestDriver to launch the browser and navigate to your website. You can do this by adding this `provision.yaml` file to your project or by simply using:
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
51
|
npx testdriverai@latest init
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Running init will create the `
|
|
54
|
+
Running init will create the `provision.yaml` file for you and ask you which website to load with your test.
|
package/docs/bugs/jira.mdx
CHANGED
|
@@ -42,9 +42,9 @@ This guide explains how to integrate the **TestDriver CLI** with the **Jira GitH
|
|
|
42
42
|
|
|
43
43
|
Here's a complete workflow that integrates TestDriver and Jira:
|
|
44
44
|
|
|
45
|
-
### Workflow File:
|
|
45
|
+
### Workflow File:
|
|
46
46
|
|
|
47
|
-
```yaml [expandable]
|
|
47
|
+
```yaml .github/workflows/testdriver-jira.yaml [expandable]
|
|
48
48
|
name: TestDriver with Jira Integration
|
|
49
49
|
|
|
50
50
|
on:
|
|
@@ -69,10 +69,11 @@ jobs:
|
|
|
69
69
|
|
|
70
70
|
- name: Run TestDriver
|
|
71
71
|
id: testdriver
|
|
72
|
+
shell: powershell
|
|
72
73
|
run: |
|
|
73
74
|
$exitCode = 0
|
|
74
75
|
try {
|
|
75
|
-
npx testdriverai@latest run testdriver/test.yaml --
|
|
76
|
+
npx testdriverai@latest run testdriver/test.yaml --summary="testdriver-summary.txt"
|
|
76
77
|
} catch {
|
|
77
78
|
$exitCode = $LASTEXITCODE
|
|
78
79
|
}
|
|
@@ -86,22 +87,21 @@ jobs:
|
|
|
86
87
|
}
|
|
87
88
|
env:
|
|
88
89
|
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
89
|
-
shell: powershell
|
|
90
90
|
|
|
91
91
|
- name: Check for Test Failures
|
|
92
92
|
id: check-failures
|
|
93
|
+
shell: powershell
|
|
93
94
|
run: |
|
|
94
95
|
if ("${{ steps.testdriver.outputs.success }}" -eq "false") {
|
|
95
96
|
echo "TestDriver tests failed."
|
|
96
97
|
echo "failure=true" >> $env:GITHUB_ENV
|
|
97
98
|
|
|
98
99
|
# Copy the output file for Jira ticket
|
|
99
|
-
Copy-Item testdriver-
|
|
100
|
+
Copy-Item testdriver-summary.txt failure-details.txt
|
|
100
101
|
} else {
|
|
101
102
|
echo "All tests passed."
|
|
102
103
|
echo "failure=false" >> $env:GITHUB_ENV
|
|
103
104
|
}
|
|
104
|
-
shell: powershell
|
|
105
105
|
|
|
106
106
|
- name: Upload test results
|
|
107
107
|
if: always()
|
|
@@ -109,7 +109,7 @@ jobs:
|
|
|
109
109
|
with:
|
|
110
110
|
name: testdriver-results
|
|
111
111
|
path: |
|
|
112
|
-
testdriver-
|
|
112
|
+
testdriver-summary.txt
|
|
113
113
|
failure-details.txt
|
|
114
114
|
|
|
115
115
|
create-jira-ticket:
|
|
@@ -152,15 +152,14 @@ jobs:
|
|
|
152
152
|
|
|
153
153
|
### 1. **Run Tests with TestDriver CLI**
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
This step runs the TestDriver CLI with the `testdriver/test.yaml` file.
|
|
156
156
|
|
|
157
|
-
```yaml
|
|
157
|
+
```yaml testdriver/test.yaml
|
|
158
158
|
- name: Run TestDriver
|
|
159
159
|
id: testdriver
|
|
160
|
-
run: npx testdriverai@latest run testdriver/test.yaml
|
|
160
|
+
run: npx testdriverai@latest run testdriver/test.yaml
|
|
161
161
|
env:
|
|
162
162
|
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
163
|
-
shell: powershell
|
|
164
163
|
```
|
|
165
164
|
|
|
166
165
|
---
|
|
@@ -169,7 +168,7 @@ The TestDriver CLI runs your tests in headless mode using the `--headless` flag.
|
|
|
169
168
|
|
|
170
169
|
This step checks the exit code and success status from the TestDriver CLI run. If the tests failed, it sets an environment variable (`failure=true`) to trigger the Jira ticket creation step and prepares the output file for the Jira ticket.
|
|
171
170
|
|
|
172
|
-
```yaml
|
|
171
|
+
```yaml testdriver/test.yaml
|
|
173
172
|
- name: Check for Test Failures
|
|
174
173
|
id: check-failures
|
|
175
174
|
run: |
|
|
@@ -195,7 +194,7 @@ If any tests failed, the `create-jira-ticket` job uses the `atlassian/gajira-cre
|
|
|
195
194
|
- **Summary**: A brief description of the failure with repository information.
|
|
196
195
|
- **Description**: Detailed information about the failure, including repository details, workflow run links, and the captured test output.
|
|
197
196
|
|
|
198
|
-
```yaml
|
|
197
|
+
```yaml testdriver/test.yaml
|
|
199
198
|
- name: Create Jira Ticket
|
|
200
199
|
uses: atlassian/gajira-create@v3
|
|
201
200
|
with:
|
|
@@ -231,65 +230,3 @@ Add the following secrets to your GitHub repository:
|
|
|
231
230
|
4. **`JIRA_USERNAME`**: Your Jira account email.
|
|
232
231
|
|
|
233
232
|
---
|
|
234
|
-
|
|
235
|
-
## Lifecycle files
|
|
236
|
-
|
|
237
|
-
TestDriver supports lifecycle files to customize test execution at different phases. These files replace the previous `prerun` parameter from the GitHub Action and provide more comprehensive control over the test environment.
|
|
238
|
-
|
|
239
|
-
The main lifecycle files are:
|
|
240
|
-
|
|
241
|
-
- **`lifecycle/provision.yaml`**: Executed when a new sandbox is created
|
|
242
|
-
- **`lifecycle/prerun.yaml`**: Executed before tests run (replaces the old `prerun` parameter)
|
|
243
|
-
- **`lifecycle/postrun.yaml`**: Executed after tests complete
|
|
244
|
-
|
|
245
|
-
<Note>
|
|
246
|
-
These lifecycle files should be placed in your repository's `lifecycle/`
|
|
247
|
-
directory and will be automatically executed by TestDriver during the
|
|
248
|
-
appropriate phases.
|
|
249
|
-
</Note>
|
|
250
|
-
|
|
251
|
-
For detailed information about lifecycle files, including complete examples and best practices, see the [Lifecycle Files guide](/guide/lifecycle).
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
|
|
255
|
-
## Example Jira ticket
|
|
256
|
-
|
|
257
|
-
### Summary:
|
|
258
|
-
|
|
259
|
-
`TestDriver Test Failure in mycompany/myproject`
|
|
260
|
-
|
|
261
|
-
### Description:
|
|
262
|
-
|
|
263
|
-
```
|
|
264
|
-
A test failure occurred during the TestDriver workflow.
|
|
265
|
-
|
|
266
|
-
**Repository**: mycompany/myproject
|
|
267
|
-
**Branch**: refs/heads/main
|
|
268
|
-
**Commit**: abc123def456
|
|
269
|
-
**Workflow Run**: https://github.com/mycompany/myproject/actions/runs/123456789
|
|
270
|
-
|
|
271
|
-
**Failure Details**:
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
TestDriver CLI execution failed
|
|
275
|
-
Error: Test 'Login Test' failed - element not found
|
|
276
|
-
Exit code: 1
|
|
277
|
-
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
Please investigate the issue and resolve it promptly.
|
|
281
|
-
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
## Benefits of this workflow
|
|
287
|
-
|
|
288
|
-
1. **Automated Issue Tracking**: Automatically creates Jira tickets for test failures, ensuring no issues are overlooked.
|
|
289
|
-
2. **Detailed Context**: Includes test output, repository information, and workflow run links in the Jira ticket for easier debugging.
|
|
290
|
-
3. **Streamlined Workflow**: Integrates testing and issue tracking into a single automated pipeline.
|
|
291
|
-
4. **Flexible Lifecycle Management**: Supports custom setup, provisioning, and cleanup through lifecycle files.
|
|
292
|
-
|
|
293
|
-
---
|
|
294
|
-
|
|
295
|
-
By combining TestDriver CLI with Jira GitHub Actions, you can automate the process of tracking test failures, improving collaboration and ensuring faster resolution of issues.
|
package/docs/cli/overview.mdx
CHANGED
|
@@ -15,20 +15,20 @@ npx testdriverai@latest <command> [options]
|
|
|
15
15
|
|
|
16
16
|
## Available commands
|
|
17
17
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
18
|
+
| Command | Description |
|
|
19
|
+
| :--------------------: | :----------------------------------------------------------- |
|
|
20
20
|
| [`run`](/commands/run) | Executes a TestDriver test. |
|
|
21
|
-
| `edit`
|
|
22
|
-
| `help`
|
|
21
|
+
| [`edit`](/commands/edit) | Launch interactive mode. |
|
|
22
|
+
| [`help`](/commands/help) | Displays help information for the CLI or a specific command. |
|
|
23
23
|
|
|
24
24
|
## Available Flags
|
|
25
25
|
|
|
26
26
|
| Flag | Description |
|
|
27
|
-
|
|
|
27
|
+
| :------------------ | :----------------------------------------------------------------------------------------- |
|
|
28
28
|
| `--heal` | Launch exploratory mode and attemp to recover if an error or failing state is encountered. |
|
|
29
29
|
| `--write` | Ovewrite test file with new commands resulting from agentic testing |
|
|
30
30
|
| `--headless` | Run test without opening a browser window (useful for CI/CD environments) |
|
|
31
|
-
| `--new
|
|
31
|
+
| `--new` | Create a new sandbox environment for the test run. |
|
|
32
32
|
| `--summary=<value>` | Output file where AI summary should be saved. |
|
|
33
33
|
|
|
34
34
|
## Example usage
|
package/docs/commands/exec.mdx
CHANGED
|
@@ -18,29 +18,29 @@ The `exec` command allows you to execute custom Node.js scripts within your Test
|
|
|
18
18
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
|
-
| Argument |
|
|
22
|
-
|
|
|
23
|
-
|
|
|
21
|
+
| Argument | Type | Description |
|
|
22
|
+
| :------: | :------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `lang` | `string` | The language of the script to execute. Supported values are `pwsh` and `js`. |
|
|
24
24
|
| `output` | `string` | The variable name to store the result of the script. This variable can be accessed as `${OUTPUT.<var>}` in future steps. |
|
|
25
|
-
|
|
|
26
|
-
| `
|
|
25
|
+
| `code` | `string` | The script to execute on Windows systems. For `js`, the script must define the output as `result`. |
|
|
26
|
+
| `silent` | `string` | Defaults to `false`. The command will print the output of the script. This is useful for suppressing unnecessary or private output in the test logs and it's useful for debugging. |
|
|
27
27
|
|
|
28
28
|
## Example usage
|
|
29
29
|
|
|
30
30
|
This example demonstrates how to use the `exec` command to generate a TOTP (Time-based One-Time Password) using the `totp-generator` library.
|
|
31
31
|
|
|
32
|
-
```yaml
|
|
33
|
-
version:
|
|
32
|
+
```yaml otp-generator.yaml
|
|
33
|
+
version: 6.0.0
|
|
34
34
|
steps:
|
|
35
35
|
- commands:
|
|
36
36
|
- command: exec
|
|
37
37
|
lang: pwsh
|
|
38
|
-
|
|
38
|
+
code: |
|
|
39
39
|
npm install totp-generator
|
|
40
40
|
- command: exec
|
|
41
41
|
lang: js
|
|
42
42
|
output: totp
|
|
43
|
-
|
|
43
|
+
code: |
|
|
44
44
|
const { TOTP } = require("totp-generator");
|
|
45
45
|
let otp = TOTP.generate("JBSWY3DPEB3W64TMMQQQ").otp;
|
|
46
46
|
console.log(otp);
|
|
@@ -51,19 +51,16 @@ steps:
|
|
|
51
51
|
|
|
52
52
|
## Additional details
|
|
53
53
|
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
- `
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
- Otherwise, the `shell` code can be used within test steps to launch applications or perform simple commands (like writing text to a file on the machine to perform a simple file upload).
|
|
60
|
-
- Code specified in `linux`, `mac`, and `windows` is executed based on the platform of the runner machine.
|
|
54
|
+
- Supported `lang` values are `js` or `pwsh`:
|
|
55
|
+
- `js` code is executed in a Node.js [VM](https://nodejs.org/api/vm.html) internally on the host machine (for example the machine where your CI/CD runs, or your computer if using the local agent).
|
|
56
|
+
- `pwsh` code is executed in the shell on target runner (which can be the cloud runner, local sandbox, or local machine, depending on where you run your tests).
|
|
57
|
+
- **Note:** You can also use `pwsh` in [lifecycle](/guide/lifecycle) scripts to install npm packages if you need them.
|
|
58
|
+
- Otherwise, the `pwsh` code can be used within test steps to launch applications or perform simple commands (like writing text to a file on the machine to perform a simple file upload).
|
|
61
59
|
- The `output`argument is assigned automatically by setting `result = somestringvalue` in the script you run.
|
|
62
60
|
|
|
63
61
|
## Protips
|
|
64
62
|
|
|
65
63
|
- The `result` variable is already available in your script, overwrite it to store the output as shown in the examples.
|
|
66
|
-
- Node.js code executes in the same context as the calling process on the host machine, using the [VM](https://nodejs.org/api/vm.html) module internally.
|
|
67
64
|
- Do any handling of arrays or nested objects within your `js` script:
|
|
68
65
|
- ✅ `result = users[1].profile.firstName`
|
|
69
66
|
- ✅ `result = data.length > 0 ? data[0].userEmail : 'no user found'` if no data is found the value of output will be `null`
|
|
@@ -79,21 +76,19 @@ steps:
|
|
|
79
76
|
|
|
80
77
|
## Ways to use `exec`
|
|
81
78
|
|
|
82
|
-
Here is an example using both `
|
|
79
|
+
Here is an example using both `pwsh` and `js` contexts within a `prerun.yaml` script which creates a temporary email account and automatically clicks links found in received emails.
|
|
83
80
|
|
|
84
81
|
```yaml ./lifecycle/prerun.yaml [expandable]
|
|
85
|
-
version:
|
|
82
|
+
version: 6.0.0
|
|
86
83
|
steps:
|
|
87
84
|
- commands:
|
|
88
85
|
- command: exec
|
|
89
86
|
lang: pwsh
|
|
90
|
-
silent: false
|
|
91
87
|
code: |
|
|
92
88
|
npm install @sendgrid/mail
|
|
93
89
|
- command: exec
|
|
94
90
|
lang: js
|
|
95
91
|
output: accountData
|
|
96
|
-
silent: false
|
|
97
92
|
code: |
|
|
98
93
|
const Mailjs = require("@cemalgnlts/mailjs");
|
|
99
94
|
const mailjs = new Mailjs();
|
|
@@ -103,7 +98,6 @@ steps:
|
|
|
103
98
|
- command: exec
|
|
104
99
|
lang: js
|
|
105
100
|
output: emailAddress
|
|
106
|
-
silent: false
|
|
107
101
|
code: |
|
|
108
102
|
const accountData = ${OUTPUT.accountData};
|
|
109
103
|
result = accountData.username
|
|
@@ -119,7 +113,6 @@ steps:
|
|
|
119
113
|
commands:
|
|
120
114
|
- command: exec
|
|
121
115
|
lang: js
|
|
122
|
-
silent: false
|
|
123
116
|
code: |
|
|
124
117
|
const Mailjs = require("@cemalgnlts/mailjs");
|
|
125
118
|
const { JSDOM } = require('jsdom'); // To parse HTML and extract links
|
|
@@ -174,23 +167,24 @@ steps:
|
|
|
174
167
|
getLatestEmailAndClickLinks();
|
|
175
168
|
```
|
|
176
169
|
|
|
177
|
-
### Using `exec`
|
|
170
|
+
### Using `exec` pwsh commands in a test file
|
|
178
171
|
|
|
179
|
-
In a test file, you can use the `
|
|
172
|
+
In a test file, you can use the `pwsh` context directly:
|
|
180
173
|
|
|
181
|
-
```yaml
|
|
182
|
-
version:
|
|
174
|
+
```yaml calculator.yaml highlight={5-8} [expandable]
|
|
175
|
+
version: 6.0.0
|
|
183
176
|
steps:
|
|
184
177
|
- prompt: launch a calculator
|
|
185
178
|
commands:
|
|
186
179
|
- command: exec
|
|
187
180
|
lang: pwsh
|
|
188
|
-
code:
|
|
181
|
+
code: |
|
|
182
|
+
start /B calc.exe
|
|
189
183
|
timeout /t 5
|
|
190
184
|
- command: wait-for-text
|
|
191
185
|
text: "calculator"
|
|
192
186
|
timeout: 30000
|
|
193
|
-
- prompt:
|
|
187
|
+
- prompt: performing the operation 2 + 2 = on the calculator that is opened
|
|
194
188
|
commands:
|
|
195
189
|
- command: focus-application
|
|
196
190
|
name: galculator
|
|
@@ -212,14 +206,15 @@ steps:
|
|
|
212
206
|
|
|
213
207
|
You can also save reusable snippets (like launching the calculator) to be inserted into a script later with the [`run`](/commands/run) command. That version would look something like this:
|
|
214
208
|
|
|
215
|
-
```yaml
|
|
216
|
-
version:
|
|
209
|
+
```yaml snippets/launch-calculator.yaml [expandable]
|
|
210
|
+
version: 6.0.0
|
|
217
211
|
steps:
|
|
218
212
|
- prompt: launch a calculator
|
|
219
213
|
commands:
|
|
220
214
|
- command: exec
|
|
221
215
|
lang: pwsh
|
|
222
|
-
code:
|
|
216
|
+
code: |
|
|
217
|
+
start /B calc.exe
|
|
223
218
|
timeout /t 5
|
|
224
219
|
- command: wait-for-text
|
|
225
220
|
text: "calculator"
|
|
@@ -228,14 +223,14 @@ steps:
|
|
|
228
223
|
|
|
229
224
|
Then in the test:
|
|
230
225
|
|
|
231
|
-
```yaml {5-6}
|
|
232
|
-
version:
|
|
226
|
+
```yaml calculator.yaml highlight={5-6} [expandable]
|
|
227
|
+
version: 6.0.0
|
|
233
228
|
steps:
|
|
234
229
|
- prompt: launch a calculator
|
|
235
230
|
commands:
|
|
236
231
|
- command: run
|
|
237
|
-
file:
|
|
238
|
-
- prompt:
|
|
232
|
+
file: snippets/launch-calculator.yaml
|
|
233
|
+
- prompt: performing the operation 2 + 2 = on the calculator that is opened
|
|
239
234
|
commands:
|
|
240
235
|
- command: focus-application
|
|
241
236
|
name: galculator
|
|
@@ -258,7 +253,7 @@ steps:
|
|
|
258
253
|
This example will fail at runtime, so don't try to execute `js` context directly in a test file. Remember - use this in `prerun` to setup your test!
|
|
259
254
|
|
|
260
255
|
```yaml badtestfile.yaml [expandable]
|
|
261
|
-
version:
|
|
256
|
+
version: 6.0.0
|
|
262
257
|
commands:
|
|
263
258
|
- command: exec
|
|
264
259
|
lang: pwsh
|
|
@@ -3,11 +3,12 @@ title: "focus-application"
|
|
|
3
3
|
sidebarTitle: "focus-application"
|
|
4
4
|
description: "Bring a specific application window to the foreground."
|
|
5
5
|
icon: "window-restore"
|
|
6
|
+
mode: "wide"
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
## Description
|
|
9
10
|
|
|
10
|
-
The `focus-application` command
|
|
11
|
+
The `focus-application` command displays a specific application window to the foreground. This ensures that subsequent commands interact with the correct application during a test.
|
|
11
12
|
|
|
12
13
|
## Arguments
|
|
13
14
|
|
|
@@ -26,8 +27,18 @@ name: Google Chrome
|
|
|
26
27
|
|
|
27
28
|
- Ensure the application name matches the exact name displayed in your operating system's task manager.
|
|
28
29
|
- Use this command at the start of a test or before interacting with an application to avoid focus-related issues.
|
|
29
|
-
- If the specified application isn't running, the command will fail. Ensure the application is open before using this command.
|
|
30
30
|
|
|
31
|
+
<Note>
|
|
32
|
+
If the specified application isn't running, the command will fail. Ensure the application is open before using this command.
|
|
33
|
+
For example, to launch chrome try using the exec command:
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
- command: exec
|
|
37
|
+
lang: pwsh
|
|
38
|
+
code: start chrome
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
</Note>
|
|
31
42
|
## Notes
|
|
32
43
|
|
|
33
44
|
- The `focus-application` command is useful for multi-application workflows where you need to switch between different apps during a test.
|