testdriverai 5.3.13 → 5.3.15

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 (148) hide show
  1. package/agent.js +18 -16
  2. package/docs/30x30.mdx +1 -1
  3. package/docs/action/secrets.mdx +1 -1
  4. package/docs/commands/assert.mdx +4 -4
  5. package/docs/commands/exec.mdx +33 -23
  6. package/docs/commands/focus-application.mdx +3 -3
  7. package/docs/commands/hover-image.mdx +6 -6
  8. package/docs/commands/hover-text.mdx +3 -3
  9. package/docs/commands/if.mdx +1 -1
  10. package/docs/commands/match-image.mdx +4 -4
  11. package/docs/commands/run.mdx +1 -1
  12. package/docs/commands/scroll-until-image.mdx +6 -3
  13. package/docs/commands/scroll-until-text.mdx +3 -3
  14. package/docs/commands/type.mdx +1 -1
  15. package/docs/commands/wait-for-image.mdx +1 -1
  16. package/docs/commands/wait-for-text.mdx +1 -1
  17. package/docs/docs.json +1 -1
  18. package/docs/features/auto-healing.mdx +1 -1
  19. package/docs/features/cross-platform.mdx +1 -1
  20. package/docs/features/generation.mdx +76 -142
  21. package/docs/features/parallel-testing.mdx +1 -1
  22. package/docs/features/selectorless.mdx +1 -1
  23. package/docs/getting-started/generating.mdx +90 -30
  24. package/docs/getting-started/vscode.mdx +1 -1
  25. package/docs/guide/assertions.mdx +1 -1
  26. package/docs/guide/authentication.mdx +10 -26
  27. package/docs/guide/code.mdx +31 -141
  28. package/docs/guide/lifecycle.mdx +41 -0
  29. package/docs/guide/locating.mdx +1 -1
  30. package/docs/guide/variables.mdx +35 -121
  31. package/docs/guide/waiting.mdx +26 -101
  32. package/docs/interactive/assert.mdx +2 -2
  33. package/docs/interactive/undo.mdx +1 -1
  34. package/docs/overview/what-is-testdriver.mdx +1 -1
  35. package/docs/quickstart.mdx +3 -1
  36. package/docs/security/action.mdx +2 -2
  37. package/docs/security/agent.mdx +4 -4
  38. package/docs/security/platform.mdx +1 -1
  39. package/lib/init.js +0 -1
  40. package/lib/upload-secrets.js +1 -0
  41. package/package.json +3 -3
  42. package/styles/.vale-config/2-MDX.ini +5 -0
  43. package/styles/Microsoft/AMPM.yml +9 -0
  44. package/styles/Microsoft/Accessibility.yml +30 -0
  45. package/styles/Microsoft/Acronyms.yml +64 -0
  46. package/styles/Microsoft/Adverbs.yml +272 -0
  47. package/styles/Microsoft/Auto.yml +11 -0
  48. package/styles/Microsoft/Avoid.yml +14 -0
  49. package/styles/Microsoft/Contractions.yml +50 -0
  50. package/styles/Microsoft/Dashes.yml +13 -0
  51. package/styles/Microsoft/DateFormat.yml +8 -0
  52. package/styles/Microsoft/DateNumbers.yml +40 -0
  53. package/styles/Microsoft/DateOrder.yml +8 -0
  54. package/styles/Microsoft/Ellipses.yml +9 -0
  55. package/styles/Microsoft/FirstPerson.yml +16 -0
  56. package/styles/Microsoft/Foreign.yml +13 -0
  57. package/styles/Microsoft/Gender.yml +8 -0
  58. package/styles/Microsoft/GenderBias.yml +42 -0
  59. package/styles/Microsoft/GeneralURL.yml +11 -0
  60. package/styles/Microsoft/HeadingAcronyms.yml +7 -0
  61. package/styles/Microsoft/HeadingColons.yml +8 -0
  62. package/styles/Microsoft/HeadingPunctuation.yml +13 -0
  63. package/styles/Microsoft/Headings.yml +28 -0
  64. package/styles/Microsoft/Hyphens.yml +14 -0
  65. package/styles/Microsoft/Negative.yml +13 -0
  66. package/styles/Microsoft/Ordinal.yml +13 -0
  67. package/styles/Microsoft/OxfordComma.yml +8 -0
  68. package/styles/Microsoft/Passive.yml +183 -0
  69. package/styles/Microsoft/Percentages.yml +7 -0
  70. package/styles/Microsoft/Plurals.yml +7 -0
  71. package/styles/Microsoft/Quotes.yml +7 -0
  72. package/styles/Microsoft/RangeTime.yml +13 -0
  73. package/styles/Microsoft/Semicolon.yml +8 -0
  74. package/styles/Microsoft/SentenceLength.yml +7 -0
  75. package/styles/Microsoft/Spacing.yml +8 -0
  76. package/styles/Microsoft/Suspended.yml +7 -0
  77. package/styles/Microsoft/Terms.yml +42 -0
  78. package/styles/Microsoft/URLFormat.yml +9 -0
  79. package/styles/Microsoft/Units.yml +16 -0
  80. package/styles/Microsoft/Vocab.yml +25 -0
  81. package/styles/Microsoft/We.yml +11 -0
  82. package/styles/Microsoft/Wordiness.yml +127 -0
  83. package/styles/Microsoft/meta.json +4 -0
  84. package/styles/alex/Ablist.yml +245 -0
  85. package/styles/alex/Condescending.yml +16 -0
  86. package/styles/alex/Gendered.yml +108 -0
  87. package/styles/alex/LGBTQ.yml +55 -0
  88. package/styles/alex/OCD.yml +10 -0
  89. package/styles/alex/Press.yml +11 -0
  90. package/styles/alex/ProfanityLikely.yml +1289 -0
  91. package/styles/alex/ProfanityMaybe.yml +282 -0
  92. package/styles/alex/ProfanityUnlikely.yml +251 -0
  93. package/styles/alex/README.md +27 -0
  94. package/styles/alex/Race.yml +83 -0
  95. package/styles/alex/Suicide.yml +24 -0
  96. package/styles/alex/meta.json +4 -0
  97. package/styles/config/vocabularies/Docs/accept.txt +6 -0
  98. package/styles/proselint/Airlinese.yml +8 -0
  99. package/styles/proselint/AnimalLabels.yml +48 -0
  100. package/styles/proselint/Annotations.yml +9 -0
  101. package/styles/proselint/Apologizing.yml +8 -0
  102. package/styles/proselint/Archaisms.yml +52 -0
  103. package/styles/proselint/But.yml +8 -0
  104. package/styles/proselint/Cliches.yml +782 -0
  105. package/styles/proselint/CorporateSpeak.yml +30 -0
  106. package/styles/proselint/Currency.yml +5 -0
  107. package/styles/proselint/Cursing.yml +15 -0
  108. package/styles/proselint/DateCase.yml +7 -0
  109. package/styles/proselint/DateMidnight.yml +7 -0
  110. package/styles/proselint/DateRedundancy.yml +10 -0
  111. package/styles/proselint/DateSpacing.yml +7 -0
  112. package/styles/proselint/DenizenLabels.yml +52 -0
  113. package/styles/proselint/Diacritical.yml +95 -0
  114. package/styles/proselint/GenderBias.yml +45 -0
  115. package/styles/proselint/GroupTerms.yml +39 -0
  116. package/styles/proselint/Hedging.yml +8 -0
  117. package/styles/proselint/Hyperbole.yml +6 -0
  118. package/styles/proselint/Jargon.yml +11 -0
  119. package/styles/proselint/LGBTOffensive.yml +13 -0
  120. package/styles/proselint/LGBTTerms.yml +15 -0
  121. package/styles/proselint/Malapropisms.yml +8 -0
  122. package/styles/proselint/Needless.yml +358 -0
  123. package/styles/proselint/Nonwords.yml +38 -0
  124. package/styles/proselint/Oxymorons.yml +22 -0
  125. package/styles/proselint/P-Value.yml +6 -0
  126. package/styles/proselint/RASSyndrome.yml +30 -0
  127. package/styles/proselint/README.md +12 -0
  128. package/styles/proselint/Skunked.yml +13 -0
  129. package/styles/proselint/Spelling.yml +17 -0
  130. package/styles/proselint/Typography.yml +11 -0
  131. package/styles/proselint/Uncomparables.yml +50 -0
  132. package/styles/proselint/Very.yml +6 -0
  133. package/styles/proselint/meta.json +17 -0
  134. package/styles/write-good/Cliches.yml +702 -0
  135. package/styles/write-good/E-Prime.yml +32 -0
  136. package/styles/write-good/Illusions.yml +11 -0
  137. package/styles/write-good/Passive.yml +183 -0
  138. package/styles/write-good/README.md +27 -0
  139. package/styles/write-good/So.yml +5 -0
  140. package/styles/write-good/ThereIs.yml +6 -0
  141. package/styles/write-good/TooWordy.yml +221 -0
  142. package/styles/write-good/Weasel.yml +29 -0
  143. package/styles/write-good/meta.json +4 -0
  144. package/testdriver/testdriver_2025-04-17T16-04-30-454Z.yaml +6 -0
  145. package/vale.ini +18 -0
  146. package/docs/guide/setup-teardown.mdx +0 -162
  147. package/docs/reference/interactive/assert.mdx +0 -0
  148. /package/{docs/reference/commands/scroll.mdx → styles/config/vocabularies/Docs/reject.txt} +0 -0
