testdriverai 6.0.16-canary.f0eefe0.0 → 6.0.16
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/agent/events.js +11 -1
- package/agent/index.js +9 -13
- package/agent/lib/censorship.js +70 -0
- package/debugger/index.html +2 -0
- package/docs/_scripts/link-replacer.js +164 -0
- package/docs/account/dashboard.mdx +5 -2
- package/docs/account/pricing.mdx +12 -5
- package/docs/account/projects.mdx +3 -2
- package/docs/account/team.mdx +7 -3
- package/docs/apps/chrome-extensions.mdx +8 -2
- package/docs/apps/desktop-apps.mdx +5 -5
- package/docs/apps/mobile-apps.mdx +7 -2
- package/docs/cli/overview.mdx +6 -6
- package/docs/commands/assert.mdx +9 -6
- package/docs/commands/hover-image.mdx +9 -6
- package/docs/commands/if.mdx +11 -6
- package/docs/commands/match-image.mdx +13 -6
- package/docs/commands/remember.mdx +10 -5
- package/docs/commands/run.mdx +8 -2
- package/docs/commands/type.mdx +11 -5
- package/docs/commands/wait-for-image.mdx +9 -3
- package/docs/commands/wait.mdx +9 -4
- package/docs/features/generation.mdx +1 -1
- package/docs/features/reusable-snippets.mdx +8 -5
- package/docs/features/selectorless.mdx +13 -6
- package/docs/features/visual-assertions.mdx +53 -39
- package/docs/getting-started/editing.mdx +1 -1
- package/docs/guide/assertions.mdx +12 -17
- package/docs/guide/code.mdx +2 -2
- package/docs/guide/lifecycle.mdx +3 -3
- package/docs/guide/locating.mdx +13 -6
- package/docs/guide/waiting.mdx +41 -32
- package/docs/interactive/assert.mdx +11 -0
- package/docs/interactive/generate.mdx +11 -0
- package/docs/interactive/run.mdx +8 -0
- package/docs/interactive/save.mdx +7 -0
- package/docs/interactive/undo.mdx +11 -3
- package/docs/overview/comparison.mdx +50 -49
- package/docs/overview/faq.mdx +40 -2
- package/docs/overview/performance.mdx +25 -25
- package/docs/overview/what-is-testdriver.mdx +24 -22
- package/docs/scenarios/ai-chatbot.mdx +6 -5
- package/docs/scenarios/cookie-banner.mdx +4 -1
- package/docs/scenarios/file-upload.mdx +7 -4
- package/docs/scenarios/form-filling.mdx +4 -1
- package/docs/scenarios/pdf-generation.mdx +5 -2
- package/docs/scenarios/spell-check.mdx +3 -3
- package/docs/security/agent.mdx +14 -2
- package/docs/security/platform.mdx +17 -5
- package/docs/snippets/calendar-link.mdx +4 -1
- package/docs/snippets/comments.mdx +1 -1
- package/docs/snippets/gitignore-warning.mdx +6 -3
- package/docs/snippets/lifecycle-warning.mdx +6 -1
- package/docs/snippets/tests/assert-replay.mdx +5 -1
- package/docs/snippets/tests/exec-js-replay.mdx +5 -1
- package/docs/snippets/tests/exec-shell-replay.mdx +5 -1
- package/docs/snippets/tests/hover-image-replay.mdx +5 -1
- package/docs/snippets/tests/hover-image-yaml.mdx +2 -2
- package/docs/snippets/tests/hover-text-replay.mdx +5 -1
- package/docs/snippets/tests/hover-text-with-description-replay.mdx +5 -2
- package/docs/snippets/tests/hover-text-with-description-yaml.mdx +2 -2
- package/docs/snippets/tests/match-image-replay.mdx +5 -1
- package/docs/snippets/tests/match-image-yaml.mdx +2 -2
- package/docs/snippets/tests/press-keys-replay.mdx +5 -1
- package/docs/snippets/tests/prompt-replay.mdx +5 -1
- package/docs/snippets/tests/prompt-yaml.mdx +1 -1
- package/docs/snippets/tests/remember-replay.mdx +5 -1
- package/docs/snippets/tests/scroll-replay.mdx +5 -1
- package/docs/snippets/tests/scroll-until-text-replay.mdx +5 -1
- package/docs/snippets/tests/type-repeated-replay.mdx +5 -1
- package/docs/snippets/tests/type-replay.mdx +5 -1
- package/docs/snippets/yml-warning.mdx +4 -1
- package/docs/styles.css +6 -0
- package/interfaces/logger.js +1 -19
- package/package.json +6 -2
- package/styles/Microsoft/HeadingAcronyms.yml +1 -1
- package/styles/Microsoft/Headings.yml +1 -1
- package/styles/Microsoft/Quotes.yml +1 -1
- package/styles/Microsoft/Semicolon.yml +1 -1
- package/styles/Microsoft/SentenceLength.yml +0 -1
- package/styles/Microsoft/Spacing.yml +2 -2
- package/styles/Microsoft/Units.yml +4 -4
- package/styles/Microsoft/Vocab.yml +1 -1
- package/styles/alex/Ablist.yml +58 -29
- package/styles/alex/Gendered.yml +4 -2
- package/styles/alex/Press.yml +2 -1
- package/styles/alex/ProfanityLikely.yml +1284 -1284
- package/styles/alex/ProfanityMaybe.yml +1 -1
- package/styles/alex/ProfanityUnlikely.yml +1 -1
- package/styles/alex/Race.yml +4 -2
- package/styles/alex/Suicide.yml +4 -2
- package/styles/alex/meta.json +1 -1
- package/styles/proselint/AnimalLabels.yml +39 -39
- package/styles/proselint/DenizenLabels.yml +44 -44
- package/styles/proselint/GenderBias.yml +37 -37
- package/styles/proselint/GroupTerms.yml +31 -31
- package/styles/proselint/Hedging.yml +1 -1
- package/styles/proselint/Hyperbole.yml +1 -1
- package/styles/proselint/LGBTTerms.yml +8 -8
- package/styles/proselint/Needless.yml +5 -5
- package/styles/proselint/RASSyndrome.yml +3 -3
- package/styles/proselint/Typography.yml +1 -1
- package/styles/proselint/Uncomparables.yml +5 -5
- package/styles/proselint/meta.json +1 -3
- package/testdriver/acceptance/remember.yaml +1 -1
- package/testdriver/behavior/secrets.yaml +7 -0
- /package/{upload-docs-to-openai.js → docs/_scripts/upload-docs-to-openai.js} +0 -0
package/docs/commands/if.mdx
CHANGED
|
@@ -6,16 +6,19 @@ icon: "split"
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Description
|
|
9
|
+
|
|
9
10
|
The `if` command is used to conditionally execute a set of commands based on whether a specified condition evaluates to true or false. If the condition is true, the commands in the `then` block are executed. Otherwise, the commands in the `else` block are executed.
|
|
10
11
|
|
|
11
12
|
## Arguments
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
13
|
+
|
|
14
|
+
| Argument | Type | Description |
|
|
15
|
+
| ----------- | ------------------ | ---------------------------------------------- |
|
|
16
|
+
| `condition` | `string` | The condition to evaluate. |
|
|
17
|
+
| `then` | `list of commands` | The commands to run if the condition is true. |
|
|
18
|
+
| `else` | `list of commands` | The commands to run if the condition is false. |
|
|
17
19
|
|
|
18
20
|
## Example usage
|
|
21
|
+
|
|
19
22
|
```yaml
|
|
20
23
|
command: if
|
|
21
24
|
condition: the text "Accept Cookies" is visible
|
|
@@ -32,15 +35,17 @@ else:
|
|
|
32
35
|
```
|
|
33
36
|
|
|
34
37
|
## Protips
|
|
38
|
+
|
|
35
39
|
- Ensure the `condition` is clearly defined and evaluates correctly to avoid unexpected behavior.
|
|
36
40
|
- Use descriptive `then` and `else` blocks to handle both outcomes effectively.
|
|
37
41
|
- Combine the `if` command with other commands like `hover-text` or `focus-application` to create dynamic workflows.
|
|
38
42
|
|
|
39
43
|
## Gotchas
|
|
44
|
+
|
|
40
45
|
- If the `condition` is invalid or can't be evaluated, the command will fail.
|
|
41
46
|
- Ensure all commands in the `then` and `else` blocks are valid and properly formatted.
|
|
42
47
|
|
|
43
48
|
## Notes
|
|
49
|
+
|
|
44
50
|
- The `if` command is useful for creating conditional logic in your tests, allowing for more dynamic and flexible workflows.
|
|
45
51
|
- Both the `then` and `else` blocks are optional, but at least one must be provided.
|
|
46
|
-
|
|
@@ -6,22 +6,25 @@ icon: "images"
|
|
|
6
6
|
mode: "wide"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
import Replay from
|
|
10
|
-
import Example from
|
|
9
|
+
import Replay from "/snippets/tests/match-image-replay.mdx";
|
|
10
|
+
import Example from "/snippets/tests/match-image-yaml.mdx";
|
|
11
11
|
|
|
12
12
|
<Replay />
|
|
13
13
|
<Example />
|
|
14
14
|
|
|
15
15
|
## Description
|
|
16
|
+
|
|
16
17
|
The `match-image` command is used to locate an image on the screen by matching it with a reference image file and performing an action (For example, click or hover) at its center. This command is particularly useful for interacting with elements that the AI has difficulty locating using descriptions or other methods.
|
|
17
18
|
|
|
18
19
|
## Arguments
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
|
22
|
-
| `
|
|
20
|
+
|
|
21
|
+
| Argument | Type | Description |
|
|
22
|
+
| -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `path` | `string` | The relative path to the image file that needs to be matched on the screen. don't include `testdriver/screenshots/*/` in the path. |
|
|
24
|
+
| `action` | `string` | The action to perform when the image is found. Available actions are: `click` or `hover`. The action will be performed at the center of the matched image. |
|
|
23
25
|
|
|
24
26
|
## Example usage
|
|
27
|
+
|
|
25
28
|
```yaml
|
|
26
29
|
command: match-image
|
|
27
30
|
path: button.png
|
|
@@ -29,11 +32,13 @@ action: click
|
|
|
29
32
|
```
|
|
30
33
|
|
|
31
34
|
## How it works
|
|
35
|
+
|
|
32
36
|
- The `match-image` command takes a screenshot of the desktop and searches for the location of the reference image within the screenshot.
|
|
33
37
|
- The matching logic looks for the most similar image within the screenshot, not an exact match. If the similarity is below ~80%, it will search additional scales. If no match is found, the command will fail.
|
|
34
38
|
- Screenshots should be stored in the `testdriver/screenshots/(mac/linux/windows)/` directory. TestDriver dynamically resolves the correct image based on the current platform.
|
|
35
39
|
|
|
36
40
|
## Protips
|
|
41
|
+
|
|
37
42
|
- To create high-quality screenshots for matching:
|
|
38
43
|
- Download the video of the test and open it at "full" or "actual" size on your computer.
|
|
39
44
|
- Use a screenshot tool (like Cleanshot X) to capture the target element.
|
|
@@ -41,11 +46,13 @@ action: click
|
|
|
41
46
|
- Ensure the image file is clear and free of unnecessary visual noise to improve matching accuracy.
|
|
42
47
|
|
|
43
48
|
## Gotchas
|
|
49
|
+
|
|
44
50
|
- If the image match is below ~80% similarity, the command will fail.
|
|
45
51
|
- Variations in screen resolution, scaling settings, or platform-specific UI differences may affect matching accuracy.
|
|
46
52
|
- Ensure the image file is stored in the correct directory structure (`testdriver/screenshots/(mac/linux/windows)/`) for dynamic resolution.
|
|
47
53
|
|
|
48
54
|
## Notes
|
|
55
|
+
|
|
49
56
|
- The `match-image` command is ideal for interacting with visual elements that can't be reliably described or located using other commands like `hover-image`.
|
|
50
57
|
- This command supports flexible scaling to account for minor differences in image size or resolution.
|
|
51
58
|
- Use this command as a fallback when other methods fail to locate the desired element.
|
|
@@ -6,35 +6,40 @@ icon: "brain"
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Description
|
|
9
|
+
|
|
9
10
|
The `remember` command is used to save a variable for later use. This is useful for storing values that you want to reference in subsequent commands or steps, especially for things that are dynamic or change frequently from run to run.
|
|
10
11
|
|
|
11
12
|
**The `remember` command is only availble form `v5.7.0` and later.**
|
|
12
13
|
|
|
13
14
|
## Arguments
|
|
14
|
-
| Argument | Type | Description |
|
|
15
|
-
|----------|---------------------|-----------------------------------------------------------------------------|
|
|
16
|
-
| `output` | string | the variable name you will use to recall the value later. |
|
|
17
|
-
| `description` | string | A prompt describing the value you want to store. |
|
|
18
15
|
|
|
16
|
+
| Argument | Type | Description |
|
|
17
|
+
| ------------- | ------ | --------------------------------------------------------- |
|
|
18
|
+
| `output` | string | the variable name you will use to recall the value later. |
|
|
19
|
+
| `description` | string | A prompt describing the value you want to store. |
|
|
19
20
|
|
|
20
21
|
---
|
|
21
22
|
|
|
22
23
|
## Example usage
|
|
24
|
+
|
|
23
25
|
```yaml
|
|
24
26
|
- command: remember
|
|
25
27
|
output: my_variable
|
|
26
28
|
description: The date value shown to the right or 'Order Date'
|
|
27
29
|
```
|
|
30
|
+
|
|
28
31
|
## Protips
|
|
32
|
+
|
|
29
33
|
- Use the output later with this syntax `${OUTPUT.my_variable}`.
|
|
30
34
|
- The `remember` command does not persist variables across different test runs. If you need to store values for later use in different test runs, consider using external storage solutions or environment variables.
|
|
31
35
|
- For now, the `remember` command only supports string values. If you need to store complex data types, you may use `remember` multiple times for the values. This may change in a later version.
|
|
32
36
|
|
|
33
37
|
## Gotchas
|
|
38
|
+
|
|
34
39
|
- The `remeember` command is only available from `v5.7.0` and later.
|
|
35
40
|
- Ensure the variable name is unique to avoid overwriting existing variables.
|
|
36
41
|
- The variable name is case-sensitive, so `my_variable` and `My_Variable` would be treated as different variables.
|
|
37
42
|
|
|
38
43
|
## Notes
|
|
39
|
-
- The `remember` command is ideal for storing values that are generated during the test run, such as timestamps, IDs, the text value of a link you might click later, or any other dynamic data.
|
|
40
44
|
|
|
45
|
+
- The `remember` command is ideal for storing values that are generated during the test run, such as timestamps, IDs, the text value of a link you might click later, or any other dynamic data.
|
package/docs/commands/run.mdx
CHANGED
|
@@ -6,27 +6,33 @@ icon: "play"
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Description
|
|
9
|
+
|
|
9
10
|
The `run` command is used to embed and execute another file within the current script. This is useful for reusing common sequences of commands or modularizing your scripts for better organization and maintainability.
|
|
10
11
|
|
|
11
12
|
## Arguments
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
| Argument | Type | Description |
|
|
15
|
+
| -------- | -------- | --------------------------------------------------------------------------------------------- |
|
|
14
16
|
| `file` | `string` | The path to the file to embed and run. Should be relative to the root of your git repository. |
|
|
15
17
|
|
|
16
18
|
## Example usage
|
|
19
|
+
|
|
17
20
|
```yaml
|
|
18
21
|
command: run
|
|
19
22
|
file: path/to/another-script.yaml
|
|
20
23
|
```
|
|
21
24
|
|
|
22
25
|
## Protips
|
|
26
|
+
|
|
23
27
|
- Use the `run` command to centralize reusable logic, such as login flows or setup steps, into separate files.
|
|
24
28
|
- Ensure the file path is correct and relative to the root of your git repository to avoid errors.
|
|
25
29
|
|
|
26
30
|
## Gotchas
|
|
31
|
+
|
|
27
32
|
- If the specified file doesn't exist or contains errors, the command will fail.
|
|
28
33
|
- Ensure the embedded file is compatible with the current script's context, such as variable dependencies or session requirements.
|
|
29
34
|
|
|
30
35
|
## Notes
|
|
36
|
+
|
|
31
37
|
- The `run` command is ideal for creating modular and maintainable test scripts by reusing common workflows.
|
|
32
38
|
- This command supports nesting, allowing you to call scripts that themselves use the `run` command.
|
package/docs/commands/type.mdx
CHANGED
|
@@ -6,34 +6,40 @@ icon: "typewriter"
|
|
|
6
6
|
mode: "wide"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
import Replay from
|
|
10
|
-
import Example from
|
|
9
|
+
import Replay from "/snippets/tests/type-replay.mdx";
|
|
10
|
+
import Example from "/snippets/tests/type-yaml.mdx";
|
|
11
11
|
|
|
12
12
|
<Replay />
|
|
13
13
|
<Example />
|
|
14
14
|
|
|
15
15
|
## Description
|
|
16
|
+
|
|
16
17
|
The `type` command is used to simulate typing a string using keyboard emulation. This is useful for entering text into input fields or performing text-based interactions.
|
|
17
18
|
|
|
18
19
|
## Arguments
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
|
20
|
+
|
|
21
|
+
| Argument | Type | Description |
|
|
22
|
+
| -------- | -------- | ------------------------ |
|
|
23
|
+
| `text` | `string` | The text string to type. |
|
|
22
24
|
|
|
23
25
|
## Example usage
|
|
26
|
+
|
|
24
27
|
```yaml
|
|
25
28
|
command: type
|
|
26
29
|
text: Hello World
|
|
27
30
|
```
|
|
28
31
|
|
|
29
32
|
## Protips
|
|
33
|
+
|
|
30
34
|
- Use this command to input text into fields, such as search bars or forms.
|
|
31
35
|
- Ensure the target application or input field is in focus before using the `type` command to avoid unexpected behavior.
|
|
32
36
|
|
|
33
37
|
## Gotchas
|
|
38
|
+
|
|
34
39
|
- If the input field isn't active or in focus, the text may not be typed correctly.
|
|
35
40
|
- Special characters in the `text` string may require additional handling depending on the application.
|
|
36
41
|
|
|
37
42
|
## Notes
|
|
43
|
+
|
|
38
44
|
- The `type` command is ideal for automating text input in tests.
|
|
39
45
|
- This command supports cross-platform compatibility for consistent behavior across operating systems.
|
|
@@ -6,15 +6,18 @@ icon: "clock-three-thirty"
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Description
|
|
9
|
+
|
|
9
10
|
The `wait-for-image` command waits until the specified image is detected on the screen. This is useful for ensuring that visual elements are present before proceeding with the next steps in a test.
|
|
10
11
|
|
|
11
12
|
## Arguments
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
|
13
|
+
|
|
14
|
+
| Argument | Type | Description |
|
|
15
|
+
| ------------- | -------- | ------------------------------------------------------------------------------------------- |
|
|
16
|
+
| `description` | `string` | A description of the image. |
|
|
15
17
|
| `timeout` | `number` | (Optional) The duration in milliseconds to wait for the image to appear. Default is `5000`. |
|
|
16
18
|
|
|
17
19
|
## Example usage
|
|
20
|
+
|
|
18
21
|
```yaml
|
|
19
22
|
command: wait-for-image
|
|
20
23
|
description: trash icon
|
|
@@ -22,13 +25,16 @@ timeout: 5000
|
|
|
22
25
|
```
|
|
23
26
|
|
|
24
27
|
## Protips
|
|
28
|
+
|
|
25
29
|
- Use clear and concise descriptions for the image to improve detection accuracy.
|
|
26
30
|
- Adjust the `timeout` value based on the expected load time of the image to avoid unnecessary delays.
|
|
27
31
|
|
|
28
32
|
## Gotchas
|
|
33
|
+
|
|
29
34
|
- If the image doesn't appear within the specified `timeout`, the command will fail.
|
|
30
35
|
- Ensure the description accurately represents the image to avoid detection issues.
|
|
31
36
|
|
|
32
37
|
## Notes
|
|
38
|
+
|
|
33
39
|
- The `wait-for-image` command is ideal for synchronizing tests with visual elements that may take time to load.
|
|
34
40
|
- This command supports flexible timeouts to accommodate varying load times.
|
package/docs/commands/wait.mdx
CHANGED
|
@@ -6,28 +6,33 @@ icon: "clock"
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Description
|
|
9
|
+
|
|
9
10
|
The `wait` command pauses the execution of the script for a specified number of milliseconds before continuing. This is useful for adding delays between commands or waiting for certain conditions to stabilize.
|
|
10
11
|
|
|
11
12
|
## Arguments
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
|
13
|
+
|
|
14
|
+
| Argument | Type | Description |
|
|
15
|
+
| --------- | -------- | ------------------------------------- |
|
|
16
|
+
| `timeout` | `number` | The duration in milliseconds to wait. |
|
|
15
17
|
|
|
16
18
|
## Example usage
|
|
19
|
+
|
|
17
20
|
```yaml
|
|
18
21
|
command: wait
|
|
19
22
|
timeout: 5000
|
|
20
23
|
```
|
|
21
24
|
|
|
22
25
|
## Protips
|
|
26
|
+
|
|
23
27
|
- Use the `wait` command to handle timing issues, such as waiting for animations to complete or elements to load.
|
|
24
28
|
- Avoid using excessively long timeouts to keep tests efficient.
|
|
25
29
|
|
|
26
30
|
## Gotchas
|
|
31
|
+
|
|
27
32
|
- Overusing the `wait` command can slow down test execution. Use it only when necessary.
|
|
28
33
|
- Ensure the timeout value is appropriate for the scenario to avoid unnecessary delays.
|
|
29
34
|
|
|
30
35
|
## Notes
|
|
36
|
+
|
|
31
37
|
- The `wait` command is ideal for introducing controlled pauses in your test scripts.
|
|
32
38
|
- This command is supported across all platforms for consistent behavior.
|
|
33
|
-
|
|
@@ -67,7 +67,7 @@ steps:
|
|
|
67
67
|
|
|
68
68
|
Now it's time to generate the regression test.
|
|
69
69
|
|
|
70
|
-
Run the tests with the `run` command and use the `--write` parameter:
|
|
70
|
+
Run the tests with the [`run`](/commands/run) command and use the `--write` parameter:
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
73
|
npx testdriverai@latest run testdriver/generate/test-error-user-login.yaml --write
|
|
@@ -5,7 +5,7 @@ description: "Discover how to modularize your test workflows using reusable YAML
|
|
|
5
5
|
icon: "repeat"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
import GitignoreWarning from
|
|
8
|
+
import GitignoreWarning from "/snippets/gitignore-warning.mdx";
|
|
9
9
|
|
|
10
10
|
Reusable snippets in TestDriver allow you to modularize your test steps by creating smaller, reusable YAML files that can be embedded into larger test workflows. This approach improves test maintainability, reduces duplication, and makes your test suite more organized and scalable.
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ Reusable snippets in TestDriver allow you to modularize your test steps by creat
|
|
|
13
13
|
|
|
14
14
|
## What are reusable snippets?
|
|
15
15
|
|
|
16
|
-
Reusable snippets are YAML files containing a set of test steps that perform a specific task, such as logging in, navigating to a page, or setting up test prerequisites. These snippets can be referenced in other test files using the `run` command, enabling you to reuse common actions across multiple tests.
|
|
16
|
+
Reusable snippets are YAML files containing a set of test steps that perform a specific task, such as logging in, navigating to a page, or setting up test prerequisites. These snippets can be referenced in other test files using the [`run`](/commands/run) command, enabling you to reuse common actions across multiple tests.
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
@@ -27,6 +27,7 @@ Reusable snippets are YAML files containing a set of test steps that perform a s
|
|
|
27
27
|
---
|
|
28
28
|
|
|
29
29
|
## How to create and use reusable snippets
|
|
30
|
+
|
|
30
31
|
<Steps>
|
|
31
32
|
<Step title="Create a Snippet">
|
|
32
33
|
|
|
@@ -54,11 +55,12 @@ steps:
|
|
|
54
55
|
description: log in button
|
|
55
56
|
action: click
|
|
56
57
|
```
|
|
58
|
+
|
|
57
59
|
</Step>
|
|
58
60
|
|
|
59
61
|
<Step title="Reference the Snippet in a Test">
|
|
60
62
|
|
|
61
|
-
Use the `run` command to include the snippet in your main test file. For example:
|
|
63
|
+
Use the [`run`](/commands/run) command to include the snippet in your main test file. For example:
|
|
62
64
|
|
|
63
65
|
```yaml
|
|
64
66
|
version: 4.2.18
|
|
@@ -72,6 +74,7 @@ steps:
|
|
|
72
74
|
description: dashboard link in the navigation bar
|
|
73
75
|
action: click
|
|
74
76
|
```
|
|
77
|
+
|
|
75
78
|
</Step>
|
|
76
79
|
|
|
77
80
|
<Step title="Parameterize Inputs">
|
|
@@ -87,7 +90,6 @@ TD_PASSWORD=your_password
|
|
|
87
90
|
</Step>
|
|
88
91
|
</Steps>
|
|
89
92
|
|
|
90
|
-
|
|
91
93
|
## Example: Combining multiple snippets
|
|
92
94
|
|
|
93
95
|
You can chain multiple snippets together to create complex workflows. For example:
|
|
@@ -104,7 +106,8 @@ steps:
|
|
|
104
106
|
- command: run
|
|
105
107
|
file: snippets/add_to_cart.yaml
|
|
106
108
|
```
|
|
107
|
-
|
|
109
|
+
|
|
110
|
+
---
|
|
108
111
|
|
|
109
112
|
## Best practices for reusable snippets
|
|
110
113
|
|
|
@@ -5,7 +5,7 @@ description: "Selectorless testing approach simplifies end-to-end testing by usi
|
|
|
5
5
|
icon: "eye"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
Selectorless testing eliminates the need for brittle selectors like CSS classes, IDs, or XPath.
|
|
8
|
+
Selectorless testing eliminates the need for brittle selectors like CSS classes, IDs, or XPath.
|
|
9
9
|
|
|
10
10
|
Instead, TestDriver uses natural language prompts and AI-powered vision to interact with applications as a user would. This makes tests more resilient to UI changes and reduces maintenance overhead.
|
|
11
11
|
|
|
@@ -32,7 +32,7 @@ steps:
|
|
|
32
32
|
expect: The registration form is visible
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
This allows TestDriver locates the target for `hover-text` based on its context and description. The agent will search for elements: in the following order.
|
|
35
|
+
This allows TestDriver locates the target for [`hover-text`](/commands/hover-text) based on its context and description. The agent will search for elements: in the following order.
|
|
36
36
|
|
|
37
37
|
- `text` - exact element to match
|
|
38
38
|
- `description` - a description of the element given the exact text isn't found, or there are multiple matches
|
|
@@ -40,7 +40,7 @@ This allows TestDriver locates the target for `hover-text` based on its context
|
|
|
40
40
|
|
|
41
41
|
### What happens when "Sign Up" changes to "Register"?
|
|
42
42
|
|
|
43
|
-
If the button text changes to "Register," TestDriver's AI vision will still locate the button based on its context and description. You don't need to update the test manually.
|
|
43
|
+
If the button text changes to "Register," TestDriver's AI vision will still locate the button based on its context and description. You don't need to update the test manually.
|
|
44
44
|
TestDriver will then update the test to reflect the new UI by modifying the `text` field. Then, it will open a new pull request with the changes.
|
|
45
45
|
|
|
46
46
|
```yaml
|
|
@@ -53,15 +53,22 @@ steps:
|
|
|
53
53
|
description: button in the header for user registration
|
|
54
54
|
action: click
|
|
55
55
|
```
|
|
56
|
+
|
|
56
57
|
## Why selectorless testing?
|
|
57
58
|
|
|
58
|
-
Traditional testing frameworks rely on selectors tightly coupled to the codebase.
|
|
59
|
+
Traditional testing frameworks rely on selectors tightly coupled to the codebase.
|
|
59
60
|
For example:
|
|
60
61
|
|
|
61
62
|
```javascript
|
|
62
63
|
const button = await page.$('button[class="sign-up-btn"]');
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
<Warning>
|
|
66
|
+
<Warning>
|
|
67
|
+
When using legacy frameworks, if the class name changes, the test will break,
|
|
68
|
+
requiring updates to the test code!
|
|
69
|
+
</Warning>{" "}
|
|
66
70
|
|
|
67
|
-
<Check>
|
|
71
|
+
<Check>
|
|
72
|
+
Selectorless testing avoids this by focusing on the intent of the interaction
|
|
73
|
+
rather than the implementation details.
|
|
74
|
+
</Check>
|
|
@@ -10,71 +10,86 @@ Visual assertions in TestDriver allow you to validate that your application beha
|
|
|
10
10
|
## What can TestDriver test with visual assertions?
|
|
11
11
|
|
|
12
12
|
### AI chatbots
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
|
|
14
|
+
- Validate that chatbot responses are displayed correctly.
|
|
15
|
+
- Ensure the chatbot interface is accessible and functional.
|
|
16
|
+
- See [AI Chatbots](/scenarios/ai-chatbot) for an example.
|
|
16
17
|
|
|
17
18
|
### Desktop applications
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
- Verify that desktop app windows, dialogs, and UI elements render as expected.
|
|
21
|
+
- Test cross-platform compatibility for Windows, Mac, and Linux.
|
|
22
|
+
- See [Using TestDriver with Desktop Apps](/apps/desktop-apps) for an example.
|
|
21
23
|
|
|
22
24
|
### Chrome extensions
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
- Confirm that the extension UI integrates properly with the browser.
|
|
27
|
+
- Validate extension popups, settings, and interactions.
|
|
28
|
+
- See [Using TestDriver with Chrome Extensions](/apps/chrome-extensions) for an example.
|
|
26
29
|
|
|
27
30
|
### PDF generation
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
- Assert that generated PDFs contain the correct text, images, and formatting.
|
|
33
|
+
- Verify that PDFs open and display properly in viewers.
|
|
34
|
+
- See [PDF Generation](/scenarios/pdf-generation) for an example.
|
|
31
35
|
|
|
32
36
|
### Spelling & grammar
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
|
|
38
|
+
- Check for spelling and grammar errors in displayed text.
|
|
39
|
+
- Validate that text content matches expected language rules.
|
|
40
|
+
- See [Spell Check](/scenarios/spell-check) for an example.
|
|
36
41
|
|
|
37
42
|
### Auth signup & login
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
|
|
44
|
+
- Ensure OAuth flows display the correct login screens.
|
|
45
|
+
- Verify that users are redirected to the correct pages after login.
|
|
46
|
+
- See [Login](/scenarios/log-in) for an example.
|
|
41
47
|
|
|
42
48
|
### File system & uploads
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
|
|
50
|
+
- Confirm that file upload dialogs appear and function correctly.
|
|
51
|
+
- Validate that uploaded files are processed and displayed as expected.
|
|
52
|
+
- See [File Upload](/scenarios/file-upload) for an example.
|
|
46
53
|
|
|
47
54
|
### Image content
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
|
|
56
|
+
- Verify that images are displayed correctly and match expected content.
|
|
57
|
+
- Test for the presence of specific icons, logos, or visual elements.
|
|
50
58
|
|
|
51
59
|
### Video content
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
|
|
61
|
+
- Assert that videos play correctly and match expected visuals.
|
|
62
|
+
- Validate video controls (play, pause, fullscreen) and captions.
|
|
54
63
|
|
|
55
64
|
### OS accessibility features
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
|
|
66
|
+
- Test high-contrast modes, screen readers, and other accessibility features.
|
|
67
|
+
- Validate that UI elements are accessible and readable.
|
|
58
68
|
|
|
59
69
|
### Light / Dark mode
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
|
|
71
|
+
- Verify that the application switches between light and dark modes correctly.
|
|
72
|
+
- Assert that UI elements are visible and styled appropriately in both modes.
|
|
62
73
|
|
|
63
74
|
### Privacy configuration
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
|
|
76
|
+
- Confirm that privacy settings are displayed and functional.
|
|
77
|
+
- Validate that toggles, checkboxes, and options reflect the correct state.
|
|
66
78
|
|
|
67
79
|
### `<iframe>`
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
|
|
81
|
+
- Test content rendered inside `<iframe>` elements.
|
|
82
|
+
- Validate interactions within embedded frames.
|
|
70
83
|
|
|
71
84
|
### `<canvas>`
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
|
|
86
|
+
- Verify that canvas elements render graphics, charts, or animations correctly.
|
|
87
|
+
- Assert that dynamic content within the canvas matches expectations.
|
|
74
88
|
|
|
75
89
|
### `<video>`
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
|
|
91
|
+
- Ensure video elements load and play correctly.
|
|
92
|
+
- Validate video overlays, subtitles, and playback controls.
|
|
78
93
|
|
|
79
94
|
---
|
|
80
95
|
|
|
@@ -85,7 +100,6 @@ Visual assertions in TestDriver allow you to validate that your application beha
|
|
|
85
100
|
```yaml
|
|
86
101
|
- command: assert
|
|
87
102
|
expect: "The chatbot response is displayed correctly"
|
|
88
|
-
|
|
89
103
|
```
|
|
90
104
|
|
|
91
105
|
### Example: Asserting an image is present
|
|
@@ -100,8 +114,8 @@ Visual assertions in TestDriver allow you to validate that your application beha
|
|
|
100
114
|
```yaml
|
|
101
115
|
- command: assert
|
|
102
116
|
expect: "The video is playing"
|
|
103
|
-
|
|
104
117
|
```
|
|
118
|
+
|
|
105
119
|
---
|
|
106
120
|
|
|
107
121
|
## Benefits of visual assertions
|