testdriverai 5.7.17 → 5.7.20
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/testdriver.yml +25 -47
- package/CONTRIBUTING.md +45 -0
- package/README.md +1 -0
- package/docs/commands/assert.mdx +7 -0
- package/docs/commands/exec.mdx +7 -0
- package/docs/commands/hover-image.mdx +7 -0
- package/docs/commands/hover-text.mdx +7 -0
- package/docs/commands/match-image.mdx +7 -0
- package/docs/commands/scroll-until-text.mdx +15 -7
- package/docs/commands/type.mdx +7 -0
- package/docs/quickstart.mdx +55 -61
- package/docs/snippets/tests/assert-replay.mdx +1 -0
- package/docs/snippets/tests/assert-yaml.mdx +9 -0
- package/docs/snippets/tests/exec-js-replay.mdx +1 -0
- package/docs/snippets/tests/exec-js-yaml.mdx +51 -0
- package/docs/snippets/tests/exec-shell-replay.mdx +1 -0
- package/docs/snippets/tests/exec-shell-yaml.mdx +23 -0
- package/docs/snippets/tests/hover-image-replay.mdx +1 -0
- package/docs/snippets/tests/hover-image-yaml.mdx +19 -0
- package/docs/snippets/tests/hover-text-replay.mdx +1 -0
- package/docs/snippets/tests/hover-text-with-description-replay.mdx +1 -0
- package/docs/snippets/tests/hover-text-with-description-yaml.mdx +30 -0
- package/docs/snippets/tests/hover-text-yaml.mdx +15 -0
- package/docs/snippets/tests/match-image-replay.mdx +1 -0
- package/docs/snippets/tests/match-image-yaml.mdx +17 -0
- package/docs/snippets/tests/press-keys-replay.mdx +1 -0
- package/docs/snippets/tests/press-keys-yaml.mdx +15 -0
- package/docs/snippets/tests/prompt-replay.mdx +1 -0
- package/docs/snippets/tests/prompt-yaml.mdx +10 -0
- package/docs/snippets/tests/remember-replay.mdx +1 -0
- package/docs/snippets/tests/remember-yaml.mdx +9 -0
- package/docs/snippets/tests/scroll-until-text-replay.mdx +1 -0
- package/docs/snippets/tests/scroll-until-text-yaml.mdx +22 -0
- package/docs/snippets/tests/type-replay.mdx +1 -0
- package/docs/snippets/tests/type-yaml.mdx +31 -0
- package/package.json +1 -1
- package/testdriver/prompt.yaml +8 -0
- package/testdriver/snippets/login.yaml +7 -1
|
@@ -9,7 +9,6 @@ permissions:
|
|
|
9
9
|
on:
|
|
10
10
|
push:
|
|
11
11
|
branches: ["main"]
|
|
12
|
-
pull_request:
|
|
13
12
|
workflow_dispatch:
|
|
14
13
|
schedule:
|
|
15
14
|
- cron: "0 0 * * *"
|
|
@@ -50,7 +49,6 @@ jobs:
|
|
|
50
49
|
uses: testdriverai/action@main
|
|
51
50
|
with:
|
|
52
51
|
os: ${{ contains(matrix.os, 'windows') && 'windows' || 'linux' }}
|
|
53
|
-
version: "alpha"
|
|
54
52
|
prerun: |
|
|
55
53
|
exit
|
|
56
54
|
key: ${{ secrets.TESTDRIVER_API_KEY }}
|
|
@@ -62,28 +60,28 @@ jobs:
|
|
|
62
60
|
TD_WEBSITE: "https://testdriver-sandbox.vercel.app"
|
|
63
61
|
TD_VM_RESOLUTION: "1920x1080"
|
|
64
62
|
|
|
65
|
-
- name: Write MDX
|
|
63
|
+
- name: Write MDX snippets separately
|
|
66
64
|
run: |
|
|
67
65
|
mkdir -p snippets
|
|
68
|
-
FILE_NAME=$(basename "${{ matrix.test }}")
|
|
69
|
-
TEST_FILE="testdriver/$FILE_NAME"
|
|
70
|
-
DEST_FILE="snippets/${{ matrix.os }}-${FILE_NAME}.mdx"
|
|
66
|
+
FILE_NAME=$(basename "${{ matrix.test }}" .yaml)
|
|
67
|
+
TEST_FILE="testdriver/${FILE_NAME}.yaml"
|
|
71
68
|
|
|
72
|
-
|
|
73
|
-
PARAMS="embed=true×tamp=
|
|
69
|
+
EMBED_URL="${{ steps.testdriver.outputs.link }}"
|
|
70
|
+
PARAMS="embed=true×tamp=90000&playbackRate=5"
|
|
74
71
|
|
|
75
|
-
if [[ "$
|
|
76
|
-
EMBED_URL="${
|
|
72
|
+
if [[ "$EMBED_URL" == *\?* ]]; then
|
|
73
|
+
EMBED_URL="${EMBED_URL}&${PARAMS}"
|
|
77
74
|
else
|
|
78
|
-
EMBED_URL="${
|
|
75
|
+
EMBED_URL="${EMBED_URL}?${PARAMS}"
|
|
79
76
|
fi
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
echo
|
|
83
|
-
echo '```yaml' >> "$DEST_FILE"
|
|
84
|
-
cat "$TEST_FILE" >> "$DEST_FILE"
|
|
85
|
-
echo '```' >> "$DEST_FILE"
|
|
78
|
+
# Write iframe MDX
|
|
79
|
+
echo "<iframe src=\"$EMBED_URL\" width=\"100%\" height=\"300\" />" > "snippets/${FILE_NAME}-replay.mdx"
|
|
86
80
|
|
|
81
|
+
# Write YAML MDX
|
|
82
|
+
echo '```yaml' > "snippets/${FILE_NAME}-yaml.mdx"
|
|
83
|
+
cat "$TEST_FILE" >> "snippets/${FILE_NAME}-yaml.mdx"
|
|
84
|
+
echo '```' >> "snippets/${FILE_NAME}-yaml.mdx"
|
|
87
85
|
|
|
88
86
|
- name: Upload snippets artifact
|
|
89
87
|
uses: actions/upload-artifact@v4
|
|
@@ -91,16 +89,18 @@ jobs:
|
|
|
91
89
|
name: snippets-${{ matrix.os }}-${{ matrix.test }}
|
|
92
90
|
path: snippets/
|
|
93
91
|
retention-days: 1
|
|
94
|
-
|
|
95
92
|
create-snippets-commit:
|
|
96
93
|
name: Commit Snippets
|
|
97
94
|
needs: run-tests
|
|
98
95
|
runs-on: ubuntu-latest
|
|
96
|
+
if: ${{ always() }}
|
|
97
|
+
env:
|
|
98
|
+
BASE_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }}
|
|
99
99
|
steps:
|
|
100
100
|
- name: Check out current branch
|
|
101
101
|
uses: actions/checkout@v3
|
|
102
102
|
with:
|
|
103
|
-
ref: ${{ github.
|
|
103
|
+
ref: ${{ github.head_ref }}
|
|
104
104
|
|
|
105
105
|
- name: Download all snippets artifacts
|
|
106
106
|
uses: actions/download-artifact@v4
|
|
@@ -110,32 +110,10 @@ jobs:
|
|
|
110
110
|
merge-multiple: true
|
|
111
111
|
|
|
112
112
|
- name: Commit updated snippets
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
# Stage changes
|
|
122
|
-
git add docs/snippets/tests
|
|
123
|
-
|
|
124
|
-
# Commit if there are staged changes
|
|
125
|
-
if ! git diff --cached --quiet; then
|
|
126
|
-
git commit -m "Update test snippets [skip ci]"
|
|
127
|
-
|
|
128
|
-
# Extract the current branch name from GitHub Actions environment
|
|
129
|
-
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
|
|
130
|
-
|
|
131
|
-
# Fallback if BRANCH_NAME is empty (e.g., pull request event)
|
|
132
|
-
if [ -z "$BRANCH_NAME" ]; then
|
|
133
|
-
echo "Branch name not found in GITHUB_REF; defaulting to 'main'"
|
|
134
|
-
BRANCH_NAME="main"
|
|
135
|
-
fi
|
|
136
|
-
|
|
137
|
-
# Push the commit to the correct branch
|
|
138
|
-
git push origin HEAD:"$BRANCH_NAME"
|
|
139
|
-
else
|
|
140
|
-
echo "No changes to commit"
|
|
141
|
-
fi
|
|
113
|
+
uses: EndBug/add-and-commit@v9
|
|
114
|
+
with:
|
|
115
|
+
author_name: github-actions[bot]
|
|
116
|
+
author_email: github-actions[bot]@users.noreply.github.com
|
|
117
|
+
message: "Update test snippets [skip ci]"
|
|
118
|
+
add: "docs/snippets/tests"
|
|
119
|
+
new_branch: ${{ github.head_ref }}
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Setup `testdriverai` repo
|
|
4
|
+
|
|
5
|
+
1. `gh repo clone testdriverai/testdriverai`
|
|
6
|
+
1. `npm install` project dependencies
|
|
7
|
+
1. `npm link`
|
|
8
|
+
|
|
9
|
+
## Setting up a Test Project
|
|
10
|
+
|
|
11
|
+
1. `cd $(mktemp -d)` to create a blank project
|
|
12
|
+
1. `npm link testdriverai`
|
|
13
|
+
1. `npx testdriverai init`
|
|
14
|
+
|
|
15
|
+
> Spawning GUI...
|
|
16
|
+
> Howdy! I'm TestDriver v4.2.29
|
|
17
|
+
> Working on **/private/var/folders/4w/\_l20wtfj41n2dx0xyhb8xd740000gn/T/tmp.PDxTlOLJBS/testdriver/testdriver.yml**
|
|
18
|
+
> ...
|
|
19
|
+
|
|
20
|
+
1. `npx testdriverai testdriver/test.yml`
|
|
21
|
+
|
|
22
|
+
## Testing against local `api`
|
|
23
|
+
|
|
24
|
+
When running [replayableio/api](https://github.com/replayableio/api/) locally, specify `TD_API_ROOT` in your `.env` file or shell:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
TD_API_ROOT=http://localhost:1337 npx testdriverai
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Logging
|
|
31
|
+
|
|
32
|
+
- `DEV` to log the config
|
|
33
|
+
- `VERBOSE` to log `logger.debug` (Default: `logger.info` and above)
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
DEV=true VERBOSE=true npx testdriverai
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Debugging with Chrome Node Inspector
|
|
40
|
+
|
|
41
|
+
> https://nodejs.org/en/learn/getting-started/debugging
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npx --node-options=--inspect testdriverai init
|
|
45
|
+
```
|
package/README.md
CHANGED
package/docs/commands/assert.mdx
CHANGED
|
@@ -3,8 +3,15 @@ title: "assert"
|
|
|
3
3
|
sidebarTitle: "assert"
|
|
4
4
|
description: "Validate conditions during a test using the assert command."
|
|
5
5
|
icon: "check"
|
|
6
|
+
mode: "wide"
|
|
6
7
|
---
|
|
7
8
|
|
|
9
|
+
import Replay from '/snippets/tests/assert-replay.mdx'
|
|
10
|
+
import Example from '/snippets/tests/assert-yaml.mdx'
|
|
11
|
+
|
|
12
|
+
<Replay />
|
|
13
|
+
<Example />
|
|
14
|
+
|
|
8
15
|
## Description
|
|
9
16
|
The `assert` command validates that a specific condition is true. It ensures that a task completed successfully by checking the screen for the expected outcome. If the condition isn't met, the test will fail.
|
|
10
17
|
|
package/docs/commands/exec.mdx
CHANGED
|
@@ -3,8 +3,15 @@ title: "exec"
|
|
|
3
3
|
sidebarTitle: "exec"
|
|
4
4
|
description: "Execute custom shell or Node.js scripts within your tests."
|
|
5
5
|
icon: "code"
|
|
6
|
+
mode: "wide"
|
|
6
7
|
---
|
|
7
8
|
|
|
9
|
+
import Replay from '/snippets/tests/exec-shell-replay.mdx'
|
|
10
|
+
import Example from '/snippets/tests/exec-shell-yaml.mdx'
|
|
11
|
+
|
|
12
|
+
<Replay />
|
|
13
|
+
<Example />
|
|
14
|
+
|
|
8
15
|
## Description
|
|
9
16
|
The `exec` command allows you to execute custom Node.js scripts within your TestDriver tests. This is useful for tasks like generating dynamic data, interacting with APIs, or performing custom logic during a test. The output of the script can be stored in a variable for use in subsequent steps. It's important to note that the output from `exec` must be a `string`.
|
|
10
17
|
|
|
@@ -3,8 +3,15 @@ title: "hover-image"
|
|
|
3
3
|
sidebarTitle: "hover-image"
|
|
4
4
|
description: "Locate an image on the screen and perform an action."
|
|
5
5
|
icon: "image"
|
|
6
|
+
mode: "wide"
|
|
6
7
|
---
|
|
7
8
|
|
|
9
|
+
import Replay from '/snippets/tests/hover-image-replay.mdx'
|
|
10
|
+
import Example from '/snippets/tests/hover-image-yaml.mdx'
|
|
11
|
+
|
|
12
|
+
<Replay />
|
|
13
|
+
<Example />
|
|
14
|
+
|
|
8
15
|
## Description
|
|
9
16
|
|
|
10
17
|
The `hover-image` command is used to locate an image on the screen based on a description and perform an action on it. This can include hovering, clicking, right-clicking, or double-clicking the image.
|
|
@@ -3,8 +3,15 @@ title: "hover-text"
|
|
|
3
3
|
sidebarTitle: "hover-text"
|
|
4
4
|
description: "Locate text on the screen and perform an action."
|
|
5
5
|
icon: "text"
|
|
6
|
+
mode: "wide"
|
|
6
7
|
---
|
|
7
8
|
|
|
9
|
+
import Replay from '/snippets/tests/hover-text-replay.mdx'
|
|
10
|
+
import Example from '/snippets/tests/hover-text-yaml.mdx'
|
|
11
|
+
|
|
12
|
+
<Replay />
|
|
13
|
+
<Example />
|
|
14
|
+
|
|
8
15
|
## Description
|
|
9
16
|
The `hover-text` command is used to locate text on the screen based on a description and perform an action on it. This can include hovering, clicking, right-clicking, or double-clicking the text.
|
|
10
17
|
|
|
@@ -3,8 +3,15 @@ title: "match-image"
|
|
|
3
3
|
sidebarTitle: "match-image"
|
|
4
4
|
description: "Locate an image on the screen and perform an action."
|
|
5
5
|
icon: "images"
|
|
6
|
+
mode: "wide"
|
|
6
7
|
---
|
|
7
8
|
|
|
9
|
+
import Replay from '/snippets/tests/match-image-replay.mdx'
|
|
10
|
+
import Example from '/snippets/tests/match-image-yaml.mdx'
|
|
11
|
+
|
|
12
|
+
<Replay />
|
|
13
|
+
<Example />
|
|
14
|
+
|
|
8
15
|
## Description
|
|
9
16
|
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.
|
|
10
17
|
|
|
@@ -3,36 +3,44 @@ title: "scroll-until-text"
|
|
|
3
3
|
sidebarTitle: "scroll-until-text"
|
|
4
4
|
description: "Scroll the screen until the specified text is found."
|
|
5
5
|
icon: "scroll"
|
|
6
|
+
mode: "wide"
|
|
6
7
|
---
|
|
7
8
|
|
|
9
|
+
import Replay from '/snippets/tests/scroll-until-text-replay.mdx'
|
|
10
|
+
import Example from '/snippets/tests/scroll-until-text-yaml.mdx'
|
|
11
|
+
|
|
12
|
+
<Replay />
|
|
13
|
+
<Example />
|
|
14
|
+
|
|
8
15
|
## Description
|
|
9
16
|
The `scroll-until-text` command is used to scroll the screen in a specified direction until the specified text is found. This is useful for navigating to elements that aren't initially visible on the screen.
|
|
10
17
|
|
|
11
18
|
## Arguments
|
|
12
19
|
| Argument | Type | Description |
|
|
13
20
|
|-------------|----------|-----------------------------------------------------------------------------|
|
|
14
|
-
| `text` | `string` | The text to find on the screen. Longer and unique are better. |
|
|
21
|
+
| `text` | `string` | The text to find on the screen. Longer and unique are better. Note this is **case sensitive** |
|
|
15
22
|
| `direction` | `string` | The direction to scroll. Available directions are: `up`, `down`, `left`, `right`. |
|
|
16
|
-
| `distance` | `number` | (Optional) The maximum number of pixels to scroll before giving up. Default is `
|
|
17
|
-
| `method` | `enum` | (Optional) The matching algorithm to use. Possible values are `
|
|
23
|
+
| `distance` | `number` | (Optional) The maximum number of pixels to scroll before giving up. Default is `300`. |
|
|
24
|
+
| `method` | `enum` | (Optional) The matching algorithm to use. Possible values are `keyboard` (default) and `mouse`. |
|
|
18
25
|
|
|
19
26
|
## Example usage
|
|
20
27
|
```yaml
|
|
21
28
|
command: scroll-until-text
|
|
22
29
|
text: Sign Up
|
|
23
30
|
direction: down
|
|
31
|
+
method: keyboard
|
|
32
|
+
distance: 500
|
|
24
33
|
```
|
|
25
34
|
|
|
26
35
|
## Protips
|
|
27
36
|
- Use unique and specific text to improve detection accuracy.
|
|
28
|
-
-
|
|
29
|
-
- `
|
|
30
|
-
- `turbo`: Faster and more efficient for simpler scenarios.
|
|
31
|
-
- Adjust the `distance` value to control how far the command scrolls before giving up.
|
|
37
|
+
- Adjust the `distance` value to control how far the command scrolls before giving up.
|
|
38
|
+
- If you don't specify a `distance`, the command will scroll 300 pixels at a time, giving up after 5 attempts.
|
|
32
39
|
|
|
33
40
|
## Gotchas
|
|
34
41
|
- If the text can't be located within the specified `distance`, the command will fail.
|
|
35
42
|
- Ensure the text is visible and matches exactly, as variations in font size, style, or screen resolution may affect detection accuracy.
|
|
43
|
+
- Note that `text` is case-sensitive, so **Sign Up** and **sign up** would be treated as different strings.
|
|
36
44
|
|
|
37
45
|
## Notes
|
|
38
46
|
- The `scroll-until-text` command is ideal for navigating to elements that are off-screen and can't be located using other commands.
|
package/docs/commands/type.mdx
CHANGED
|
@@ -3,8 +3,15 @@ title: "type"
|
|
|
3
3
|
sidebarTitle: "type"
|
|
4
4
|
description: "Simulate typing a string using keyboard emulation."
|
|
5
5
|
icon: "typewriter"
|
|
6
|
+
mode: "wide"
|
|
6
7
|
---
|
|
7
8
|
|
|
9
|
+
import Replay from '/snippets/tests/type-replay.mdx'
|
|
10
|
+
import Example from '/snippets/tests/type-yaml.mdx'
|
|
11
|
+
|
|
12
|
+
<Replay />
|
|
13
|
+
<Example />
|
|
14
|
+
|
|
8
15
|
## Description
|
|
9
16
|
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.
|
|
10
17
|
|
package/docs/quickstart.mdx
CHANGED
|
@@ -3,66 +3,60 @@ title: "Quickstart"
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
<Steps>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</Step>
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- command:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
- command:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
testdriverai run path/to/test.yaml
|
|
61
|
-
```
|
|
62
|
-
</Step>
|
|
63
|
-
|
|
6
|
+
<Step title="Initialize Your Project" stepNumber={1}>
|
|
7
|
+
Set up your project with:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx testdriverai@beta init
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This creates a `.env` file and sample workflow files.
|
|
14
|
+
</Step>
|
|
15
|
+
<Step title="Run TestDriver in Interactive Mode" stepNumber={2}>
|
|
16
|
+
<Tip>
|
|
17
|
+
Always start with interactive mode (`testdriverai`) to explore and refine your tests before saving them. It's faster and more intuitive\!
|
|
18
|
+
</Tip>
|
|
19
|
+
Start TestDriver in interactive mode to create and refine tests dynamically:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx testdriverai@beta
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Once started, you can use commands like `/explore`, `/undo`, and `/save` to interactively build and test your flows.
|
|
26
|
+
</Step>
|
|
27
|
+
<Step title="Define Your Test Steps" stepNumber={3}>
|
|
28
|
+
Use natural language to describe what you want to test. For example:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
> Open Google Chrome and search for "testdriverai"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
TestDriver will generate steps like:
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
- command: focus-application
|
|
38
|
+
name: Google Chrome
|
|
39
|
+
- command: hover-text
|
|
40
|
+
text: Search Google or type a URL
|
|
41
|
+
description: main search bar
|
|
42
|
+
action: click
|
|
43
|
+
- command: type
|
|
44
|
+
text: testdriverai
|
|
45
|
+
- command: press-keys
|
|
46
|
+
keys: [enter]
|
|
47
|
+
```
|
|
48
|
+
</Step>
|
|
49
|
+
<Step title="Refine and Save Your Test" stepNumber={4}>
|
|
50
|
+
- Use `/undo` to remove the last step if needed.
|
|
51
|
+
- Save your test with `/save` to generate a reusable YAML file.
|
|
52
|
+
</Step>
|
|
53
|
+
<Step title="Run Saved Tests" stepNumber={5}>
|
|
54
|
+
Once saved, you can run your test file anytime:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx testdriverai@beta run path/to/test.yaml
|
|
58
|
+
```
|
|
59
|
+
</Step>
|
|
64
60
|
</Steps>
|
|
65
61
|
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
**Pro Tip:** Always start with interactive mode (`testdriverai`) to explore and refine your tests before saving them. It's faster and more intuitive!
|
|
62
|
+
---
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351db6d4ad9429e27959ea?share=8vj2IG9LBS2op3mDLux1cQ&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351d99d4ad9429e27959a3?share=NiFtJ2rH6G3TR30TK0W8uQ&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
```yaml
|
|
2
|
+
version: 5.7.7
|
|
3
|
+
session: 682f5fc22856e2eb40664269
|
|
4
|
+
steps:
|
|
5
|
+
- prompt: fetch user data from API
|
|
6
|
+
commands:
|
|
7
|
+
- command: exec
|
|
8
|
+
output: user
|
|
9
|
+
lang: js
|
|
10
|
+
linux: >
|
|
11
|
+
const response = await
|
|
12
|
+
fetch('https://jsonplaceholder.typicode.com/users');
|
|
13
|
+
|
|
14
|
+
const user = await response.json();
|
|
15
|
+
|
|
16
|
+
console.log('user', user[0]);
|
|
17
|
+
|
|
18
|
+
result = user[0].email;
|
|
19
|
+
mac: >
|
|
20
|
+
const response = await
|
|
21
|
+
fetch('https://jsonplaceholder.typicode.com/users');
|
|
22
|
+
|
|
23
|
+
const user = await response.json();
|
|
24
|
+
|
|
25
|
+
console.log('user', user[0]);
|
|
26
|
+
|
|
27
|
+
result = user[0].email;
|
|
28
|
+
windows: >
|
|
29
|
+
const response = await
|
|
30
|
+
fetch('https://jsonplaceholder.typicode.com/users');
|
|
31
|
+
|
|
32
|
+
const user = await response.json();
|
|
33
|
+
|
|
34
|
+
console.log('user', user[0]);
|
|
35
|
+
|
|
36
|
+
result = user[0].email;
|
|
37
|
+
- command: hover-text
|
|
38
|
+
text: Username
|
|
39
|
+
description: input field for username
|
|
40
|
+
action: click
|
|
41
|
+
- command: type
|
|
42
|
+
text: ${OUTPUT.user}
|
|
43
|
+
- prompt: assert that the username field shows a valid email address
|
|
44
|
+
commands:
|
|
45
|
+
- command: focus-application
|
|
46
|
+
name: Google Chrome
|
|
47
|
+
- command: assert
|
|
48
|
+
expect: >-
|
|
49
|
+
the username field contains "Sincere@april.biz" which is a valid email
|
|
50
|
+
address
|
|
51
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351d94d4ad9429e279599f?share=cZGF8hXRiEMVgjMb0mDDBA&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
```yaml
|
|
2
|
+
version: 5.1.1
|
|
3
|
+
session: 67f00511acbd9ccac373edf7
|
|
4
|
+
steps:
|
|
5
|
+
- prompt: launch chrome
|
|
6
|
+
commands:
|
|
7
|
+
- command: exec
|
|
8
|
+
lang: shell
|
|
9
|
+
linux: |
|
|
10
|
+
jumpapp google-chrome --disable-fre --no-default-browser-check --no-first-run "${TD_WEBSITE}" &
|
|
11
|
+
exit
|
|
12
|
+
mac: |
|
|
13
|
+
open -na "Google Chrome" --args --disable-fre --no-default-browser-check --no-first-run --disable-features=PasswordManagerEnabled "${TD_WEBSITE}" &
|
|
14
|
+
exit
|
|
15
|
+
windows:
|
|
16
|
+
Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "${TD_WEBSITE}"
|
|
17
|
+
exit
|
|
18
|
+
- command: wait-for-text
|
|
19
|
+
text: ${TD_WEBSITE}
|
|
20
|
+
timeout: 30000
|
|
21
|
+
- command: assert
|
|
22
|
+
expect: Google Chrome is running
|
|
23
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351dcdd4ad9429e2795a0c?share=XQWE3QZ2uklzOk3vkw9FyQ&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
```yaml
|
|
2
|
+
version: 5.7.7
|
|
3
|
+
session: 682f60bf2856e2eb4066427f
|
|
4
|
+
steps:
|
|
5
|
+
- commands:
|
|
6
|
+
- command: run
|
|
7
|
+
file: testdriver/snippets/login.yaml
|
|
8
|
+
- prompt: click on the image of a shopping cart
|
|
9
|
+
commands:
|
|
10
|
+
- command: focus-application
|
|
11
|
+
name: Google Chrome
|
|
12
|
+
- command: hover-image
|
|
13
|
+
description: shopping cart icon next to the Cart text in the top right corner
|
|
14
|
+
action: click
|
|
15
|
+
- prompt: assert that you see an empty shopping cart
|
|
16
|
+
commands:
|
|
17
|
+
- command: assert
|
|
18
|
+
expect: Your cart is empty
|
|
19
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351d99d4ad9429e27959a5?share=wy5uCSswzmKeVnOF9ykTVQ&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351de8d4ad9429e2795a23?share=d8W4FM0kL4mpNcWFlIcydA&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
```yaml
|
|
2
|
+
version: 5.7.7
|
|
3
|
+
session: 682f62f6811bd5a322c0e726
|
|
4
|
+
steps:
|
|
5
|
+
- commands:
|
|
6
|
+
- command: run
|
|
7
|
+
file: testdriver/snippets/login.yaml
|
|
8
|
+
- prompt: click on add to cart under the testdriver hat
|
|
9
|
+
commands:
|
|
10
|
+
- command: focus-application
|
|
11
|
+
name: Google Chrome
|
|
12
|
+
- command: hover-text
|
|
13
|
+
text: Add to Cart
|
|
14
|
+
description: add to cart button under TestDriver Hat
|
|
15
|
+
action: click
|
|
16
|
+
- prompt: click on the cart
|
|
17
|
+
commands:
|
|
18
|
+
- command: focus-application
|
|
19
|
+
name: Google Chrome
|
|
20
|
+
- command: hover-text
|
|
21
|
+
text: Cart
|
|
22
|
+
description: cart button in the top right corner
|
|
23
|
+
action: click
|
|
24
|
+
- prompt: assert the testdriver hat is in the cart
|
|
25
|
+
commands:
|
|
26
|
+
- command: focus-application
|
|
27
|
+
name: Google Chrome
|
|
28
|
+
- command: assert
|
|
29
|
+
expect: TestDriver Hat is in the cart
|
|
30
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
```yaml
|
|
2
|
+
version: 5.7.7
|
|
3
|
+
session: 682f5aab811bd5a322c0e5a1
|
|
4
|
+
steps:
|
|
5
|
+
- prompt: click on sign in
|
|
6
|
+
commands:
|
|
7
|
+
- command: focus-application
|
|
8
|
+
name: Google Chrome
|
|
9
|
+
- command: hover-text
|
|
10
|
+
text: Sign In
|
|
11
|
+
description: black button below the password field
|
|
12
|
+
action: click
|
|
13
|
+
- command: assert
|
|
14
|
+
expect: an error shows that fields are required
|
|
15
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351e134eab8fb09d7a02be?share=6iP9HGD99K5MrQ9viHNXlw&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
```yaml
|
|
2
|
+
version: 5.7.7
|
|
3
|
+
session: 682f5d92811bd5a322c0e636
|
|
4
|
+
steps:
|
|
5
|
+
- commands:
|
|
6
|
+
- command: run
|
|
7
|
+
file: testdriver/snippets/login.yaml
|
|
8
|
+
- prompt: assert the testdriver login page shows
|
|
9
|
+
commands:
|
|
10
|
+
- command: match-image
|
|
11
|
+
path: cart.png
|
|
12
|
+
action: click
|
|
13
|
+
- prompt: assert that you see an empty shopping cart
|
|
14
|
+
commands:
|
|
15
|
+
- command: assert
|
|
16
|
+
expect: Your cart is empty
|
|
17
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351d95d4ad9429e27959a1?share=d12VqX1HNl9EI6fue9X4oQ&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
```yaml
|
|
2
|
+
version: 5.7.7
|
|
3
|
+
session: 682f645a2856e2eb406642f8
|
|
4
|
+
steps:
|
|
5
|
+
- prompt: create a new tab
|
|
6
|
+
commands:
|
|
7
|
+
- command: focus-application
|
|
8
|
+
name: Google Chrome
|
|
9
|
+
- command: press-keys
|
|
10
|
+
keys:
|
|
11
|
+
- command
|
|
12
|
+
- t
|
|
13
|
+
- command: assert
|
|
14
|
+
expect: a new tab was created
|
|
15
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351dd2d4ad9429e2795a16?share=553Boxgy6msWi6ppY0JaEw&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351db54eab8fb09d7a0275?share=IGChVSHFcEtimjMNw2mfhA&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351dbb4eab8fb09d7a027a?share=GMinhsqf0mH4BYof0gLxWw&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
```yaml
|
|
2
|
+
version: 5.7.7
|
|
3
|
+
session: 682f62a1811bd5a322c0e70b
|
|
4
|
+
steps:
|
|
5
|
+
- commands:
|
|
6
|
+
- command: run
|
|
7
|
+
file: testdriver/snippets/login.yaml
|
|
8
|
+
- prompt: scroll until text testdriver socks
|
|
9
|
+
commands:
|
|
10
|
+
- command: focus-application
|
|
11
|
+
name: Google Chrome
|
|
12
|
+
- command: scroll-until-text
|
|
13
|
+
text: testdriver socks
|
|
14
|
+
direction: down
|
|
15
|
+
method: keyboard
|
|
16
|
+
- prompt: assert testdriver socks appears on screen
|
|
17
|
+
commands:
|
|
18
|
+
- command: focus-application
|
|
19
|
+
name: Google Chrome
|
|
20
|
+
- command: assert
|
|
21
|
+
expect: TestDriver Socks appears on screen
|
|
22
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<iframe src="https://app.dashcam.io/replay/68351dccd4ad9429e2795a09?share=9hjY4zYKcBrC6L10u0zRDg&embed=true×tamp=90000&playbackRate=5" width="100%" height="300" />
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
```yaml
|
|
2
|
+
version: 5.7.7
|
|
3
|
+
session: 682f5c4c811bd5a322c0e5c1
|
|
4
|
+
steps:
|
|
5
|
+
- prompt: enter standard_user within the username field
|
|
6
|
+
commands:
|
|
7
|
+
- command: focus-application
|
|
8
|
+
name: Google Chrome
|
|
9
|
+
- command: hover-text
|
|
10
|
+
text: Username
|
|
11
|
+
description: input field for username
|
|
12
|
+
action: click
|
|
13
|
+
- command: type
|
|
14
|
+
text: standard_user
|
|
15
|
+
- prompt: assert that standard_user shows in the username field
|
|
16
|
+
commands:
|
|
17
|
+
- command: assert
|
|
18
|
+
expect: the username field contains "standard_user"
|
|
19
|
+
- prompt: click on sign in
|
|
20
|
+
commands:
|
|
21
|
+
- command: hover-text
|
|
22
|
+
text: Sign in
|
|
23
|
+
description: black button below the password field
|
|
24
|
+
action: click
|
|
25
|
+
- prompt: assert that "please fill out this field" shows in the password field
|
|
26
|
+
commands:
|
|
27
|
+
- command: focus-application
|
|
28
|
+
name: Google Chrome
|
|
29
|
+
- command: assert
|
|
30
|
+
expect: Please fill out this field is visible near the password field
|
|
31
|
+
```
|
package/package.json
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
version: 5.7.7
|
|
2
2
|
session: 682f6071811bd5a322c0e6dd
|
|
3
3
|
steps:
|
|
4
|
-
- prompt:
|
|
4
|
+
- prompt: focus chrome
|
|
5
5
|
commands:
|
|
6
6
|
- command: focus-application
|
|
7
7
|
name: Google Chrome
|
|
8
|
+
- prompt: enter a username
|
|
9
|
+
commands:
|
|
8
10
|
- command: hover-text
|
|
9
11
|
text: Username
|
|
10
12
|
description: username input field
|
|
11
13
|
action: click
|
|
12
14
|
- command: type
|
|
13
15
|
text: standard_user
|
|
16
|
+
- prompt: enter a password
|
|
17
|
+
commands:
|
|
14
18
|
- command: hover-text
|
|
15
19
|
text: Password
|
|
16
20
|
description: password input field
|
|
17
21
|
action: click
|
|
18
22
|
- command: type
|
|
19
23
|
text: secret_password
|
|
24
|
+
- prompt: click sign in
|
|
25
|
+
commands:
|
|
20
26
|
- command: hover-text
|
|
21
27
|
text: Sign in
|
|
22
28
|
description: sign in button
|