@@ -5,166 +5,56 @@ description: "Learn how to integrate custom Node.js scripts into your TestDriver
5
5
  icon: "code"
6
6
  ---
7
7
 
8
- TestDriver.ai allows you to execute custom **Node.js** scripts within your test workflows using the `exec` command. This feature, introduced in version `5.1.0`, enables you to integrate custom logic, such as generating one-time passwords (OTPs), hitting APIs, or performing other dynamic operations, directly into your tests.
9
-
10
- ---
8
+ TestDriver.ai allows you to execute custom **Node.js** scripts and shell scripts within your test workflows using the `exec` command. This feature, introduced in version `5.1.0`, enables you to integrate custom logic, such as generating one-time passwords (OTPs), hitting APIs, or performing other dynamic operations, directly into your tests.
11
9
 
12
10
  ## Key Features
13
11
 
14
12
  1. **Run Node.js Scripts**:
15
- - Execute custom JavaScript code within your test steps.
16
- - Use NPM modules to extend functionality.
13
+ - Execute custom JavaScript code within your test steps.
14
+ - Use NPM modules to extend functionality.
17
15
 
18
16
  2. **Dynamic Outputs**:
19
- - Store the result of your script in a variable for use in subsequent steps.
17
+ - Store the result of your script in a variable for use in subsequent steps.
20
18
 
