testdriverai 5.2.1 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/test-install.yml +1 -1
- package/README.md +5 -11
- package/agent.js +135 -99
- package/docs/30x30.mdx +84 -0
- package/docs/action/browser.mdx +129 -0
- package/docs/action/os.mdx +157 -0
- package/docs/action/output.mdx +98 -0
- package/docs/action/performance.mdx +71 -0
- package/docs/action/prerun.mdx +80 -0
- package/docs/action/secrets.mdx +103 -0
- package/docs/action/setup.mdx +115 -0
- package/docs/bugs/jira.mdx +208 -0
- package/docs/cli/overview.mdx +65 -0
- package/docs/commands/assert.mdx +31 -0
- package/docs/commands/exec.mdx +42 -0
- package/docs/commands/focus-application.mdx +29 -0
- package/docs/commands/hover-image.mdx +32 -0
- package/docs/commands/hover-text.mdx +37 -0
- package/docs/commands/if.mdx +43 -0
- package/docs/commands/match-image.mdx +41 -0
- package/docs/commands/press-keys.mdx +30 -0
- package/docs/commands/run.mdx +30 -0
- package/docs/commands/scroll-until-image.mdx +33 -0
- package/docs/commands/scroll-until-text.mdx +37 -0
- package/docs/commands/scroll.mdx +33 -0
- package/docs/commands/type.mdx +29 -0
- package/docs/commands/wait-for-image.mdx +31 -0
- package/docs/commands/wait-for-text.mdx +35 -0
- package/docs/commands/wait.mdx +30 -0
- package/docs/docs.json +226 -0
- package/docs/exporting/playwright.mdx +159 -0
- package/docs/features/auto-healing.mdx +124 -0
- package/docs/features/cross-platform.mdx +106 -0
- package/docs/features/generation.mdx +180 -0
- package/docs/features/github.mdx +161 -0
- package/docs/features/parallel-testing.mdx +130 -0
- package/docs/features/reusable-snippets.mdx +124 -0
- package/docs/features/selectorless.mdx +62 -0
- package/docs/features/visual-assertions.mdx +123 -0
- package/docs/getting-started/ci.mdx +196 -0
- package/docs/getting-started/generating.mdx +210 -0
- package/docs/getting-started/running.mdx +67 -0
- package/docs/getting-started/setup.mdx +133 -0
- package/docs/getting-started/writing.mdx +99 -0
- package/docs/guide/assertions.mdx +195 -0
- package/docs/guide/authentication.mdx +150 -0
- package/docs/guide/code.mdx +169 -0
- package/docs/guide/locating.mdx +136 -0
- package/docs/guide/setup-teardown.mdx +161 -0
- package/docs/guide/variables.mdx +218 -0
- package/docs/guide/waiting.mdx +199 -0
- package/docs/importing/csv.mdx +196 -0
- package/docs/importing/gherkin.mdx +142 -0
- package/docs/importing/jira.mdx +172 -0
- package/docs/importing/testrail.mdx +161 -0
- package/docs/integrations/electron.mdx +152 -0
- package/docs/integrations/netlify.mdx +98 -0
- package/docs/integrations/vercel.mdx +177 -0
- package/docs/interactive/assert.mdx +51 -0
- package/docs/interactive/generate.mdx +41 -0
- package/docs/interactive/run.mdx +36 -0
- package/docs/interactive/save.mdx +53 -0
- package/docs/interactive/undo.mdx +47 -0
- package/docs/issues.mdx +9 -0
- package/docs/overview/comparison.mdx +82 -0
- package/docs/overview/faq.mdx +122 -0
- package/docs/overview/quickstart.mdx +66 -0
- package/docs/overview/what-is-testdriver.mdx +73 -0
- package/docs/quickstart.mdx +66 -0
- package/docs/reference/commands/scroll.mdx +0 -0
- package/docs/reference/interactive/assert.mdx +0 -0
- package/docs/security/action.mdx +62 -0
- package/docs/security/agent.mdx +62 -0
- package/docs/security/dashboard.mdx +0 -0
- package/docs/security/platform.mdx +54 -0
- package/docs/tutorials/advanced-test.mdx +79 -0
- package/docs/tutorials/basic-test.mdx +41 -0
- package/electron/icon.png +0 -0
- package/electron/overlay.html +7 -3
- package/electron/overlay.js +76 -16
- package/electron/tray-buffered.png +0 -0
- package/electron/tray.png +0 -0
- package/index.js +75 -34
- package/lib/commander.js +22 -1
- package/lib/commands.js +87 -19
- package/lib/config.js +10 -1
- package/lib/focus-application.js +30 -23
- package/lib/generator.js +58 -7
- package/lib/init.js +48 -19
- package/lib/ipc.js +50 -0
- package/lib/logger.js +19 -6
- package/lib/overlay.js +82 -36
- package/lib/parser.js +9 -7
- package/lib/resources/prerun.yaml +17 -0
- package/lib/sandbox.js +2 -3
- package/lib/sdk.js +0 -2
- package/lib/session.js +3 -1
- package/lib/speak.js +0 -2
- package/lib/subimage/opencv.js +0 -4
- package/lib/system.js +56 -39
- package/lib/upload-secrets.js +65 -0
- package/lib/validation.js +175 -0
- package/package.json +2 -1
- package/postinstall.js +0 -24
- package/lib/websockets.js +0 -85
- package/test.md +0 -8
- package/test.yml +0 -18
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Testing Multiple Browsers"
|
|
3
|
+
sidebarTitle: "Browsers"
|
|
4
|
+
description: "Configure prerun scripts to launch different browsers in TestDriver."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
Prerun scripts allow you to configure the TestDriver virtual machine (VM) to launch specific browsers before running your tests. This is particularly useful for testing your application across multiple browsers and ensuring compatibility.
|
|
9
|
+
|
|
10
|
+
By using prerun scripts, you can:
|
|
11
|
+
- Install and launch different browsers based on your test requirements.
|
|
12
|
+
- Customize the test environment for specific scenarios.
|
|
13
|
+
- Ensure consistent browser configurations across operating systems.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Supported Browsers
|
|
18
|
+
The following browsers can be installed and launched using prerun scripts:
|
|
19
|
+
- **Google Chrome**
|
|
20
|
+
- **Mozilla Firefox**
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Prerun Script Example: Installing and Launching Browsers
|
|
25
|
+
The following example demonstrates how to install and launch Google Chrome or Firefox on Windows, macOS, and Linux using a prerun script.
|
|
26
|
+
|
|
27
|
+
### Example: Prerun Script
|
|
28
|
+
```yaml
|
|
29
|
+
prerun: |
|
|
30
|
+
if [ "${{ matrix.browser }}" == "chrome" ]; then
|
|
31
|
+
if [ "${{ matrix.os }}" == "windows" ]; then
|
|
32
|
+
# Install and launch Google Chrome on Windows
|
|
33
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
34
|
+
Invoke-WebRequest -Uri "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile "$env:TEMP\chrome_installer.exe"
|
|
35
|
+
Start-Process -FilePath "$env:TEMP\chrome_installer.exe" -ArgumentList "/silent", "/install" -Wait
|
|
36
|
+
Start-Process -FilePath "C:\Program Files\Google\Chrome\Application\chrome.exe"
|
|
37
|
+
elif [ "${{ matrix.os }}" == "mac" ]; then
|
|
38
|
+
# Install and launch Google Chrome on macOS
|
|
39
|
+
brew install --cask google-chrome
|
|
40
|
+
open -a "Google Chrome"
|
|
41
|
+
else
|
|
42
|
+
# Install and launch Google Chrome on Linux
|
|
43
|
+
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
44
|
+
sudo apt install ./google-chrome-stable_current_amd64.deb -y
|
|
45
|
+
google-chrome &
|
|
46
|
+
fi
|
|
47
|
+
else
|
|
48
|
+
if [ "${{ matrix.os }}" == "windows" ]; then
|
|
49
|
+
# Install and launch Firefox on Windows
|
|
50
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
51
|
+
Invoke-WebRequest -Uri "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US" -OutFile "$env:TEMP\firefox_installer.exe"
|
|
52
|
+
Start-Process -FilePath "$env:TEMP\firefox_installer.exe" -ArgumentList "/S" -Wait
|
|
53
|
+
Start-Process -FilePath "C:\Program Files\Mozilla Firefox\firefox.exe"
|
|
54
|
+
elif [ "${{ matrix.os }}" == "mac" ]; then
|
|
55
|
+
# Install and launch Firefox on macOS
|
|
56
|
+
brew install --cask firefox
|
|
57
|
+
open -a "Firefox"
|
|
58
|
+
else
|
|
59
|
+
# Install and launch Firefox on Linux
|
|
60
|
+
sudo apt update
|
|
61
|
+
sudo apt install firefox -y
|
|
62
|
+
firefox &
|
|
63
|
+
fi
|
|
64
|
+
fi
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Testing Multiple Browsers
|
|
70
|
+
You can use the GitHub matrix strategy to test your application across multiple browsers. This ensures comprehensive browser compatibility testing.
|
|
71
|
+
|
|
72
|
+
### Example: Matrix Strategy for Browser Testing
|
|
73
|
+
```yaml
|
|
74
|
+
strategy:
|
|
75
|
+
matrix:
|
|
76
|
+
os: [windows, mac, linux]
|
|
77
|
+
browser: [chrome, firefox]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Full Workflow Example
|
|
81
|
+
```yaml
|
|
82
|
+
name: Test Action
|
|
83
|
+
|
|
84
|
+
permissions:
|
|
85
|
+
actions: read
|
|
86
|
+
contents: read
|
|
87
|
+
statuses: write
|
|
88
|
+
pull-requests: write
|
|
89
|
+
|
|
90
|
+
on:
|
|
91
|
+
pull_request:
|
|
92
|
+
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
|
|
93
|
+
|
|
94
|
+
jobs:
|
|
95
|
+
test-action:
|
|
96
|
+
name: Test Action
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
strategy:
|
|
99
|
+
matrix:
|
|
100
|
+
os: [windows, mac, linux]
|
|
101
|
+
browser: [chrome, firefox]
|
|
102
|
+
steps:
|
|
103
|
+
- name: Set up Node.js
|
|
104
|
+
uses: actions/setup-node@v3
|
|
105
|
+
with:
|
|
106
|
+
node-version: '16'
|
|
107
|
+
|
|
108
|
+
- uses: replayableio/testdriver-action@main
|
|
109
|
+
with:
|
|
110
|
+
prompt: |
|
|
111
|
+
1. open youtube
|
|
112
|
+
2. find a cat video
|
|
113
|
+
3. quit the browser
|
|
114
|
+
4. /summarize
|
|
115
|
+
os: ${{ matrix.os }}
|
|
116
|
+
prerun: |
|
|
117
|
+
# Add prerun script here
|
|
118
|
+
key: ${{ secrets.TESTDRIVER_API_KEY }}
|
|
119
|
+
env:
|
|
120
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
121
|
+
FORCE_COLOR: "3"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Notes
|
|
127
|
+
- **Cross-Platform Compatibility**: Ensure your prerun scripts are compatible with the operating system specified in the matrix.
|
|
128
|
+
- **Browser Versions**: Always install the latest stable versions of browsers to ensure compatibility with modern web standards.
|
|
129
|
+
- **Performance**: Launching browsers in prerun scripts ensures they are ready for immediate use during tests, reducing setup time.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Testing Multiple Operating Systems"
|
|
3
|
+
sidebarTitle: "Operating Systems"
|
|
4
|
+
description: "Configuring Operating Systems in TestDriver GitHub Action"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
The TestDriver GitHub Action allows you to run tests on multiple operating systems, enabling cross-platform compatibility testing. By configuring the `os` parameter, you can specify the operating system for your test environment. This flexibility ensures that your application behaves consistently across platforms.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Supported Operating Systems
|
|
13
|
+
The following operating systems are currently supported:
|
|
14
|
+
|
|
15
|
+
| OS | Version | Instance Type | Architecture | Notes |
|
|
16
|
+
|----------|--------------------------|---------------|----------------|--------------------------------|
|
|
17
|
+
| `windows`| Windows Server 2022 Base| `t2.large` | 64-bit (x86) | Available to all users. |
|
|
18
|
+
| `mac` | macOS Sonoma | `mac1.metal` | x86_64_mac | Available to Enterprise users. |
|
|
19
|
+
| `linux` | Ubuntu 20.04 LTS | `t2.large` | 64-bit (x86) | Default for most workflows. |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Configuring the Operating System
|
|
24
|
+
To specify the operating system, use the `os` parameter in the GitHub Action configuration. For example:
|
|
25
|
+
|
|
26
|
+
### Example: Running a Test on Windows
|
|
27
|
+
```yaml
|
|
28
|
+
with:
|
|
29
|
+
os: windows
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Example: Running a Test on macOS
|
|
33
|
+
```yaml
|
|
34
|
+
with:
|
|
35
|
+
os: mac
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Example: Running a Test on Linux
|
|
39
|
+
```yaml
|
|
40
|
+
with:
|
|
41
|
+
os: linux
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Prerun Scripts and OS-Specific Commands
|
|
47
|
+
Prerun scripts are executed on the specified operating system. The scripting language depends on the OS:
|
|
48
|
+
- **Windows**: Use PowerShell.
|
|
49
|
+
- **macOS**: Use Bash.
|
|
50
|
+
- **Linux**: Use Bash.
|
|
51
|
+
|
|
52
|
+
### Example: Installing Browsers Based on OS
|
|
53
|
+
The following example demonstrates how to install Google Chrome or Firefox on Windows, macOS, and Linux using a prerun script:
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
prerun: |
|
|
57
|
+
if [ "${{ matrix.browser }}" == "chrome" ]; then
|
|
58
|
+
if [ "${{ matrix.os }}" == "windows" ]; then
|
|
59
|
+
# Install Google Chrome on Windows
|
|
60
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
61
|
+
Invoke-WebRequest -Uri "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile "$env:TEMP\chrome_installer.exe"
|
|
62
|
+
Start-Process -FilePath "$env:TEMP\chrome_installer.exe" -ArgumentList "/silent", "/install" -Wait
|
|
63
|
+
elif [ "${{ matrix.os }}" == "mac" ]; then
|
|
64
|
+
# Install Google Chrome on macOS
|
|
65
|
+
brew install --cask google-chrome
|
|
66
|
+
else
|
|
67
|
+
# Install Google Chrome on Linux
|
|
68
|
+
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
69
|
+
sudo apt install ./google-chrome-stable_current_amd64.deb -y
|
|
70
|
+
fi
|
|
71
|
+
else
|
|
72
|
+
if [ "${{ matrix.os }}" == "windows" ]; then
|
|
73
|
+
# Install Firefox on Windows
|
|
74
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
75
|
+
Invoke-WebRequest -Uri "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US" -OutFile "$env:TEMP\firefox_installer.exe"
|
|
76
|
+
Start-Process -FilePath "$env:TEMP\firefox_installer.exe" -ArgumentList "/S" -Wait
|
|
77
|
+
elif [ "${{ matrix.os }}" == "mac" ]; then
|
|
78
|
+
# Install Firefox on macOS
|
|
79
|
+
brew install --cask firefox
|
|
80
|
+
else
|
|
81
|
+
# Install Firefox on Linux
|
|
82
|
+
sudo apt update
|
|
83
|
+
sudo apt install firefox -y
|
|
84
|
+
fi
|
|
85
|
+
fi
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Testing Multiple Operating Systems and Browsers
|
|
91
|
+
You can use the GitHub matrix strategy to test your application across multiple operating systems and browsers. This ensures comprehensive coverage for your tests.
|
|
92
|
+
|
|
93
|
+
### Example: Matrix Strategy for OS and Browser Testing
|
|
94
|
+
```yaml
|
|
95
|
+
strategy:
|
|
96
|
+
matrix:
|
|
97
|
+
os: [windows, mac, linux]
|
|
98
|
+
browser: [chrome, firefox]
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Full Workflow Example
|
|
102
|
+
```yaml
|
|
103
|
+
name: Test Action
|
|
104
|
+
|
|
105
|
+
permissions:
|
|
106
|
+
actions: read
|
|
107
|
+
contents: read
|
|
108
|
+
statuses: write
|
|
109
|
+
pull-requests: write
|
|
110
|
+
|
|
111
|
+
on:
|
|
112
|
+
pull_request:
|
|
113
|
+
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
|
|
114
|
+
|
|
115
|
+
jobs:
|
|
116
|
+
test-action:
|
|
117
|
+
name: Test Action
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
strategy:
|
|
120
|
+
matrix:
|
|
121
|
+
os: [windows, mac, linux]
|
|
122
|
+
browser: [chrome, firefox]
|
|
123
|
+
steps:
|
|
124
|
+
- name: Set up Node.js
|
|
125
|
+
uses: actions/setup-node@v3
|
|
126
|
+
with:
|
|
127
|
+
node-version: '16'
|
|
128
|
+
|
|
129
|
+
- name: Install Dashcam Chrome
|
|
130
|
+
run: |
|
|
131
|
+
npm init -y
|
|
132
|
+
npm install dashcam-chrome
|
|
133
|
+
|
|
134
|
+
- uses: replayableio/testdriver-action@main
|
|
135
|
+
with:
|
|
136
|
+
prompt: |
|
|
137
|
+
1. open youtube
|
|
138
|
+
2. find a cat video
|
|
139
|
+
3. quit the browser
|
|
140
|
+
4. /summarize
|
|
141
|
+
os: ${{ matrix.os }}
|
|
142
|
+
prerun: |
|
|
143
|
+
# Add prerun script here
|
|
144
|
+
key: ${{ secrets.TESTDRIVER_API_KEY }}
|
|
145
|
+
env:
|
|
146
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
147
|
+
FORCE_COLOR: "3"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Notes
|
|
153
|
+
- **macOS Availability**: macOS testing is only available to Enterprise customers.
|
|
154
|
+
- **Prerun Scripts**: Ensure your prerun scripts are compatible with the specified operating system.
|
|
155
|
+
- **Cross-Platform Testing**: Use the matrix strategy to test across multiple OS and browser combinations for maximum coverage.
|
|
156
|
+
- **Linux Default**: Linux is the default operating system for most workflows and is ideal for lightweight, fast testing.
|
|
157
|
+
```
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "GitHub Action Output"
|
|
3
|
+
sidebarTitle: "Action Output"
|
|
4
|
+
description: "Understanding and utilizing the output variables from the TestDriver GitHub Action"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
The TestDriver GitHub Action provides several output variables that can be used to create powerful workflows by chaining actions together. These outputs allow you to post results as comments, send notifications, or integrate with third-party test reporting tools.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Output Variables
|
|
13
|
+
|
|
14
|
+
| Variable | Description |
|
|
15
|
+
|------------|-----------------------------------------------------------------------------|
|
|
16
|
+
| `summary` | Contains the TestDriver AI text summary result of the action execution. |
|
|
17
|
+
| `link` | A link to the Dashcam dashboard for debugging test runs. |
|
|
18
|
+
| `markdown` | Markdown-formatted shareable link, including a screenshot of the desktop. |
|
|
19
|
+
| `success` | Indicates whether the action passed successfully (`true` or `false`). |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Example: Creating a Comment on a Pull Request
|
|
24
|
+
The following example demonstrates how to use the output variables to create a comment on a pull request after every TestDriver execution.
|
|
25
|
+
|
|
26
|
+
### Workflow Example
|
|
27
|
+
```yaml
|
|
28
|
+
name: TestDriver.ai
|
|
29
|
+
|
|
30
|
+
permissions:
|
|
31
|
+
actions: read
|
|
32
|
+
contents: read
|
|
33
|
+
statuses: write
|
|
34
|
+
pull-requests: write
|
|
35
|
+
|
|
36
|
+
on:
|
|
37
|
+
pull_request:
|
|
38
|
+
|
|
39
|
+
jobs:
|
|
40
|
+
test:
|
|
41
|
+
name: "TestDriver"
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
id: run-testdriver
|
|
44
|
+
steps:
|
|
45
|
+
- uses: dashcamio/testdriver@main
|
|
46
|
+
version: v4.0.0
|
|
47
|
+
key: ${{ secrets.TESTDRIVER_API_KEY }}
|
|
48
|
+
with:
|
|
49
|
+
prompt: |
|
|
50
|
+
1. /run /Users/ec2-user/actions-runner/_work/testdriver/testdriver/.testdriver/test.yml
|
|
51
|
+
env:
|
|
52
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
53
|
+
FORCE_COLOR: "3"
|
|
54
|
+
|
|
55
|
+
- name: Create comment on PR
|
|
56
|
+
if: ${{ always() }}
|
|
57
|
+
uses: peter-evans/create-or-update-comment@v3
|
|
58
|
+
with:
|
|
59
|
+
issue-number: ${{ github.event.pull_request.number }}
|
|
60
|
+
body: |
|
|
61
|
+
**Test Summary:**
|
|
62
|
+
${{ steps.run-testdriver.outputs.summary }}
|
|
63
|
+
|
|
64
|
+
**Markdown Report:**
|
|
65
|
+
${{ steps.run-testdriver.outputs.markdown }}
|
|
66
|
+
|
|
67
|
+
**Dashcam Link:**
|
|
68
|
+
[View Test Results](${{ steps.run-testdriver.outputs.link }})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Use Cases for Output Variables
|
|
74
|
+
|
|
75
|
+
### 1. Post Test Results as Comments
|
|
76
|
+
Use the `summary` and `markdown` outputs to post detailed test results as comments on pull requests. This provides immediate feedback to developers.
|
|
77
|
+
|
|
78
|
+
### 2. Send Notifications on Failure
|
|
79
|
+
Use the `success` output to trigger notifications (e.g., email or Slack) when a test fails.
|
|
80
|
+
|
|
81
|
+
Example:
|
|
82
|
+
```yaml
|
|
83
|
+
- name: Notify on Failure
|
|
84
|
+
if: ${{ steps.run-testdriver.outputs.success == 'false' }}
|
|
85
|
+
run: |
|
|
86
|
+
echo "Test failed! Sending notification..."
|
|
87
|
+
# Add your notification logic here
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. Integrate with Third-Party Tools
|
|
91
|
+
Use the `link` output to upload test results to third-party test reporting tools or dashboards.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Notes
|
|
96
|
+
- The `link` output provides a direct URL to the Dashcam dashboard, making it easy to debug test runs.
|
|
97
|
+
- The `markdown` output includes a screenshot of the desktop, which is useful for visualizing test results.
|
|
98
|
+
- Always use the `success` output to handle conditional workflows based on test outcomes.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Optimizing Performance in TestDriver"
|
|
3
|
+
sidebarTitle: "Performance Optimization"
|
|
4
|
+
description: "Optimizing Performance in TestDriver"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
Optimizing your TestDriver tests can significantly reduce execution time, ensuring faster feedback for developers and smoother CI/CD workflows. While TestDriver's AI-powered capabilities are robust, using them efficiently is key to achieving the best performance.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Tips for Improving Performance
|
|
13
|
+
|
|
14
|
+
### 1. Use Parallel Testing
|
|
15
|
+
Parallel testing allows you to split your test actions into multiple files and run them simultaneously. This can drastically reduce the total runtime of your test suite.
|
|
16
|
+
|
|
17
|
+
#### How to Implement Parallel Testing
|
|
18
|
+
- Divide your test steps into smaller, independent YAML files.
|
|
19
|
+
- Use the `run` command or GitHub matrix strategy to execute these files in parallel.
|
|
20
|
+
|
|
21
|
+
Example:
|
|
22
|
+
```yaml
|
|
23
|
+
strategy:
|
|
24
|
+
matrix:
|
|
25
|
+
test_file:
|
|
26
|
+
- tests/login.yml
|
|
27
|
+
- tests/search.yml
|
|
28
|
+
- tests/cart.yml
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### 2. Use Optimized Matching Methods
|
|
34
|
+
For actions like `hover-text`, `wait-for-text`, and `scroll-until-text`, use the `turbo` matching method instead of `ai`. The `turbo` method uses text similarity to quickly compute the most relevant match, making it about 40% faster than the `ai` method.
|
|
35
|
+
|
|
36
|
+
#### Example:
|
|
37
|
+
```yaml
|
|
38
|
+
command: hover-text
|
|
39
|
+
text: Sign In
|
|
40
|
+
description: login button
|
|
41
|
+
action: click
|
|
42
|
+
method: turbo
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
### 3. Use `async` Asserts
|
|
48
|
+
The `assert` command supports the `async: true` property, allowing you to create non-blocking assertions. This means your tests can continue running while the assertion is being validated, saving valuable time.
|
|
49
|
+
|
|
50
|
+
#### Example:
|
|
51
|
+
```yaml
|
|
52
|
+
command: assert
|
|
53
|
+
expect: The user is logged in
|
|
54
|
+
async: true
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Best Practices
|
|
60
|
+
- **Minimize AI Matching**: Use AI-powered matching methods only when necessary. For common actions, rely on optimized methods like `turbo`.
|
|
61
|
+
- **Break Down Tests**: Split large, monolithic test files into smaller, focused tests to enable parallel execution.
|
|
62
|
+
- **Leverage Asynchronous Features**: Use `async` properties wherever possible to avoid blocking test execution.
|
|
63
|
+
- **Monitor Performance**: Regularly review test execution times and identify bottlenecks.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
- Optimizing performance not only saves time but also reduces resource usage, making your CI/CD pipelines more efficient.
|
|
69
|
+
- For large test suites, combining parallel testing with optimized matching methods can lead to significant time savings.
|
|
70
|
+
- Always balance performance optimizations with test reliability to ensure accurate results.
|
|
71
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Prerun Scripts"
|
|
3
|
+
sidebarTitle: "Prerun Scripts"
|
|
4
|
+
description: "Learn how to customize and set up your TestDriver environment to optimize your CI/CD pipeline."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
Prerun scripts are commands executed on a TestDriver virtual machine (VM) before each test in a CI/CD pipeline. They are used to prepare the environment by provisioning the VM, installing dependencies, configuring settings, or building the application. This ensures a consistent and reproducible environment for every test execution.
|
|
9
|
+
|
|
10
|
+
By using prerun scripts, you can:
|
|
11
|
+
- Speed up test setup.
|
|
12
|
+
- Prevent test failures caused by inconsistent environments.
|
|
13
|
+
- Promote reproducible builds for reliable test results.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Use Cases
|
|
18
|
+
Prerun scripts are ideal for:
|
|
19
|
+
- Installing necessary dependencies (e.g., browsers, libraries, or tools).
|
|
20
|
+
- Building your application or running setup scripts.
|
|
21
|
+
- Configuring the VM to match specific test requirements.
|
|
22
|
+
- Preparing staging environments or accessing private resources.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Example: Installing Arc Browser
|
|
27
|
+
The following example demonstrates how to use a prerun script to download and install the Arc Browser on a Windows VM before running tests.
|
|
28
|
+
|
|
29
|
+
```yaml
|
|
30
|
+
# permissions and other setup here
|
|
31
|
+
|
|
32
|
+
jobs:
|
|
33
|
+
test:
|
|
34
|
+
name: "TestDriver"
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
steps:
|
|
37
|
+
# Use the TestDriver GitHub Action
|
|
38
|
+
- uses: testdriverai/action@main
|
|
39
|
+
with:
|
|
40
|
+
prerun: |
|
|
41
|
+
# Get the IPv6 address of the VM
|
|
42
|
+
Get-NetIPAddress -AddressFamily IPv6
|
|
43
|
+
# URL for the Arc browser installer
|
|
44
|
+
$installerUrl = "https://releases.arc.net/windows/ArcInstaller.exe"
|
|
45
|
+
# Location to save the installer
|
|
46
|
+
$installerPath = "$env:USERPROFILE\Downloads\ArcInstaller.exe"
|
|
47
|
+
# Download the Arc browser installer
|
|
48
|
+
Write-Host "Downloading Arc browser installer..."
|
|
49
|
+
Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath
|
|
50
|
+
# Check if the download was successful
|
|
51
|
+
if (Test-Path $installerPath) {
|
|
52
|
+
Write-Host "Download successful. Running the installer..."
|
|
53
|
+
Start-Process -FilePath $installerPath -ArgumentList '/silent' -Wait
|
|
54
|
+
Start-Sleep -Seconds 10
|
|
55
|
+
} else {
|
|
56
|
+
Write-Host "Failed to download the Arc browser installer."
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Key Points
|
|
63
|
+
- **Provisioning**: Prerun scripts allow you to provision the VM with the necessary tools and configurations before running tests.
|
|
64
|
+
- **Reproducibility**: By ensuring a consistent environment, prerun scripts help prevent flaky tests caused by environmental differences.
|
|
65
|
+
- **Flexibility**: You can use prerun scripts to customize the VM for specific test scenarios, such as installing alternative browsers or setting up staging environments.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Best Practices
|
|
70
|
+
- **Keep It Simple**: Write clear and concise prerun scripts to minimize setup time and reduce complexity.
|
|
71
|
+
- **Error Handling**: Include checks to verify that dependencies are installed successfully. Log errors to help debug issues.
|
|
72
|
+
- **Optimize Performance**: Cache dependencies or use lightweight tools to speed up the setup process.
|
|
73
|
+
- **Security**: Avoid hardcoding sensitive information in prerun scripts. Use GitHub secrets to securely pass credentials or tokens.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Notes
|
|
78
|
+
- Prerun scripts are executed on the VM before the test suite begins.
|
|
79
|
+
- They are essential for ensuring a consistent and reliable test environment.
|
|
80
|
+
- For advanced workflows, combine prerun scripts with TestDriver prompts to create dynamic and flexible test setups.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Managing Secrets in GitHub Actions"
|
|
3
|
+
sidebarTitle: "Secrets Management"
|
|
4
|
+
description: "Discover how to securely configure and optimize your TestDriver environment for seamless CI/CD workflows."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
When using TestDriver to test your application, you may need to securely store and use sensitive information such as usernames, passwords, API keys, or other secrets. GitHub Actions provides a secure way to manage these secrets, ensuring they are not exposed in your test files or logs.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Why Use Secrets?
|
|
13
|
+
- **Security**: Secrets are encrypted and stored securely in your GitHub repository.
|
|
14
|
+
- **Masking**: TestDriver automatically masks secrets in all test output, including debugging logs.
|
|
15
|
+
- **Reusability**: Secrets can be reused across multiple workflows and test files.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Step 1: Replace Hardcoded Secrets in Test Files
|
|
20
|
+
To securely use secrets in your TestDriver test files, replace hardcoded values with placeholders in the format `${TD_YOUR_SECRET}`. TestDriver will parse and mask any secrets that begin with `TD_`.
|
|
21
|
+
|
|
22
|
+
### Example Test File
|
|
23
|
+
```yaml
|
|
24
|
+
version: 4.1.35
|
|
25
|
+
steps:
|
|
26
|
+
- prompt: sign in with username and password
|
|
27
|
+
commands:
|
|
28
|
+
- command: focus-application
|
|
29
|
+
name: Google Chrome
|
|
30
|
+
- command: hover-text
|
|
31
|
+
text: Email or phone
|
|
32
|
+
description: email input field
|
|
33
|
+
action: click
|
|
34
|
+
- command: type
|
|
35
|
+
text: ${TD_USERNAME}
|
|
36
|
+
- command: hover-text
|
|
37
|
+
text: Next
|
|
38
|
+
description: next button after entering email
|
|
39
|
+
action: click
|
|
40
|
+
- command: hover-text
|
|
41
|
+
text: Password
|
|
42
|
+
description: password input field
|
|
43
|
+
action: click
|
|
44
|
+
- command: type
|
|
45
|
+
text: ${TD_PASSWORD}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Step 2: Add Secrets to Your GitHub Repository
|
|
51
|
+
1. Navigate to your GitHub repository.
|
|
52
|
+
2. Go to **Settings** > **Secrets and variables** > **Actions**.
|
|
53
|
+
3. Click **New repository secret**.
|
|
54
|
+
4. Add your secrets (e.g., `TD_USERNAME`, `TD_PASSWORD`, `TESTDRIVER_API_KEY`).
|
|
55
|
+
|
|
56
|
+
For detailed instructions, refer to the [GitHub Docs on using secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets).
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Step 3: Supply Secrets to GitHub Actions
|
|
61
|
+
When running TestDriver tests via GitHub Actions, supply your secrets in the `env` section of the workflow file.
|
|
62
|
+
|
|
63
|
+
### Example Workflow
|
|
64
|
+
```yaml
|
|
65
|
+
name: TestDriver Test
|
|
66
|
+
|
|
67
|
+
permissions:
|
|
68
|
+
actions: read
|
|
69
|
+
contents: read
|
|
70
|
+
statuses: write
|
|
71
|
+
pull-requests: write
|
|
72
|
+
|
|
73
|
+
jobs:
|
|
74
|
+
test:
|
|
75
|
+
name: "TestDriver"
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
steps:
|
|
78
|
+
- uses: testdriverai/action@main
|
|
79
|
+
with:
|
|
80
|
+
key: ${{ secrets.TESTDRIVER_API_KEY }}
|
|
81
|
+
prompt: |
|
|
82
|
+
1. /run tests/signin.yml
|
|
83
|
+
env:
|
|
84
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
85
|
+
TD_USERNAME: ${{ secrets.TD_USERNAME }}
|
|
86
|
+
TD_PASSWORD: ${{ secrets.TD_PASSWORD }}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Best Practices
|
|
92
|
+
- **Use Descriptive Names**: Name your secrets clearly (e.g., `TD_USERNAME`, `TD_PASSWORD`) to make them easy to identify.
|
|
93
|
+
- **Rotate Secrets Regularly**: Update your secrets periodically to enhance security.
|
|
94
|
+
- **Limit Access**: Only provide access to secrets for workflows and team members that require them.
|
|
95
|
+
- **Mask Secrets**: Ensure all secrets are masked in logs by using the `TD_` prefix.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Notes
|
|
100
|
+
- Secrets are encrypted and only accessible during the workflow run.
|
|
101
|
+
- TestDriver automatically masks secrets in test output to prevent accidental exposure.
|
|
102
|
+
- For additional security, avoid hardcoding sensitive information in your test files or workflows.
|
|
103
|
+
|