testdriverai 6.2.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/acceptance-linux.yml +75 -0
- package/.github/workflows/acceptance-sdk-tests.yml +133 -0
- package/.vscode/settings.json +5 -1
- package/MIGRATION.md +389 -0
- package/PLUGIN_MIGRATION.md +222 -0
- package/PROMPT_CACHE.md +200 -0
- package/SDK_LOGGING.md +222 -0
- package/SDK_MIGRATION.md +474 -0
- package/SDK_README.md +1122 -0
- package/{testdriver → _testdriver}/acceptance/drag-and-drop.yaml +2 -2
- package/{testdriver → _testdriver}/acceptance/snippets/login.yaml +1 -1
- package/_testdriver/examples/desktop/lifecycle/prerun.yaml +0 -0
- package/{testdriver → _testdriver}/examples/web/lifecycle/prerun.yaml +6 -1
- package/{testdriver → _testdriver}/lifecycle/postrun.yaml +3 -2
- package/_testdriver/lifecycle/prerun.yaml +15 -0
- package/{testdriver → _testdriver}/lifecycle/provision.yaml +7 -2
- package/agent/index.js +258 -68
- package/agent/interface.js +15 -0
- package/agent/lib/cache.js +142 -0
- package/agent/lib/commander.js +1 -39
- package/agent/lib/commands.js +143 -188
- package/agent/lib/redraw.js +6 -3
- package/agent/lib/sandbox.js +19 -5
- package/agent/lib/sdk.js +1 -0
- package/agent/lib/system.js +0 -3
- package/agent/lib/validation.js +1 -7
- package/debug-locate-response.js +82 -0
- package/debug-screenshot-1763401388589.png +0 -0
- package/debugger/index.html +16 -5
- package/docs/ARCHITECTURE.md +424 -0
- package/docs/AWESOME_LOGS_QUICK_REF.md +100 -0
- package/docs/QUICK_START_TEST_RECORDING.md +215 -0
- package/docs/SDK_AWESOME_LOGS.md +468 -0
- package/docs/TEST_RECORDING.md +388 -0
- package/docs/docs.json +232 -152
- package/docs/sdk-browser-rendering.md +167 -0
- package/docs/v6/getting-started/self-hosting.mdx +407 -0
- package/docs/{guide → v6/guide}/dashcam.mdx +1 -1
- package/docs/{guide → v6/guide}/environment-variables.mdx +4 -5
- package/docs/{guide → v6/guide}/lifecycle.mdx +1 -1
- package/docs/v6/overview/comparison.mdx +101 -0
- package/docs/v7/README.md +135 -0
- package/docs/v7/api/ai.mdx +205 -0
- package/docs/v7/api/assert.mdx +285 -0
- package/docs/v7/api/assertions.mdx +403 -0
- package/docs/v7/api/click.mdx +287 -0
- package/docs/v7/api/client.mdx +322 -0
- package/docs/v7/api/elements.mdx +479 -0
- package/docs/v7/api/exec.mdx +346 -0
- package/docs/v7/api/find.mdx +316 -0
- package/docs/v7/api/focusApplication.mdx +294 -0
- package/docs/v7/api/hover.mdx +279 -0
- package/docs/v7/api/pressKeys.mdx +349 -0
- package/docs/v7/api/sandbox.mdx +404 -0
- package/docs/v7/api/scroll.mdx +300 -0
- package/docs/v7/api/type.mdx +314 -0
- package/docs/v7/commands/assert.mdx +45 -0
- package/docs/v7/commands/exec.mdx +282 -0
- package/docs/v7/commands/focus-application.mdx +44 -0
- package/docs/v7/commands/hover-image.mdx +69 -0
- package/docs/v7/commands/hover-text.mdx +47 -0
- package/docs/v7/commands/if.mdx +53 -0
- package/docs/v7/commands/match-image.mdx +67 -0
- package/docs/v7/commands/press-keys.mdx +87 -0
- package/docs/v7/commands/remember.mdx +49 -0
- package/docs/v7/commands/run.mdx +44 -0
- package/docs/v7/commands/scroll-until-image.mdx +66 -0
- package/docs/v7/commands/scroll-until-text.mdx +60 -0
- package/docs/v7/commands/scroll.mdx +69 -0
- package/docs/v7/commands/type.mdx +45 -0
- package/docs/v7/commands/wait-for-image.mdx +54 -0
- package/docs/v7/commands/wait-for-text.mdx +48 -0
- package/docs/v7/commands/wait.mdx +45 -0
- package/docs/v7/getting-started/quickstart.mdx +199 -0
- package/docs/v7/guides/migration.mdx +562 -0
- package/docs/{getting-started → v7/guides}/self-hosting.mdx +11 -12
- package/docs/v7/playwright.mdx +342 -0
- package/eslint.config.js +19 -1
- package/examples/run-tests-with-recording.sh +70 -0
- package/examples/screenshot-example.js +63 -0
- package/examples/sdk-awesome-logs-demo.js +177 -0
- package/examples/sdk-cache-thresholds.js +96 -0
- package/examples/sdk-element-properties.js +155 -0
- package/examples/sdk-simple-example.js +65 -0
- package/examples/test-recording-example.test.js +166 -0
- package/interfaces/cli/lib/base.js +10 -4
- package/interfaces/logger.js +2 -1
- package/interfaces/shared-test-state.mjs +69 -0
- package/interfaces/vitest-plugin.mjs +744 -0
- package/mcp-server/AI_GUIDELINES.md +57 -0
- package/package.json +18 -5
- package/schema.json +8 -29
- package/scripts/view-test-results.mjs +96 -0
- package/sdk-log-formatter.js +714 -0
- package/sdk.d.ts +735 -0
- package/sdk.js +1906 -0
- package/{.github/workflows/self-hosted.yml → self-hosted.yml} +13 -4
- package/setup/aws/cloudformation.yaml +9 -2
- package/test/mcp-example-test.yaml +27 -0
- package/test-find-api.js +73 -0
- package/test-prompt-cache.js +96 -0
- package/test-sandbox-render.js +28 -0
- package/test-sdk-methods.js +15 -0
- package/test-sdk-refactor.js +53 -0
- package/test-stack-trace.mjs +57 -0
- package/testdriver/acceptance-sdk/QUICK_REFERENCE.md +61 -0
- package/testdriver/acceptance-sdk/README.md +128 -0
- package/testdriver/acceptance-sdk/TEST_REPORTING.md +245 -0
- package/testdriver/acceptance-sdk/assert.test.mjs +44 -0
- package/testdriver/acceptance-sdk/drag-and-drop.test.mjs +70 -0
- package/testdriver/acceptance-sdk/element-not-found.test.mjs +38 -0
- package/testdriver/acceptance-sdk/exec-js.test.mjs +55 -0
- package/testdriver/acceptance-sdk/exec-output.test.mjs +71 -0
- package/testdriver/acceptance-sdk/exec-pwsh.test.mjs +69 -0
- package/testdriver/acceptance-sdk/focus-window.test.mjs +48 -0
- package/testdriver/acceptance-sdk/formatted-logging.test.mjs +41 -0
- package/testdriver/acceptance-sdk/hover-image.test.mjs +43 -0
- package/testdriver/acceptance-sdk/hover-text-with-description.test.mjs +50 -0
- package/testdriver/acceptance-sdk/hover-text.test.mjs +41 -0
- package/testdriver/acceptance-sdk/match-image.test.mjs +48 -0
- package/testdriver/acceptance-sdk/press-keys.test.mjs +64 -0
- package/testdriver/acceptance-sdk/prompt.test.mjs +45 -0
- package/testdriver/acceptance-sdk/scroll-keyboard.test.mjs +52 -0
- package/testdriver/acceptance-sdk/scroll-until-image.test.mjs +51 -0
- package/testdriver/acceptance-sdk/scroll-until-text.test.mjs +42 -0
- package/testdriver/acceptance-sdk/scroll.test.mjs +50 -0
- package/testdriver/acceptance-sdk/setup/globalTeardown.mjs +11 -0
- package/testdriver/acceptance-sdk/setup/lifecycleHelpers.mjs +239 -0
- package/testdriver/acceptance-sdk/setup/testHelpers.mjs +648 -0
- package/testdriver/acceptance-sdk/setup/vitestSetup.mjs +40 -0
- package/testdriver/acceptance-sdk/type-checking-demo.js +49 -0
- package/testdriver/acceptance-sdk/type.test.mjs +84 -0
- package/verify-element-api.js +89 -0
- package/verify-types.js +0 -0
- package/vitest.config.example.js +19 -0
- package/vitest.config.mjs +65 -0
- package/vitest.config.mjs.bak +44 -0
- package/.github/workflows/acceptance-v6.yml +0 -169
- package/docs/overview/comparison.mdx +0 -82
- package/testdriver/lifecycle/prerun.yaml +0 -17
- /package/{testdriver/examples/desktop/lifecycle/prerun.yaml → .env.example} +0 -0
- /package/{testdriver → _testdriver}/acceptance/assert.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/dashcam.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/embed.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/exec-js.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/exec-output.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/exec-shell.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/focus-window.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/hover-image.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/hover-text-with-description.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/hover-text.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/if-else.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/match-image.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/press-keys.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/prompt.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/remember.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/screenshots/cart.png +0 -0
- /package/{testdriver → _testdriver}/acceptance/scroll-keyboard.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/scroll-until-image.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/scroll-until-text.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/scroll.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/snippets/match-cart.yaml +0 -0
- /package/{testdriver → _testdriver}/acceptance/type.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/failure.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/hover-text.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/lifecycle/postrun.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/lifecycle/prerun.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/lifecycle/provision.yaml +0 -0
- /package/{testdriver → _testdriver}/behavior/secrets.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/dashcam-chrome.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/exec-pwsh-multiline.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/js-exception.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/js-promise.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/lifecycle/postrun.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/prompt-in-middle.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/prompt-nested.yaml +0 -0
- /package/{testdriver → _testdriver}/edge-cases/success-test.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/android/example.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/android/lifecycle/postrun.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/android/lifecycle/provision.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/android/readme.md +0 -0
- /package/{testdriver → _testdriver}/examples/chrome-extension/lifecycle/provision.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/desktop/lifecycle/provision.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/vscode-extension/lifecycle/provision.yaml +0 -0
- /package/{testdriver → _testdriver}/examples/web/lifecycle/postrun.yaml +0 -0
- /package/docs/{account → v6/account}/dashboard.mdx +0 -0
- /package/docs/{account → v6/account}/enterprise.mdx +0 -0
- /package/docs/{account → v6/account}/pricing.mdx +0 -0
- /package/docs/{account → v6/account}/projects.mdx +0 -0
- /package/docs/{account → v6/account}/team.mdx +0 -0
- /package/docs/{action → v6/action}/ami.mdx +0 -0
- /package/docs/{action → v6/action}/performance.mdx +0 -0
- /package/docs/{action → v6/action}/secrets.mdx +0 -0
- /package/docs/{apps → v6/apps}/chrome-extensions.mdx +0 -0
- /package/docs/{apps → v6/apps}/desktop-apps.mdx +0 -0
- /package/docs/{apps → v6/apps}/mobile-apps.mdx +0 -0
- /package/docs/{apps → v6/apps}/static-websites.mdx +0 -0
- /package/docs/{apps → v6/apps}/tauri-apps.mdx +0 -0
- /package/docs/{bugs → v6/bugs}/jira.mdx +0 -0
- /package/docs/{cli → v6/cli}/overview.mdx +0 -0
- /package/docs/{commands → v6/commands}/assert.mdx +0 -0
- /package/docs/{commands → v6/commands}/exec.mdx +0 -0
- /package/docs/{commands → v6/commands}/focus-application.mdx +0 -0
- /package/docs/{commands → v6/commands}/hover-image.mdx +0 -0
- /package/docs/{commands → v6/commands}/hover-text.mdx +0 -0
- /package/docs/{commands → v6/commands}/if.mdx +0 -0
- /package/docs/{commands → v6/commands}/match-image.mdx +0 -0
- /package/docs/{commands → v6/commands}/press-keys.mdx +0 -0
- /package/docs/{commands → v6/commands}/remember.mdx +0 -0
- /package/docs/{commands → v6/commands}/run.mdx +0 -0
- /package/docs/{commands → v6/commands}/scroll-until-image.mdx +0 -0
- /package/docs/{commands → v6/commands}/scroll-until-text.mdx +0 -0
- /package/docs/{commands → v6/commands}/scroll.mdx +0 -0
- /package/docs/{commands → v6/commands}/type.mdx +0 -0
- /package/docs/{commands → v6/commands}/wait-for-image.mdx +0 -0
- /package/docs/{commands → v6/commands}/wait-for-text.mdx +0 -0
- /package/docs/{commands → v6/commands}/wait.mdx +0 -0
- /package/docs/{exporting → v6/exporting}/junit.mdx +0 -0
- /package/docs/{exporting → v6/exporting}/playwright.mdx +0 -0
- /package/docs/{features → v6/features}/auto-healing.mdx +0 -0
- /package/docs/{features → v6/features}/generation.mdx +0 -0
- /package/docs/{features → v6/features}/parallel-testing.mdx +0 -0
- /package/docs/{features → v6/features}/reusable-snippets.mdx +0 -0
- /package/docs/{features → v6/features}/selectorless.mdx +0 -0
- /package/docs/{features → v6/features}/visual-assertions.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/ci.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/cli.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/editing.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/playwright.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/running.mdx +0 -0
- /package/docs/{getting-started → v6/getting-started}/vscode.mdx +0 -0
- /package/docs/{guide → v6/guide}/assertions.mdx +0 -0
- /package/docs/{guide → v6/guide}/authentication.mdx +0 -0
- /package/docs/{guide → v6/guide}/code.mdx +0 -0
- /package/docs/{guide → v6/guide}/locating.mdx +0 -0
- /package/docs/{guide → v6/guide}/protips.mdx +0 -0
- /package/docs/{guide → v6/guide}/variables.mdx +0 -0
- /package/docs/{guide → v6/guide}/waiting.mdx +0 -0
- /package/docs/{importing → v6/importing}/csv.mdx +0 -0
- /package/docs/{importing → v6/importing}/gherkin.mdx +0 -0
- /package/docs/{importing → v6/importing}/jira.mdx +0 -0
- /package/docs/{importing → v6/importing}/testrail.mdx +0 -0
- /package/docs/{integrations → v6/integrations}/electron.mdx +0 -0
- /package/docs/{integrations → v6/integrations}/netlify.mdx +0 -0
- /package/docs/{integrations → v6/integrations}/vercel.mdx +0 -0
- /package/docs/{interactive → v6/interactive}/explore.mdx +0 -0
- /package/docs/{interactive → v6/interactive}/run.mdx +0 -0
- /package/docs/{interactive → v6/interactive}/save.mdx +0 -0
- /package/docs/{overview → v6/overview}/faq.mdx +0 -0
- /package/docs/{overview → v6/overview}/performance.mdx +0 -0
- /package/docs/{overview → v6/overview}/quickstart.mdx +0 -0
- /package/docs/{overview → v6/overview}/what-is-testdriver.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/ai-chatbot.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/cookie-banner.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/file-upload.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/form-filling.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/log-in.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/pdf-generation.mdx +0 -0
- /package/docs/{scenarios → v6/scenarios}/spell-check.mdx +0 -0
- /package/docs/{security → v6/security}/action.mdx +0 -0
- /package/docs/{security → v6/security}/agent.mdx +0 -0
- /package/docs/{security → v6/security}/platform.mdx +0 -0
- /package/docs/{tutorials → v6/tutorials}/advanced-test.mdx +0 -0
- /package/docs/{tutorials → v6/tutorials}/basic-test.mdx +0 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
# TestDriver Test Recording and Dashboard Integration
|
|
2
|
+
|
|
3
|
+
This guide explains how to record test runs and associate them with dashcam recordings in the TestDriver dashboard.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The TestDriver test recording system tracks:
|
|
8
|
+
- **Test Runs**: Complete test suite executions
|
|
9
|
+
- **Test Cases**: Individual test results with pass/fail status
|
|
10
|
+
- **Sandboxes**: VM instances where tests run
|
|
11
|
+
- **Dashcam Recordings**: Screen recordings associated with tests
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
### 1. Install Vitest Plugin
|
|
16
|
+
|
|
17
|
+
The TestDriver Vitest plugin automatically records your test runs:
|
|
18
|
+
|
|
19
|
+
```javascript
|
|
20
|
+
// vitest.config.mjs
|
|
21
|
+
import { defineConfig } from 'vitest/config';
|
|
22
|
+
import testDriverPlugin from './interfaces/vitest-plugin.mjs';
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
plugins: [
|
|
26
|
+
testDriverPlugin({
|
|
27
|
+
apiKey: process.env.TD_API_KEY,
|
|
28
|
+
apiRoot: process.env.TD_API_ROOT || 'https://testdriver-api.onrender.com',
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2. Set Environment Variables
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Required: TestDriver API Key
|
|
38
|
+
export TD_API_KEY="your-api-key"
|
|
39
|
+
|
|
40
|
+
# Optional: Dashcam session ID for linking recordings
|
|
41
|
+
export DASHCAM_SESSION_ID="session-id-from-dashcam"
|
|
42
|
+
|
|
43
|
+
# Optional: Sandbox ID if running in TestDriver sandbox
|
|
44
|
+
export TD_SANDBOX_ID="sandbox-id"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 3. Run Tests
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx vitest run
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The reporter will automatically:
|
|
54
|
+
- Create a test run record
|
|
55
|
+
- Record each test case result
|
|
56
|
+
- Link to CI/CD metadata (GitHub Actions, GitLab CI, etc.)
|
|
57
|
+
- Associate with dashcam recordings when available
|
|
58
|
+
|
|
59
|
+
## Dashcam Integration
|
|
60
|
+
|
|
61
|
+
### Recording Tests with Dashcam
|
|
62
|
+
|
|
63
|
+
To capture screen recordings of your tests:
|
|
64
|
+
|
|
65
|
+
1. **Start Dashcam before tests**:
|
|
66
|
+
```bash
|
|
67
|
+
dashcam start
|
|
68
|
+
dashcam track --name="TestDriver" --type=application --pattern="/path/to/logs"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
2. **Run your tests** (with the Vitest reporter enabled)
|
|
72
|
+
|
|
73
|
+
3. **Stop Dashcam after tests**:
|
|
74
|
+
```bash
|
|
75
|
+
dashcam stop
|
|
76
|
+
dashcam publish -p PROJECT_ID
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Associating Recordings with Tests
|
|
80
|
+
|
|
81
|
+
The system links dashcam recordings to specific tests by parsing replay URLs from test output.
|
|
82
|
+
|
|
83
|
+
#### How It Works
|
|
84
|
+
|
|
85
|
+
1. **Dashcam publishes** and outputs a replay URL like:
|
|
86
|
+
```
|
|
87
|
+
https://app.dashcam.io/replay/691cf130c2fc02f59ae66fc1
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
2. **The reporter parses** test logs/output to find these URLs
|
|
91
|
+
|
|
92
|
+
3. **The URL contains the Replay DB ID** (e.g., `691cf130c2fc02f59ae66fc1`)
|
|
93
|
+
|
|
94
|
+
4. **The reporter associates** the test case with that replay
|
|
95
|
+
|
|
96
|
+
#### Option 1: Automatic from Test Output (Recommended)
|
|
97
|
+
|
|
98
|
+
If your test logs dashcam URLs, the reporter will automatically detect and link them:
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
test('my test', async () => {
|
|
102
|
+
// Your test code...
|
|
103
|
+
|
|
104
|
+
// Dashcam CLI outputs this during publish:
|
|
105
|
+
// ✅ Replay URL: https://app.dashcam.io/replay/691cf130c2fc02f59ae66fc1
|
|
106
|
+
|
|
107
|
+
// Reporter automatically parses and links it!
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
#### Option 2: Manual Environment Variable
|
|
112
|
+
|
|
113
|
+
Set the replay URL manually if needed:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
export DASHCAM_REPLAY_URL="https://app.dashcam.io/replay/691cf130c2fc02f59ae66fc1"
|
|
117
|
+
npx vitest run
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Option 3: Explicit SDK Call
|
|
121
|
+
|
|
122
|
+
Use the SDK to explicitly link a test to a replay:
|
|
123
|
+
|
|
124
|
+
```javascript
|
|
125
|
+
await client.recordTestCase({
|
|
126
|
+
runId: 'your-run-id',
|
|
127
|
+
testName: 'login test',
|
|
128
|
+
testFile: 'tests/login.test.js',
|
|
129
|
+
status: 'passed',
|
|
130
|
+
replayUrl: 'https://app.dashcam.io/replay/691cf130c2fc02f59ae66fc1'
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## CI/CD Integration
|
|
135
|
+
|
|
136
|
+
### GitHub Actions
|
|
137
|
+
|
|
138
|
+
The reporter automatically detects GitHub Actions and records:
|
|
139
|
+
- Workflow run ID
|
|
140
|
+
- Job ID
|
|
141
|
+
- Repository
|
|
142
|
+
- Branch
|
|
143
|
+
- Commit SHA
|
|
144
|
+
- Run URL
|
|
145
|
+
|
|
146
|
+
```yaml
|
|
147
|
+
# .github/workflows/test.yml
|
|
148
|
+
name: Tests
|
|
149
|
+
on: [push]
|
|
150
|
+
jobs:
|
|
151
|
+
test:
|
|
152
|
+
runs-on: windows-latest
|
|
153
|
+
steps:
|
|
154
|
+
- uses: actions/checkout@v3
|
|
155
|
+
- name: Setup Node
|
|
156
|
+
uses: actions/setup-node@v3
|
|
157
|
+
- name: Install dependencies
|
|
158
|
+
run: npm install
|
|
159
|
+
- name: Run tests
|
|
160
|
+
env:
|
|
161
|
+
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
162
|
+
run: npx vitest run
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### GitLab CI
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
# .gitlab-ci.yml
|
|
169
|
+
test:
|
|
170
|
+
script:
|
|
171
|
+
- npm install
|
|
172
|
+
- npx vitest run
|
|
173
|
+
variables:
|
|
174
|
+
TD_API_KEY: $CI_JOB_TOKEN
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Other CI Providers
|
|
178
|
+
|
|
179
|
+
The reporter auto-detects:
|
|
180
|
+
- CircleCI
|
|
181
|
+
- Travis CI
|
|
182
|
+
- Jenkins
|
|
183
|
+
- Buildkite
|
|
184
|
+
|
|
185
|
+
## API Endpoints
|
|
186
|
+
|
|
187
|
+
The following endpoints are available for custom integrations:
|
|
188
|
+
|
|
189
|
+
### Create Test Run
|
|
190
|
+
```
|
|
191
|
+
POST /api/v1/testdriver/test-run-create
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Body:**
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"runId": "unique-run-id",
|
|
198
|
+
"suiteName": "My Test Suite",
|
|
199
|
+
"platform": "windows",
|
|
200
|
+
"sandboxId": "sandbox-123",
|
|
201
|
+
"ci": {
|
|
202
|
+
"provider": "GitHub Actions",
|
|
203
|
+
"runId": "12345",
|
|
204
|
+
"url": "https://github.com/..."
|
|
205
|
+
},
|
|
206
|
+
"git": {
|
|
207
|
+
"repo": "owner/repo",
|
|
208
|
+
"branch": "main",
|
|
209
|
+
"commit": "abc123"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Complete Test Run
|
|
215
|
+
```
|
|
216
|
+
POST /api/v1/testdriver/test-run-complete
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Body:**
|
|
220
|
+
```json
|
|
221
|
+
{
|
|
222
|
+
"runId": "unique-run-id",
|
|
223
|
+
"status": "passed",
|
|
224
|
+
"totalTests": 10,
|
|
225
|
+
"passedTests": 10,
|
|
226
|
+
"failedTests": 0,
|
|
227
|
+
"skippedTests": 0
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Record Test Case
|
|
232
|
+
```
|
|
233
|
+
POST /api/v1/testdriver/test-case-create
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Body:**
|
|
237
|
+
```json
|
|
238
|
+
{
|
|
239
|
+
"runId": "unique-run-id",
|
|
240
|
+
"testName": "should login successfully",
|
|
241
|
+
"testFile": "tests/login.test.js",
|
|
242
|
+
"status": "passed",
|
|
243
|
+
"duration": 1500,
|
|
244
|
+
"replayUrl": "https://app.dashcam.io/replay/abc123",
|
|
245
|
+
"errorMessage": null,
|
|
246
|
+
"errorStack": null
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## SDK Methods
|
|
251
|
+
|
|
252
|
+
Use these methods in your test code:
|
|
253
|
+
|
|
254
|
+
### Create Test Run
|
|
255
|
+
```javascript
|
|
256
|
+
const testRun = await client.createTestRun({
|
|
257
|
+
runId: 'unique-id',
|
|
258
|
+
suiteName: 'My Tests',
|
|
259
|
+
platform: 'windows',
|
|
260
|
+
git: {
|
|
261
|
+
repo: 'myorg/myrepo',
|
|
262
|
+
branch: 'main',
|
|
263
|
+
commit: 'abc123'
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Record Test Case
|
|
269
|
+
```javascript
|
|
270
|
+
await client.recordTestCase({
|
|
271
|
+
runId: 'unique-id',
|
|
272
|
+
testName: 'my test',
|
|
273
|
+
testFile: 'tests/my.test.js',
|
|
274
|
+
status: 'passed',
|
|
275
|
+
duration: 1000,
|
|
276
|
+
replayUrl: 'https://app.dashcam.io/replay/xyz'
|
|
277
|
+
});
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Complete Test Run
|
|
281
|
+
```javascript
|
|
282
|
+
await client.completeTestRun({
|
|
283
|
+
runId: 'unique-id',
|
|
284
|
+
status: 'passed',
|
|
285
|
+
totalTests: 5,
|
|
286
|
+
passedTests: 5,
|
|
287
|
+
failedTests: 0
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Viewing Results
|
|
292
|
+
|
|
293
|
+
Access your test results in the TestDriver dashboard:
|
|
294
|
+
|
|
295
|
+
1. Navigate to **Dashboard** → **Test Runs**
|
|
296
|
+
2. View test run history with:
|
|
297
|
+
- Total/passed/failed test counts
|
|
298
|
+
- Duration and timing
|
|
299
|
+
- CI/CD integration links
|
|
300
|
+
- Associated dashcam recordings
|
|
301
|
+
3. Click on individual tests to see:
|
|
302
|
+
- Test details and error messages
|
|
303
|
+
- Linked dashcam replay (if available)
|
|
304
|
+
- Sandbox information
|
|
305
|
+
- Git commit and branch info
|
|
306
|
+
|
|
307
|
+
## Troubleshooting
|
|
308
|
+
|
|
309
|
+
### Tests recorded but no dashcam link
|
|
310
|
+
- Ensure `DASHCAM_SESSION_ID` is set
|
|
311
|
+
- Check that dashcam is running during tests
|
|
312
|
+
- Verify dashcam is publishing to the correct project
|
|
313
|
+
|
|
314
|
+
### Reporter not creating records
|
|
315
|
+
- Verify `TD_API_KEY` is set correctly
|
|
316
|
+
- Check network connectivity to TestDriver API
|
|
317
|
+
- Look for error messages in reporter output
|
|
318
|
+
|
|
319
|
+
### CI/CD metadata not captured
|
|
320
|
+
- Ensure CI environment variables are available
|
|
321
|
+
- Check that CI provider is supported
|
|
322
|
+
- Manually set git metadata if needed
|
|
323
|
+
|
|
324
|
+
## Advanced Usage
|
|
325
|
+
|
|
326
|
+
### Custom Test Metadata
|
|
327
|
+
|
|
328
|
+
Add custom metadata to tests:
|
|
329
|
+
|
|
330
|
+
```javascript
|
|
331
|
+
test('complex test', async () => {
|
|
332
|
+
await client.recordTestCase({
|
|
333
|
+
runId: process.env.TD_RUN_ID,
|
|
334
|
+
testName: 'complex test',
|
|
335
|
+
testFile: __filename,
|
|
336
|
+
status: 'passed',
|
|
337
|
+
tags: ['smoke', 'critical'],
|
|
338
|
+
steps: [
|
|
339
|
+
{ action: 'navigate', target: '/login' },
|
|
340
|
+
{ action: 'fill', target: 'username' },
|
|
341
|
+
{ action: 'click', target: 'submit' }
|
|
342
|
+
]
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Multiple Test Runs
|
|
348
|
+
|
|
349
|
+
Track parallel test runs:
|
|
350
|
+
|
|
351
|
+
```javascript
|
|
352
|
+
// Worker 1
|
|
353
|
+
const run1 = await client.createTestRun({
|
|
354
|
+
runId: 'run-1',
|
|
355
|
+
suiteName: 'Suite A'
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
// Worker 2
|
|
359
|
+
const run2 = await client.createTestRun({
|
|
360
|
+
runId: 'run-2',
|
|
361
|
+
suiteName: 'Suite B'
|
|
362
|
+
});
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Data Models
|
|
366
|
+
|
|
367
|
+
### TdTestRun
|
|
368
|
+
- Test suite execution tracking
|
|
369
|
+
- CI/CD and Git metadata
|
|
370
|
+
- Summary statistics
|
|
371
|
+
- Linked to sandbox and replays
|
|
372
|
+
|
|
373
|
+
### TdTestCase
|
|
374
|
+
- Individual test results
|
|
375
|
+
- Error messages and stack traces
|
|
376
|
+
- Associated dashcam replay
|
|
377
|
+
- Timing and duration
|
|
378
|
+
|
|
379
|
+
### TdSandbox
|
|
380
|
+
- VM/sandbox lifecycle tracking
|
|
381
|
+
- Platform and OS information
|
|
382
|
+
- Dashcam integration status
|
|
383
|
+
- Cost and usage metrics
|
|
384
|
+
|
|
385
|
+
### Replay
|
|
386
|
+
- Dashcam recordings
|
|
387
|
+
- Linked to test runs and cases
|
|
388
|
+
- Timestamp markers for test boundaries
|