21
19
  3. **NPM Support**:
22
- - Install and use NPM packages in your scripts.
23
-
24
- ---
20
+ - Install and use NPM packages in your scripts.
25
21
 
26
- ## Example: One-Time Password (OTP) Validator
22
+ ## Updated Example: One-Time Password (OTP) Validator
27
23
 
28
24
  This example demonstrates how to generate a one-time password (OTP) using the `totp-generator` NPM package and use it in a test.
29
25
 
30
- ### Workflow File: `.github/workflows/testdriver-otp.yml`
31
-
32
- ```yaml
33
- name: TestDriver.ai
34
-
35
- on:
36
- push:
37
- branches: ["main"]
38
- pull_request:
39
- workflow_dispatch:
40
-
41
- jobs:
42
- test:
43
- name: "TestDriver"
44
- runs-on: ubuntu-latest
45
- steps:
46
- - uses: testdriverai/action@main
47
- with:
48
- version: "5.1.0"
49
- key: ${{ secrets.TESTDRIVER_API_KEY }}
50
- prompt: |
51
- 1. /run testdriver/testdriver.yaml
52
- prerun: |
53
- cd $env:TEMP
54
- npm init -y
55
- npm install totp-generator
56
- exit
57
- env:
58
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59
- FORCE_COLOR: "3"
60
-
61
-
62
- ```
63
-
64
-
65
- ---
66
-
67
26
  ### Test File: `testdriver/testdriver.yaml`
68
27
 
69
28
  ```yaml
70
- version: 5.1.0
71
- session: 67e57d614dc25283aa0872a9
29
+ version: 5.3.8
72
30
  steps:
73
- - prompt: Log in with the totp
74
- commands:
75
- - command: exec
76
- output: totp
77
- js: |
78
- const { TOTP } = require("totp-generator");
79
- let otp = TOTP.generate("JBSWY3DPEB3W64TMMQQQ").otp;
80
- result = otp;
81
- - command: exec
82
- js: |
83
- console.log("${OUTPUT.totp}");
84
- - command: type
85
- text: ${OUTPUT.totp}
86
-
87
-
31
+ - commands:
32
+ - command: exec
33
+ lang: shell
34
+ linux: |
35
+ npm install totp-generator
36
+ - command: exec
37
+ lang: js
38
+ output: totp
39
+ linux: |
40
+ const { TOTP } = require("totp-generator");
41
+ let otp = TOTP.generate("JBSWY3DPEB3W64TMMQQQ").otp;
42
+ console.log(otp);
43
+ result = otp;
44
+ - command: type
45
+ text: ${OUTPUT.totp}
88
46
  ```
89
47
 
48
+ ## Additional Details
90
49
 
91
- ---
92
-
93
- ## How It Works
94
-
95
- ### Parameters for `exec`
96
-
97
- - **`js`**: The Node.js script to execute. The output must be assigned to the `result` variable.
98
- - **`output`**: The name of the variable to store the result. This variable can be referenced in subsequent steps as `${OUTPUT.<var>}`.
99
-
100
- ---
101
-
102
- ### Running the Demo Locally
103
-
104
- 1. Clone the repository.
105
- 2. Install dependencies:
106
-
107
- ```bash
108
- npm install
109
-
110
- ```
111
-
112
- 3. Run the test:
113
-
114
- ```bash
115
- testdriverai run testdriver/testdriver.yaml
116
-
117
- ```
118
-
119
- ---
120
-
121
- ### Example Output
122
-
123
- - **Step 1**: Generates an OTP using the `totp-generator` package.
124
- - **Step 2**: Logs the OTP to the console.
125
- - **Step 3**: Types the OTP into the application.
126
-
127
- ---
50
+ - The `exec` command now takes a `lang` argument and supports different operating systems (`linux`, `mac`, and `windows`).
51
+ - Supported `lang` values are `js` or `shell`:
52
+ - `js` code is executed in a NodeJS VM on the host machine (your computer).
53
+ - `shell` code is executed in the shell on the runner.
54
+ - Code specified in `linux`, `mac`, and `windows` is executed based on the platform of the runner machine.
128
55
 
129
56
  ## Pro Tips
130
57
 
131
- 1. **Avoid Overwriting `result`**:
132
- - Always assign the output of your script to the `result` variable.
133
-
134
- 2. **Install Dependencies**:
135
- - Ensure all required NPM packages are installed locally and in the `prerun` script when using GitHub Actions.
136
-
137
- 3. **Node.js Context**:
138
- - The script runs in the same context as the calling process and uses Node.js's [VM module](https://nodejs.org/api/vm.html) internally.
139
-
140
- ---
141
-
142
- ## Gotchas
143
-
144
- 1. **Runner Support**:
145
- - This feature is supported only on **hosted Windows runners**. Hosted Linux runners do not yet support `prerun`.
146
-
147
- 2. **NPM Initialization**:
148
- - Ensure you initialize NPM (`npm init`) and install required packages before running the test.
149
-
150
- ---
151
-
152
- ## Using NPM Modules from Scratch
153
-
154
- 1. Initialize a new Node.js project:
155
-
156
- ```bash
157
- npm init
158
-
159
- ```
160
-
161
- 2. Install the required package:
162
-
163
- ```bash
164
- npm install totp-generator --save
165
-
166
- ```
167
-
168
- ---
169
-
170
- By leveraging the `exec` command, you can extend TestDriver.ai's capabilities with custom Node.js scripts, enabling dynamic and powerful test workflows.
58
+ - Always assign the output of your script to the `result` variable.
59
+ - Ensure all required NPM packages are installed locally and in the `prerun` script when using GitHub Actions.
60
+ - The script runs in the same context as the calling process and uses Node.js's [VM module](https://nodejs.org/api/vm.html) internally.
@@ -0,0 +1,41 @@
1
+ ---
2
+ title: "Setup & Teardown"
3
+ sidebarTitle: "Setup & Teardown"
4
+ description: "How to handle pre and post test tasks."
5
+ icon: "hammer"
6
+ ---
7
+
8
+ ## Pre-run Configuration
9
+
10
+ If a file is found at `testdriver/lifecycle/prerun.yaml`, it's executed before the test begins. This file works like any other TestDriver file and is commonly used to perform tasks such as opening a browser, navigating to a specific page, or resetting the application state.
11
+
12
+ For example, the `prerun.yaml` file can be used to open the Chrome browser and navigate to a page, similar to the example provided above. This ensures that the test environment is properly set up before the test starts.
13
+
14
+ ### Example
15
+
16
+ Here is an example of a `prerun.yaml` file:
17
+
18
+ ```yaml
19
+ version: 5.1.1
20
+ steps:
21
+ - prompt: launch chrome
22
+ commands:
23
+ - command: exec
24
+ lang: shell
25
+ linux: |
26
+ jumpapp google-chrome --disable-fre --no-default-browser-check --no-first-run "${TD_WEBSITE}" &
27
+ exit
28
+ mac: |
29
+ open -na "Google Chrome" --args --disable-fre --no-default-browser-check --no-first-run --disable-features=PasswordManagerEnabled "${TD_WEBSITE}" &
30
+ exit
31
+ windows:
32
+ Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "${TD_WEBSITE}"
33
+ exit
34
+ - command: wait-for-text
35
+ text: "Google Chrome"
36
+ timeout: 30000
37
+ ```
38
+
39
+ ### Notes
40
+
41
+ - Currently, there is no teardown task implemented. However, when running on GitHub Actions, the virtual machine (VM) is ephemeral, meaning everything is destroyed after the test run.
@@ -16,7 +16,7 @@ TestDriver.ai uses **visual understanding** to locate elements on the screen. Un
16
16
  - Mention unique visual traits such as **text**, **color**, **size**, **position**, or **icon**.
17
17
 
18
18
  2. **Avoid Behavioral Descriptions**:
19
- - Do not describe what the element does (e.g., "button that submits the form").
19
+ - don't describe what the element does (e.g., "button that submits the form").
20
20
  - Instead, describe how it looks (e.g., "blue button with the text 'Submit' in the bottom-right corner").
21
21
 
22
22
  3. **Use Unique Identifiers**:
@@ -6,59 +6,39 @@ icon: "square-root-variable"
6
6
 
7
7
  Variables in **TestDriver.ai** allow you to dynamically store and reuse data during test execution. This feature is particularly useful for handling dynamic content, passing data between steps, and customizing test behavior based on runtime conditions.
8
8
 
9
- ---
10
-
11
- ## Key Features of Variables in TestDriver.ai
12
-
13
- 1. **Dynamic Data Handling**:
14
- - Store data (e.g., text, numbers, or results) during test execution.
15
- - Reuse stored data in subsequent steps.
16
-
17
- 2. **Environment Variables**:
18
- - Use environment variables to pass sensitive information (e.g., usernames, passwords, API keys) securely.
19
-
20
- 3. **Custom Variables**:
21
- - Define and manipulate custom variables within the test file.
22
-
23
- 4. **Output Variables**:
24
- - Capture outputs from commands (e.g., text from the screen, API responses) and store them in variables.
25
-
26
- ---
27
-
28
- ## Types of Variables
29
-
30
- ### 1. **Environment Variables**
31
- Environment variables are passed to the test from the workflow or the local environment. They are typically used for sensitive data like credentials or configuration values.
32
-
33
- #### Example:
34
- - **Workflow Environment Variable**: `${TD_USERNAME}`
35
- - **Test File Reference**: `${TD_USERNAME}`
36
-
37
- ---
38
-
39
- ### 2. **Custom Variables**
40
- Custom variables are defined and manipulated within the test file. They can store dynamic data generated during the test.
41
-
42
- #### Example:
43
- - Define a variable: `result = "Test Passed"`
44
- - Reference the variable: `${OUTPUT.result}`
45
-
46
- ---
47
-
48
- ### 3. **Output Variables**
49
- Output variables capture the result of a command and store it for later use.
9
+ - Generate a random number or string and use it to fill out a form.
10
+ - Capture API responses and validate their content.
11
+ - Capture text or values from the screen and use them in assertions.
12
+ - Pass different values to the test using environment variables for testing multiple scenarios.
50
13
 
51
- #### Example:
52
- - Capture text from the screen: `output: capturedText`
53
- - Reference the variable: `${OUTPUT.capturedText}`
14
+ By leveraging variables in TestDriver.ai, you can create dynamic, flexible, and reusable test scripts that adapt to changing conditions and data.
54
15
 
55
- ---
16
+ #### Test File Example:
56
17
 
57
- ## How to Use Variables in TestDriver.ai
18
+ ```yaml
19
+ version: 5.1.0
20
+ steps:
21
+ - prompt: Generate a random number
22
+ commands:
23
+ - command: exec
24
+ output: randomNumber
25
+ js: |
26
+ result = Math.floor(Math.random() * 1000);
27
+ - command: exec
28
+ js: |
29
+ console.log("Generated Random Number: ${OUTPUT.randomNumber}");
58
30
 
59
- ### 1. **Using Environment Variables**
31
+ - prompt: Use the random number in a form
32
+ commands:
33
+ - command: hover-text
34
+ text: Enter Number
35
+ description: Input field for numbers
36
+ action: click
37
+ - command: type
38
+ text: ${OUTPUT.randomNumber}
39
+ ```
60
40
 
61
- #### Workflow Example:
41
+ ## GitHub Actions Example
62
42
 
63
43
  ```yaml
64
44
  name: TestDriver.ai with Variables
@@ -90,12 +70,8 @@ jobs:
90
70
  TD_PASSWORD: ${{ secrets.TD_PASSWORD }}
91
71
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92
72
  FORCE_COLOR: "3"
93
-
94
-
95
73
  ```
96
-
97
-
98
- #### Test File Example:
74
+ #### Test File
99
75
 
100
76
  ```yaml
101
77
  version: 4.2.18
@@ -118,46 +94,9 @@ steps:
118
94
  text: Log In
119
95
  description: Log In button
120
96
  action: click
121
-
122
-
123
97
  ```
124
98
 
125
-
126
- ---
127
-
128
- ### 2. **Defining and Using Custom Variables**
129
-
130
- #### Test File Example:
131
-
132
- ```yaml
133
- version: 5.1.0
134
- steps:
135
- - prompt: Generate a random number
136
- commands:
137
- - command: exec
138
- output: randomNumber
139
- js: |
140
- result = Math.floor(Math.random() * 1000);
141
- - command: exec
142
- js: |
143
- console.log("Generated Random Number: ${OUTPUT.randomNumber}");
144
-
145
- - prompt: Use the random number in a form
146
- commands:
147
- - command: hover-text
148
- text: Enter Number
149
- description: Input field for numbers
150
- action: click
151
- - command: type
152
- text: ${OUTPUT.randomNumber}
153
-
154
-
155
- ```
156
-
157
-
158
- ---
159
-
160
- ### 3. **Capturing Outputs as Variables**
99
+ ### **Capturing Outputs as Variables**
161
100
 
162
101
  #### Test File Example:
163
102
 
@@ -177,46 +116,21 @@ steps:
177
116
  console.log("Captured Text: ${OUTPUT.welcomeMessage}");
178
117
  - command: assert
179
118
  expect: "${OUTPUT.welcomeMessage}" == "Welcome, Test User!"
180
-
181
-
182
119
  ```
183
120
 
184
-
185
- ---
186
-
187
121
  ## Best Practices for Using Variables
188
122
 
189
123
  1. **Use Descriptive Names**:
190
- - Name variables clearly to indicate their purpose (e.g., `capturedText`, `randomNumber`).
124
+ - Name variables clearly to indicate their purpose (e.g., `capturedText`, `randomNumber`).
191
125
 
192
126
  2. **Secure Sensitive Data**:
193
- - Use environment variables for sensitive information like credentials or API keys.
127
+ - Use environment variables for sensitive information like credentials or API keys.
194
128
 
195
129
  3. **Log Variable Values**:
196
- - Use `console.log` or similar commands to log variable values for debugging.
130
+ - Use `console.log` or similar commands to log variable values for debugging.
197
131
 
198
132
  4. **Test Variable Logic Locally**:
199
- - Verify the logic for custom variables locally before integrating them into workflows.
133
+ - Verify the logic for custom variables locally before integrating them into workflows.
200
134
 
201
135
  5. **Combine Variables with Assertions**:
202
- - Use variables in assertions to validate dynamic content or conditions.
203
-
204
- ---
205
-
206
- ## Example Use Cases
207
-
208
- ### 1. **Dynamic Form Filling**
209
- - Generate a random number or string and use it to fill out a form.
210
-
211
- ### 2. **API Testing**
212
- - Capture API responses and validate their content.
213
-
214
- ### 3. **Dynamic Assertions**
215
- - Capture text or values from the screen and use them in assertions.
216
-
217
- ### 4. **Parameterized Tests**
218
- - Pass different values to the test using environment variables for testing multiple scenarios.
219
-
220
- ---
221
-
222
- By leveraging variables in TestDriver.ai, you can create dynamic, flexible, and reusable test scripts that adapt to changing conditions and data.
136
+ - Use variables in assertions to validate dynamic content or conditions.
@@ -8,6 +8,10 @@ icon: "hourglass-half"
8
8
 
9
9
  Waiting is a critical feature in TestDriver.ai that ensures tests are stable and reliable, even in dynamic or slow-loading environments.
10
10
 
11
+ - Automatically adjusts to varying load times, reducing the need for hardcoded delays.
12
+ - Ensures that tests wait for dynamic elements to appear, reducing false negatives caused by incomplete rendering.
13
+ - By waiting for the screen and network to stabilize, `redraw` minimizes the risk of interacting with incomplete or incorrect elements.
14
+
11
15
 
12
16
  ## Summary of Waiting Features
13
17
 
@@ -20,22 +24,20 @@ Waiting is a critical feature in TestDriver.ai that ensures tests are stable and
20
24
  ## Key Waiting Features in TestDriver.ai
21
25
 
22
26
  1. **Automatic Waiting with `redraw`**:
23
- - TestDriver.ai automatically waits for the machine before moving to the next step.
24
- - This includes waiting for:
25
- - UI changes to complete.
26
- - Network activity to stabilize (e.g., API calls).
27
- - Reduces the need for manual waits, making tests faster and less prone to flakiness.
27
+ - TestDriver.ai automatically waits for the machine before moving to the next step.
28
+ - This includes waiting for:
29
+ - UI changes to complete.
30
+ - Network activity to stabilize (e.g., API calls).
31
+ - Reduces the need for manual waits, making tests faster and less prone to flakiness.
28
32
 
29
33
  2. **`wait-for-text` Command**:
30
- - Waits for specific text to appear on the screen.
31
- - Useful for validating dynamic content or ensuring that a page has fully loaded before proceeding.
34
+ - Waits for specific text to appear on the screen.
35
+ - Useful for validating dynamic content or ensuring that a page has fully loaded before proceeding.
32
36
 
33
37
  3. **`wait-for-image` Command**:
34
- - Waits for a specific image or visual element to appear on the screen.
35
- - Ideal for verifying the presence of icons, logos, or other graphical elements.
36
-
38
+ - Waits for a specific image or visual element to appear on the screen.
39
+ - Ideal for verifying the presence of icons, logos, or other graphical elements.
37
40
 
38
- ---
39
41
 
40
42
  ## Commands for Explicit Waiting
41
43
 
@@ -61,9 +63,7 @@ The `wait-for-text` command pauses the test until the specified text appears on
61
63
 
62
64
  In this example, the test waits up to 10 seconds for the text "Welcome, Test User!" to appear.
63
65
 
64
- ---
65
-
66
- ### 2. **`wait-for-image`**
66
+ ### **`wait-for-image`**
67
67
 
68
68
  The `wait-for-image` command pauses the test until the specified image or visual element appears on the screen.
69
69
 
@@ -73,123 +73,48 @@ The `wait-for-image` command pauses the test until the specified image or visual
73
73
  - command: wait-for-image
74
74
  description: <description of the image>
75
75
  timeout: <time in milliseconds> # Optional, defaults to 5000ms
76
-
77
-
78
76
  ```
79
77
 
80
-
81
78
  #### Example:
82
79
 
83
80
  ```yaml
84
81
  - command: wait-for-image
85
82
  description: Company logo in the top-left corner
86
83
  timeout: 8000
87
-
88
-
89
84
  ```
90
85
 
91
86
  In this example, the test waits up to 8 seconds for the company logo to appear in the top-left corner.
92
87
 
93
- ---
94
-
95
88
  ## Automatic Waiting with `redraw`
96
89
 
97
90
  TestDriver.ai's **`redraw` function** is a built-in mechanism that automatically waits for the screen to stabilize before proceeding to the next step. This includes:
98
91
 
99
92
  1. **UI Changes**:
100
- - Waits for animations, transitions, or DOM updates to complete.
101
- - Ensures that the screen is fully rendered before interacting with elements.
93
+ - Waits for animations, transitions, or DOM updates to complete.
94
+ - Ensures that the screen is fully rendered before interacting with elements.
102
95
 
103
96
  2. **Network Stabilization**:
104
- - Waits for network activity (e.g., API calls, AJAX requests) to finish.
105
- - Ensures that dynamic content is fully loaded before proceeding.
97
+ - Waits for network activity (e.g., API calls, AJAX requests) to finish.
98
+ - Ensures that dynamic content is fully loaded before proceeding.
106
99
 
107
100
  3. **Screen Stabilization**:
108
- - Continuously monitors the screen for changes and only moves forward when the screen is stable.
109
-
110
- ---
111
-
112
- ### How `redraw` Reduces Flakiness
113
-
114
- 1. **Eliminates Timing Issues**:
115
- - Automatically adjusts to varying load times, reducing the need for hardcoded delays.
116
-
117
- 2. **Handles Dynamic Content**:
118
- - Ensures that tests wait for dynamic elements to appear, reducing false negatives caused by incomplete rendering.
119
-
120
- 3. **Improves Test Reliability**:
121
- - By waiting for the screen and network to stabilize, `redraw` minimizes the risk of interacting with incomplete or incorrect elements.
122
-
123
- ---
124
-
125
- ## Combining Waiting Features
126
-
127
- You can combine explicit waiting commands (`wait-for-text`, `wait-for-image`) with TestDriver.ai's automatic waiting to create robust and reliable tests.
128
-
129
- ### Example: Login Workflow with Waiting
130
-
131
- ```yaml
132
- version: 4.2.18
133
- steps:
134
- - prompt: Open the login page
135
- commands:
136
- - command: hover-text
137
- text: Login
138
- description: Login button in the top-right corner
139
- action: click
140
-
141
- - prompt: Wait for the login form to appear
142
- commands:
143
- - command: wait-for-text
144
- text: Email
145
- timeout: 10000
146
-
147
- - prompt: Enter credentials and submit
148
- commands:
149
- - command: hover-text
150
- text: Email
151
- description: Email input field
152
- action: click
153
- - command: type
154
- text: user@example.com
155
- - command: hover-text
156
- text: Password
157
- description: Password input field
158
- action: click
159
- - command: type
160
- text: password123
161
- - command: hover-text
162
- text: Submit
163
- description: Submit button
164
- action: click
165
-
166
- - prompt: Wait for the dashboard to load
167
- commands:
168
- - command: wait-for-text
169
- text: Welcome, Test User!
170
- timeout: 15000
171
-
172
- - prompt: Verify the dashboard is displayed
173
- commands:
174
- - command: assert
175
- expect: The dashboard is displayed
176
- ```
101
+ - Continuously monitors the screen for changes and only moves forward when the screen is stable.
177
102
 
178
103
  ---
179
104
 
180
105
  ## Best Practices for Waiting
181
106
 
182
- 1. **Use Explicit Waiting for Dynamic Elements**:
183
- - Use `wait-for-text` or `wait-for-image` for elements that take time to load.
184
-
185
107
  2. **Leverage Automatic Waiting**:
186
- - Rely on TestDriver.ai's `redraw` function to handle most waiting scenarios automatically.
108
+ - Rely on TestDriver.ai's `redraw` function to handle most waiting scenarios automatically.
109
+
110
+ 1. **Use Explicit Waiting for Dynamic Elements**:
111
+ - Use `wait-for-text` or `wait-for-image` for elements that take time to load.
187
112
 
188
113
  3. **Avoid Hardcoded Delays**:
189
- - Replace hardcoded `sleep` or `wait` commands with dynamic waiting commands to improve test reliability.
114
+ - Replace hardcoded `sleep` or `wait` commands with dynamic waiting commands to improve test reliability.
190
115
 
191
116
  4. **Set Appropriate Timeouts**:
192
- - Use reasonable timeouts for explicit waiting commands to balance reliability and test execution time.
117
+ - Use reasonable timeouts for explicit waiting commands to balance reliability and test execution time.
193
118
 
194
119
  5. **Test Incrementally**:
195
- - Add waiting commands step-by-step to ensure each part of the workflow is stable.
120
+ - Add waiting commands step-by-step to ensure each part of the workflow is stable.
@@ -15,7 +15,7 @@ The `/assert` command ensures that a specific condition is true within your test
15
15
  ## Behavior
16
16
  - The `/assert` command generates an assertion based on the specified criteria.
17
17
  - TestDriver.ai takes a screenshot and uses it to verify that the condition described in the `expect` field is true.
18
- - If the condition is not met, the test will fail and exit immediately.
18
+ - If the condition isn't met, the test will fail and exit immediately.
19
19
 
20
20
  ## Example Usage
21
21
 
@@ -43,7 +43,7 @@ To speed up tests, use `async: true` to allow the test to continue without waiti
43
43
  - Ensure the `expect` field clearly describes the condition to avoid ambiguity.
44
44
 
45
45
  ## Gotchas
46
- - If the condition in `expect` is not met, the test will fail and exit immediately.
46
+ - If the condition in `expect` isn't met, the test will fail and exit immediately.
47
47
  - Overusing assertions can make tests slower and harder to maintain.
48
48
 
49
49
  ## Notes
@@ -40,7 +40,7 @@ The `/undo` command removes the last generated command or step from the current
40
40
 
41
41
  ## Gotchas
42
42
  - The `/undo` command only removes the last generated command or step. If you need to undo multiple actions, call `/undo` repeatedly.
43
- - Once a session is closed, you cannot undo previously saved commands.
43
+ - Once a session is closed, you can't undo previously saved commands.
44
44
 
45
45
  ## Notes
46
46
  - The `/undo` command is ideal for interactive sessions where you are experimenting with test generation.
@@ -5,7 +5,7 @@ icon: "circle-info"
5
5
  mode: "wide"
6
6
  ---
7
7
 
8
- TestDriver uses AI vision and keyboard and mouse control to automate end-to-end testing. TestDriver is `selectorless` meaning it is not aware of the underlying code structure.
8
+ TestDriver uses AI vision and keyboard and mouse control to automate end-to-end testing. TestDriver is `selectorless` meaning it isn't aware of the underlying code structure.
9
9
 
10
10
  - **Easier set up:** No need to craft complex selectors
11
11
  - **Less Maintenance:** Tests don't break when code changes