testdriverai 6.2.2 → 7.1.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/AGENTS.md +550 -0
- package/CODEOWNERS +0 -1
- package/README.md +126 -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 +300 -85
- 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 +910 -296
- package/agent/lib/redraw.js +129 -41
- package/agent/lib/sandbox.js +29 -6
- package/agent/lib/sdk.js +22 -0
- package/agent/lib/system.js +0 -3
- package/agent/lib/validation.js +1 -7
- package/debug-locate-response.js +82 -0
- package/debugger/index.html +15 -4
- package/docs/ARCHITECTURE.md +424 -0
- package/docs/AWESOME_LOGS_QUICK_REF.md +100 -0
- package/docs/MIGRATION.md +425 -0
- package/docs/PRESETS.md +210 -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 +286 -152
- package/docs/guide/best-practices-polling.mdx +154 -0
- 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/dashcam.mdx +497 -0
- package/docs/v7/api/doubleClick.mdx +102 -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/mouseDown.mdx +161 -0
- package/docs/v7/api/mouseUp.mdx +164 -0
- package/docs/v7/api/pressKeys.mdx +349 -0
- package/docs/v7/api/rightClick.mdx +123 -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/configuration.mdx +380 -0
- package/docs/v7/getting-started/quickstart.mdx +332 -0
- package/docs/v7/guides/best-practices.mdx +486 -0
- package/docs/v7/guides/caching-ai.mdx +215 -0
- package/docs/v7/guides/caching-selectors.mdx +292 -0
- package/docs/v7/guides/caching.mdx +366 -0
- package/docs/v7/guides/ci-cd/azure.mdx +587 -0
- package/docs/v7/guides/ci-cd/circleci.mdx +523 -0
- package/docs/v7/guides/ci-cd/github-actions.mdx +457 -0
- package/docs/v7/guides/ci-cd/gitlab.mdx +498 -0
- package/docs/v7/guides/ci-cd/jenkins.mdx +664 -0
- package/docs/v7/guides/ci-cd/travis.mdx +438 -0
- package/docs/v7/guides/debugging.mdx +349 -0
- package/docs/v7/guides/faq.mdx +393 -0
- package/docs/v7/guides/migration.mdx +562 -0
- package/docs/v7/guides/performance.mdx +517 -0
- package/docs/{getting-started → v7/guides}/self-hosting.mdx +11 -12
- package/docs/v7/guides/troubleshooting.mdx +526 -0
- package/docs/v7/guides/vitest-plugin.mdx +477 -0
- package/docs/v7/guides/vitest.mdx +535 -0
- package/docs/v7/platforms/linux.mdx +308 -0
- package/docs/v7/platforms/macos.mdx +433 -0
- package/docs/v7/platforms/windows.mdx +430 -0
- package/docs/v7/playwright.mdx +342 -0
- package/docs/v7/presets/chrome-extension.mdx +223 -0
- package/docs/v7/presets/chrome.mdx +287 -0
- package/docs/v7/presets/electron.mdx +435 -0
- package/docs/v7/presets/vscode.mdx +398 -0
- package/docs/v7/presets/webapp.mdx +396 -0
- package/docs/v7/progressive-apis/CORE.md +459 -0
- package/docs/v7/progressive-apis/HOOKS.md +360 -0
- package/docs/v7/progressive-apis/PROGRESSIVE_DISCLOSURE.md +230 -0
- package/docs/v7/progressive-apis/PROVISION.md +266 -0
- package/eslint.config.js +19 -1
- 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 +830 -0
- package/package.json +29 -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 +1028 -0
- package/sdk.js +2567 -0
- package/{.github/workflows/self-hosted.yml → self-hosted.yml} +13 -4
- package/setup/aws/cloudformation.yaml +9 -2
- package/src/core/Dashcam.js +469 -0
- package/src/core/index.d.ts +150 -0
- package/src/core/index.js +12 -0
- package/src/presets/index.mjs +331 -0
- package/src/vitest/extended.mjs +108 -0
- package/src/vitest/hooks.d.ts +119 -0
- package/src/vitest/hooks.mjs +298 -0
- package/src/vitest/index.mjs +64 -0
- package/src/vitest/lifecycle.mjs +277 -0
- package/src/vitest/utils.mjs +150 -0
- package/test/dashcam.test.js +137 -0
- package/test/mcp-example-test.yaml +27 -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 +26 -0
- package/testdriver/acceptance-sdk/auto-cache-key-demo.test.mjs +56 -0
- package/testdriver/acceptance-sdk/chrome-extension.test.mjs +89 -0
- package/testdriver/acceptance-sdk/drag-and-drop.test.mjs +58 -0
- package/testdriver/acceptance-sdk/element-not-found.test.mjs +25 -0
- package/testdriver/acceptance-sdk/exec-js.test.mjs +43 -0
- package/testdriver/acceptance-sdk/exec-output.test.mjs +59 -0
- package/testdriver/acceptance-sdk/exec-pwsh.test.mjs +57 -0
- package/testdriver/acceptance-sdk/focus-window.test.mjs +36 -0
- package/testdriver/acceptance-sdk/formatted-logging.test.mjs +26 -0
- package/testdriver/acceptance-sdk/hooks-example.test.mjs +38 -0
- package/testdriver/acceptance-sdk/hover-image.test.mjs +34 -0
- package/testdriver/acceptance-sdk/hover-text-with-description.test.mjs +38 -0
- package/testdriver/acceptance-sdk/hover-text.test.mjs +27 -0
- package/testdriver/acceptance-sdk/match-image.test.mjs +36 -0
- package/testdriver/acceptance-sdk/presets-example.test.mjs +87 -0
- package/testdriver/acceptance-sdk/press-keys.test.mjs +50 -0
- package/testdriver/acceptance-sdk/prompt.test.mjs +33 -0
- package/testdriver/acceptance-sdk/scroll-keyboard.test.mjs +38 -0
- package/testdriver/acceptance-sdk/scroll-until-image.test.mjs +39 -0
- package/testdriver/acceptance-sdk/scroll-until-text.test.mjs +28 -0
- package/testdriver/acceptance-sdk/scroll.test.mjs +41 -0
- package/testdriver/acceptance-sdk/setup/globalTeardown.mjs +11 -0
- package/testdriver/acceptance-sdk/setup/testHelpers.mjs +420 -0
- package/testdriver/acceptance-sdk/setup/vitestSetup.mjs +40 -0
- package/testdriver/acceptance-sdk/sully-ai.test.mjs +234 -0
- package/testdriver/acceptance-sdk/test-console-logs.test.mjs +42 -0
- package/testdriver/acceptance-sdk/type-checking-demo.js +49 -0
- package/testdriver/acceptance-sdk/type.test.mjs +45 -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 +66 -0
- package/vitest.config.mjs.bak +44 -0
- package/.github/workflows/acceptance-v6.yml +0 -169
- package/.vscode/mcp.json +0 -9
- 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,167 @@
|
|
|
1
|
+
# SDK Browser Rendering Feature
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The TestDriver SDK now supports automatic browser rendering of the sandbox environment, matching the behavior of the existing agent CLI. When connecting to a sandbox, the SDK will automatically open a browser window showing the live VNC session, allowing you to watch test execution in real-time.
|
|
6
|
+
|
|
7
|
+
## Changes Made
|
|
8
|
+
|
|
9
|
+
### 1. SDK Core (`sdk.js`)
|
|
10
|
+
|
|
11
|
+
#### Added Dependencies
|
|
12
|
+
- Imported `createDebuggerProcess` from `./agent/lib/debugger.js` to enable the debugger server
|
|
13
|
+
|
|
14
|
+
#### New Instance Variables
|
|
15
|
+
- `debuggerProcess`: Reference to the debugger server process
|
|
16
|
+
- `debuggerUrl`: URL of the debugger web interface
|
|
17
|
+
|
|
18
|
+
#### Enhanced `connect()` Method
|
|
19
|
+
- Automatically starts the debugger server when connecting (unless in headless mode)
|
|
20
|
+
- Calls `_renderSandbox()` after successful connection to open the browser window
|
|
21
|
+
- Supports new `headless` option to disable browser rendering
|
|
22
|
+
|
|
23
|
+
#### New Methods
|
|
24
|
+
|
|
25
|
+
**`_renderSandbox(instance)`**
|
|
26
|
+
- Constructs the VNC URL from the sandbox instance details
|
|
27
|
+
- Creates encoded data payload for the debugger
|
|
28
|
+
- Emits the `show-window` event with the debugger URL
|
|
29
|
+
|
|
30
|
+
**`_openBrowser(url)`**
|
|
31
|
+
- Uses the `open` npm package to launch the default browser
|
|
32
|
+
- Handles errors gracefully with fallback to manual URL copy
|
|
33
|
+
- Uses dynamic import for ES module compatibility
|
|
34
|
+
|
|
35
|
+
#### Enhanced `_setupLogging()` Method
|
|
36
|
+
- Added event listener for `show-window` events
|
|
37
|
+
- Automatically opens browser when event is emitted
|
|
38
|
+
- Respects CI mode (prints view-only URL instead of opening browser)
|
|
39
|
+
|
|
40
|
+
### 2. Documentation Updates
|
|
41
|
+
|
|
42
|
+
#### SDK README (`SDK_README.md`)
|
|
43
|
+
- Updated `connect()` method documentation
|
|
44
|
+
- Added `headless` parameter description
|
|
45
|
+
- Added note about automatic browser rendering behavior
|
|
46
|
+
- Provided examples for both headless and non-headless modes
|
|
47
|
+
|
|
48
|
+
### 3. Examples
|
|
49
|
+
|
|
50
|
+
#### `examples/sdk-with-browser.js`
|
|
51
|
+
- Demonstrates default behavior with browser rendering
|
|
52
|
+
- Shows how to use the SDK with visual feedback
|
|
53
|
+
- Includes detailed console output explaining what's happening
|
|
54
|
+
|
|
55
|
+
#### `examples/sdk-headless.js`
|
|
56
|
+
- Demonstrates headless mode for CI/CD environments
|
|
57
|
+
- Shows how to disable browser rendering
|
|
58
|
+
- Useful for automated testing scenarios
|
|
59
|
+
|
|
60
|
+
### 4. Tests
|
|
61
|
+
|
|
62
|
+
#### `testdriver/acceptance-sdk/sandbox-render.test.mjs`
|
|
63
|
+
- Verifies that the `show-window` event is emitted
|
|
64
|
+
- Tests basic interaction with the rendered sandbox
|
|
65
|
+
- Includes timeout handling for sandbox creation
|
|
66
|
+
|
|
67
|
+
## How It Works
|
|
68
|
+
|
|
69
|
+
1. **Connection Phase**
|
|
70
|
+
- When `connect()` is called without `headless: true`
|
|
71
|
+
- The debugger server is started on port 3000 (by default)
|
|
72
|
+
- The sandbox is created/connected as usual
|
|
73
|
+
|
|
74
|
+
2. **Rendering Phase**
|
|
75
|
+
- After successful connection, `_renderSandbox()` is called
|
|
76
|
+
- It constructs the VNC URL: `http://{instance.ip}:{vncPort}/vnc_lite.html?token=V3b8wG9`
|
|
77
|
+
- Creates data payload with resolution, URL, and token
|
|
78
|
+
- Builds debugger URL: `{debuggerUrl}?data={encodedData}`
|
|
79
|
+
|
|
80
|
+
3. **Browser Opening**
|
|
81
|
+
- The `show-window` event is emitted with the debugger URL
|
|
82
|
+
- The event listener in `_setupLogging()` catches it
|
|
83
|
+
- The `_openBrowser()` method is called
|
|
84
|
+
- Default browser opens to the debugger interface
|
|
85
|
+
- User can watch live test execution
|
|
86
|
+
|
|
87
|
+
## Usage Examples
|
|
88
|
+
|
|
89
|
+
### Default Behavior (Browser Opens)
|
|
90
|
+
|
|
91
|
+
```javascript
|
|
92
|
+
const TestDriver = require('testdriverai');
|
|
93
|
+
|
|
94
|
+
const client = new TestDriver(process.env.TD_API_KEY, {
|
|
95
|
+
logging: true
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
await client.auth();
|
|
99
|
+
await client.connect(); // Browser opens automatically
|
|
100
|
+
|
|
101
|
+
await client.hoverText('Submit');
|
|
102
|
+
await client.click();
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Headless Mode (No Browser)
|
|
106
|
+
|
|
107
|
+
```javascript
|
|
108
|
+
const TestDriver = require('testdriverai');
|
|
109
|
+
|
|
110
|
+
const client = new TestDriver(process.env.TD_API_KEY, {
|
|
111
|
+
logging: true
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
await client.auth();
|
|
115
|
+
await client.connect({ headless: true }); // No browser
|
|
116
|
+
|
|
117
|
+
await client.hoverText('Submit');
|
|
118
|
+
await client.click();
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### CI/CD Mode
|
|
122
|
+
|
|
123
|
+
When `CI` environment variable is set or `config.CI` is true, the SDK will:
|
|
124
|
+
- Print the view-only URL instead of opening a browser
|
|
125
|
+
- Allow monitoring without interrupting the test flow
|
|
126
|
+
|
|
127
|
+
## Benefits
|
|
128
|
+
|
|
129
|
+
1. **Visual Feedback**: Developers can watch tests execute in real-time
|
|
130
|
+
2. **Debugging**: Easier to understand test failures by seeing what's happening
|
|
131
|
+
3. **Consistency**: Matches the behavior of the CLI tool
|
|
132
|
+
4. **Flexibility**: Can be disabled for CI/CD with `headless: true`
|
|
133
|
+
5. **No Code Changes**: Existing SDK code continues to work (default behavior adds browser)
|
|
134
|
+
|
|
135
|
+
## Compatibility
|
|
136
|
+
|
|
137
|
+
- Works on macOS, Linux, and Windows
|
|
138
|
+
- Requires the `open` npm package (already a dependency)
|
|
139
|
+
- Debugger server starts automatically when needed
|
|
140
|
+
- Falls back gracefully if browser can't be opened (prints URL)
|
|
141
|
+
|
|
142
|
+
## Testing
|
|
143
|
+
|
|
144
|
+
Run the test to verify functionality:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
TD_API_KEY=your_key npx vitest run testdriver/acceptance-sdk/sandbox-render.test.mjs
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Or try the examples:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# With browser rendering
|
|
154
|
+
TD_API_KEY=your_key node examples/sdk-with-browser.js
|
|
155
|
+
|
|
156
|
+
# Headless mode
|
|
157
|
+
TD_API_KEY=your_key node examples/sdk-headless.js
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Future Enhancements
|
|
161
|
+
|
|
162
|
+
Potential improvements:
|
|
163
|
+
- Allow custom debugger port configuration
|
|
164
|
+
- Support for multiple concurrent sandbox windows
|
|
165
|
+
- Option to disable debugger server entirely
|
|
166
|
+
- Custom browser selection
|
|
167
|
+
- Headless mode detection based on environment
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Self-Hosting TestDriver"
|
|
3
|
+
sidebarTitle: "Self-Hosting"
|
|
4
|
+
description: "Complete guide to self-hosting TestDriver instances on AWS"
|
|
5
|
+
icon: "server"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
```mermaid
|
|
9
|
+
graph LR
|
|
10
|
+
A[CLI] <--> B[api.testdriver.ai]
|
|
11
|
+
B <--> C[Your AWS EC2 Instance]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Self-hosting TestDriver allows you to run tests on your own infrastructure, giving you full control over the environment, security, and configurations. This guide walks you through setting up and managing self-hosted TestDriver instances using AWS.
|
|
15
|
+
|
|
16
|
+
## Why self host?
|
|
17
|
+
|
|
18
|
+
Self-hosting TestDriver gives you complete control over your test execution environment:
|
|
19
|
+
|
|
20
|
+
- **Enhanced security**: Get complete control over ingress and egress rules.
|
|
21
|
+
- **Complete customization**: Modify the TestDriver Golden Image (our pre-configured AMI) to include custom dependencies, software, and configurations at launch time.
|
|
22
|
+
- **Powerful Infrastructure**: Run tests on bare metal infrastructure that support emulators and simulators.
|
|
23
|
+
|
|
24
|
+
You'll use the [TestDriver CLI repository](https://github.com/testdriverai/cli) which contains all the infrastructure templates and setup scripts needed for self-hosting.
|
|
25
|
+
|
|
26
|
+
## Overview
|
|
27
|
+
|
|
28
|
+
By the end of this guide, you'll have a complete self-hosted testing infrastructure that can:
|
|
29
|
+
|
|
30
|
+
- Spawn TestDriver instances on-demand in your AWS account
|
|
31
|
+
- Run tests on your own AWS infrastructure with custom configurations
|
|
32
|
+
- Integrate seamlessly with GitHub Actions CI/CD workflows
|
|
33
|
+
- Automatically clean up resources after test completion
|
|
34
|
+
|
|
35
|
+
The setup process involves three main steps:
|
|
36
|
+
|
|
37
|
+
1. **CloudFormation Infrastructure**: Deploy our `setup/aws/cloudformation.yaml` template to create the foundational AWS resources (VPC, security groups, IAM roles, and a launch template for instance creation).
|
|
38
|
+
2. **On-Demand Instance Spawning**: Use `setup/aws/spawn-runner.sh` with your Launch Template ID to programmatically spawn TestDriver instances whenever you need to run tests.
|
|
39
|
+
3. **GitHub Actions Integration**: Use `.github/workflows/self-hosted.yml` as a template for running tests in CI. This workflow demonstrates the complete lifecycle: spawning an instance, running tests, and shutting down the instance to minimize costs.
|
|
40
|
+
|
|
41
|
+
## Prerequisites
|
|
42
|
+
|
|
43
|
+
- AWS account with permissions to run CloudFormation.
|
|
44
|
+
- [AWS CLI](https://aws.amazon.com/cli/) installed locally.
|
|
45
|
+
|
|
46
|
+
<Tip>
|
|
47
|
+
Be sure to run `aws configure` with your credentials
|
|
48
|
+
</Tip>
|
|
49
|
+
- Access to the TestDriver AMI (Golden Image is `ami-055cd47506a2f39bb`)\
|
|
50
|
+
[Contact us with your preferred AWS Region for access](https://form.typeform.com/to/UECf9rDx?typeform-source=testdriver.ai).
|
|
51
|
+
- A GitHub repository for committing your tests & workflow.
|
|
52
|
+
|
|
53
|
+
## Step 1: Set Up AWS Infrastructure
|
|
54
|
+
|
|
55
|
+
### Deploy CloudFormation Stack
|
|
56
|
+
|
|
57
|
+
Our [`setup/aws/cloudformation.yaml`](https://github.com/testdriverai/cli/tree/main/setup/aws/cloudformation.yaml) template creates:
|
|
58
|
+
|
|
59
|
+
- Dedicated VPC with public subnet
|
|
60
|
+
- Security group with proper port access
|
|
61
|
+
- IAM roles and instance profiles
|
|
62
|
+
- EC2 launch template for programmatic instance creation
|
|
63
|
+
|
|
64
|
+
This is a one-time setup used to generate a template ID for launching instances.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Deploy the CloudFormation stack
|
|
68
|
+
aws cloudformation deploy \
|
|
69
|
+
--template-file setup/aws/cloudformation.yaml \
|
|
70
|
+
--stack-name my-testdriver-infrastructure \
|
|
71
|
+
--parameter-overrides \
|
|
72
|
+
ProjectTag=testdriver \
|
|
73
|
+
AllowedIngressCidr=0.0.0.0/0 \
|
|
74
|
+
InstanceType=c5.xlarge \
|
|
75
|
+
CreateKeyPair=true \
|
|
76
|
+
--capabilities CAPABILITY_IAM
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
<Danger>
|
|
80
|
+
**Security**: Replace `AllowedIngressCidr=0.0.0.0/0` with your specific IP ranges to lock down access to your VPC.
|
|
81
|
+
</Danger>
|
|
82
|
+
|
|
83
|
+
### Get Launch Template ID
|
|
84
|
+
|
|
85
|
+
After CloudFormation completes, find the launch template ID in the stack outputs:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
aws cloudformation describe-stacks \
|
|
89
|
+
--stack-name my-testdriver-infrastructure \
|
|
90
|
+
--query 'Stacks[0].Outputs[?OutputKey==`LaunchTemplateId`].OutputValue' \
|
|
91
|
+
--output text
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
<Tip>
|
|
95
|
+
**Save this ID** – you'll need it for the next step.
|
|
96
|
+
</Tip>
|
|
97
|
+
|
|
98
|
+
## Step 2: Spawn a New TestDriver Runner
|
|
99
|
+
|
|
100
|
+
This step is performed **every time you want to run tests**. The `spawn-runner.sh` script launches a new EC2 instance on-demand for test execution.
|
|
101
|
+
|
|
102
|
+
### Using spawn-runner.sh
|
|
103
|
+
|
|
104
|
+
Our [`setup/aws/spawn-runner.sh`](https://github.com/testdriverai/cli/tree/main/setup/aws/spawn-runner.sh) script:
|
|
105
|
+
|
|
106
|
+
- Launches a new EC2 instance using your launch template from Step 1
|
|
107
|
+
- Waits for the instance to become ready
|
|
108
|
+
- Completes the TestDriver handshake
|
|
109
|
+
- Returns instance details (IP, instance ID) for CLI usage
|
|
110
|
+
|
|
111
|
+
The script accepts parameters as either environment variables or CLI arguments:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Launch an instance using environment variables
|
|
115
|
+
export AWS_REGION=us-east-2
|
|
116
|
+
export AMI_ID=ami-•••••••••• # Your TestDriver AMI (contact us to get one)
|
|
117
|
+
export AWS_LAUNCH_TEMPLATE_ID=lt-•••••••••• # From CloudFormation output from step 1
|
|
118
|
+
export RESOLUTION=1440x900 # Change screen resolution if desired (default is 1440x900)
|
|
119
|
+
|
|
120
|
+
/bin/bash ./setup/aws/spawn-runner.sh
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The script outputs:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
PUBLIC_IP=1.2.3.4
|
|
127
|
+
INSTANCE_ID=i-1234567890abcdef0
|
|
128
|
+
AWS_REGION=us-east-2
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
<Note>
|
|
132
|
+
**Instance Lifecycle**: Instances spawned by this script will continue running until you manually terminate them. They are automatically tagged with `Name=TestDriverRunner` and `Project=[your ProjectTag value]` for easy identification in the AWS console.
|
|
133
|
+
</Note>
|
|
134
|
+
|
|
135
|
+
#### Changing Resolution in Lifecycle Files
|
|
136
|
+
|
|
137
|
+
You can also change the resolution before running tests by adding an [`exec`](/commands/exec) command in your `lifecycle/provision.yaml` file:
|
|
138
|
+
|
|
139
|
+
```yaml lifecycle/provision.yaml
|
|
140
|
+
version: 6.0.0
|
|
141
|
+
steps:
|
|
142
|
+
- prompt: set screen resolution
|
|
143
|
+
commands:
|
|
144
|
+
- command: exec
|
|
145
|
+
lang: pwsh
|
|
146
|
+
code: |
|
|
147
|
+
C:\testdriver\SetResolution.ps1 -Width 1920 -Height 1080
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
This approach is useful when you need different resolutions for different test scenarios. See the [Lifecycle Files documentation](/guide/lifecycle) for more information about provision scripts.
|
|
151
|
+
|
|
152
|
+
### CLI Usage
|
|
153
|
+
|
|
154
|
+
Once you have an instance IP, run tests directly:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Basic test execution
|
|
158
|
+
npx testdriverai@latest run test.yaml --ip=1.2.3.4
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
You can use the `PUBLIC_IP` to target the instance you just spawned via `./setup/aws/spawn-runner.sh`:
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
npx testdriverai@latest run testdriver/your-test.yaml \
|
|
165
|
+
--ip="$PUBLIC_IP" \
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Terminating Instances
|
|
169
|
+
|
|
170
|
+
After your tests complete, terminate the instance to avoid unnecessary costs:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Terminate the instance
|
|
174
|
+
aws ec2 terminate-instances --instance-ids $INSTANCE_ID --region $AWS_REGION
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
You can also terminate instances manually through the AWS console by searching for instances tagged with `Name=TestDriverRunner`.
|
|
178
|
+
|
|
179
|
+
## Step 3: GitHub Actions Integration
|
|
180
|
+
|
|
181
|
+
This step shows you how to automate the entire test lifecycle in CI/CD.
|
|
182
|
+
|
|
183
|
+
### Example Workflow
|
|
184
|
+
|
|
185
|
+
Our [`.github/workflows/self-hosted.yml`](https://github.com/testdriverai/cli/tree/main/.github/workflows/self-hosted.yml) demonstrates the complete workflow: spawning an EC2 instance, running your tests, and shutting down the instance automatically to minimize costs.
|
|
186
|
+
|
|
187
|
+
The workflow uses the GitHub secrets you configure (see below) to authenticate with AWS and spawn instances on-demand:
|
|
188
|
+
|
|
189
|
+
```yaml
|
|
190
|
+
name: TestDriver Self-Hosted
|
|
191
|
+
|
|
192
|
+
on:
|
|
193
|
+
workflow_dispatch:
|
|
194
|
+
push:
|
|
195
|
+
|
|
196
|
+
jobs:
|
|
197
|
+
test:
|
|
198
|
+
runs-on: ubuntu-latest
|
|
199
|
+
steps:
|
|
200
|
+
- name: Checkout repository
|
|
201
|
+
uses: actions/checkout@v4
|
|
202
|
+
|
|
203
|
+
- name: Setup AWS Instance
|
|
204
|
+
id: aws-setup
|
|
205
|
+
run: |
|
|
206
|
+
OUTPUT=$(./setup/aws/spawn-runner.sh | tee /dev/stderr)
|
|
207
|
+
PUBLIC_IP=$(echo "$OUTPUT" | grep "PUBLIC_IP=" | cut -d'=' -f2)
|
|
208
|
+
INSTANCE_ID=$(echo "$OUTPUT" | grep "INSTANCE_ID=" | cut -d'=' -f2)
|
|
209
|
+
echo "public-ip=$PUBLIC_IP" >> $GITHUB_OUTPUT
|
|
210
|
+
echo "instance-id=$INSTANCE_ID" >> $GITHUB_OUTPUT
|
|
211
|
+
env:
|
|
212
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
213
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
214
|
+
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
215
|
+
AWS_LAUNCH_TEMPLATE_ID: ${{ secrets.AWS_LAUNCH_TEMPLATE_ID }}
|
|
216
|
+
AMI_ID: ${{ secrets.AMI_ID }}
|
|
217
|
+
|
|
218
|
+
- name: Run TestDriver
|
|
219
|
+
run: |
|
|
220
|
+
npx testdriverai run your-test.yaml \
|
|
221
|
+
--ip="${{ steps.aws-setup.outputs.public-ip }}"
|
|
222
|
+
env:
|
|
223
|
+
TD_API_KEY: ${{ secrets.TD_API_KEY }}
|
|
224
|
+
|
|
225
|
+
- name: Shutdown AWS Instance
|
|
226
|
+
if: always()
|
|
227
|
+
run: |
|
|
228
|
+
aws ec2 terminate-instances \
|
|
229
|
+
--region ${{ secrets.AWS_REGION }}
|
|
230
|
+
--instance-ids ${{ steps.aws-setup.outputs.instance-id }}
|
|
231
|
+
env:
|
|
232
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
233
|
+
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
234
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Required Secrets
|
|
238
|
+
|
|
239
|
+
Configure these secrets in your GitHub repository:
|
|
240
|
+
|
|
241
|
+
| Secret | Description | Example |
|
|
242
|
+
| ------------------------ | ----------------------------------- | ------------------------------------------------------------ |
|
|
243
|
+
| `AWS_ACCESS_KEY_ID` | AWS access key | `AKIAIOSFODNN7EXAMPLE` |
|
|
244
|
+
| `AWS_REGION` | AWS Region | `us-east-2` |
|
|
245
|
+
| `AWS_SECRET_ACCESS_KEY` | AWS secret key | `wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY` |
|
|
246
|
+
| `AWS_LAUNCH_TEMPLATE_ID` | Launch template from CloudFormation | `lt-07c53ce8349b958d1` |
|
|
247
|
+
| `AMI_ID` | TestDriver AMI ID | `ami-085f872ca0cd80fed` |
|
|
248
|
+
| `TD_API_KEY` | TestDriver API key | Your API key from [the dashboard](https://app.testdriver.ai) |
|
|
249
|
+
|
|
250
|
+
## AMI Customization
|
|
251
|
+
|
|
252
|
+
### Using the Base AMI
|
|
253
|
+
|
|
254
|
+
Our TestDriver Golden Image (AMI) comes pre-configured with everything you need to run tests:
|
|
255
|
+
|
|
256
|
+
**Operating System & Environment:**
|
|
257
|
+
|
|
258
|
+
- Windows Server with desktop environment
|
|
259
|
+
- VNC + web server for remote desktop access through the browser
|
|
260
|
+
|
|
261
|
+
**Development Tools:**
|
|
262
|
+
|
|
263
|
+
- Python (with pip)
|
|
264
|
+
- Node.js (with npm)
|
|
265
|
+
- Git
|
|
266
|
+
|
|
267
|
+
**Test Infrastructure:**
|
|
268
|
+
|
|
269
|
+
- TestDriver agent and dependencies
|
|
270
|
+
- Optimized settings for test execution
|
|
271
|
+
- Pre-configured networking for TestDriver CLI communication
|
|
272
|
+
|
|
273
|
+
### Modifying the AMI
|
|
274
|
+
|
|
275
|
+
<Danger>
|
|
276
|
+
**Change Default Password First**: The TestDriver AMI includes a default password for initial access. You MUST change this password before saving a new AMI. Never use the default password in production environments.
|
|
277
|
+
</Danger>
|
|
278
|
+
|
|
279
|
+
You can customize the AMI for your specific needs. Follow these steps carefully:
|
|
280
|
+
|
|
281
|
+
#### Step 1: Initial Access
|
|
282
|
+
|
|
283
|
+
Connect to your instance via RDP using the default credentials:
|
|
284
|
+
|
|
285
|
+
- **Username**: `testdriver`
|
|
286
|
+
- **Default Password**: `changemeABC123`
|
|
287
|
+
|
|
288
|
+
#### Step 2: Change the Password
|
|
289
|
+
|
|
290
|
+
Before doing anything else, change the default password:
|
|
291
|
+
|
|
292
|
+
1. Open PowerShell on the instance
|
|
293
|
+
2. Run the password rotation script:
|
|
294
|
+
```powershell
|
|
295
|
+
C:\testdriver\RotateLocalPasswords.ps1
|
|
296
|
+
```
|
|
297
|
+
3. **Save the new password securely** - you'll need it for all future access to this instance
|
|
298
|
+
|
|
299
|
+
<Note>
|
|
300
|
+
The password rotation script will generate a secure password for the `testdriver` account. Make sure to save this password in a secure location (password manager, secrets vault, etc.) before proceeding.
|
|
301
|
+
</Note>
|
|
302
|
+
|
|
303
|
+
#### Step 3: Make Your Customizations
|
|
304
|
+
|
|
305
|
+
Now that you've secured the instance with a new password:
|
|
306
|
+
|
|
307
|
+
1. **Make your changes** using the `testdriver` account with your new password
|
|
308
|
+
2. Install additional software as needed
|
|
309
|
+
3. Configure settings specific to your environment
|
|
310
|
+
|
|
311
|
+
<Tip>
|
|
312
|
+
**Need to make further customizations or debug issues?** RDP back into the instance using the `testdriver` account with the new password you set in Step 2. This gives you full desktop access to install software, modify configurations, or troubleshoot problems before saving your custom AMI.
|
|
313
|
+
</Tip>
|
|
314
|
+
|
|
315
|
+
#### Step 4: Save Your Custom AMI
|
|
316
|
+
|
|
317
|
+
1. **Create a new AMI** from your modified instance using the AWS console or CLI
|
|
318
|
+
2. **Update your workflow** to use the new AMI ID
|
|
319
|
+
|
|
320
|
+
### Amazon Image Builder
|
|
321
|
+
|
|
322
|
+
For automated AMI builds, use [Amazon EC2 Image Builder](https://aws.amazon.com/image-builder/):
|
|
323
|
+
|
|
324
|
+
```yaml
|
|
325
|
+
# Example Image Builder pipeline
|
|
326
|
+
Components:
|
|
327
|
+
- Name: testdriver-base
|
|
328
|
+
Version: 1.0.0
|
|
329
|
+
Platform: Windows
|
|
330
|
+
Type: BUILD
|
|
331
|
+
Data: |
|
|
332
|
+
name: TestDriver Custom Setup
|
|
333
|
+
description: Custom TestDriver AMI with additional software
|
|
334
|
+
schemaVersion: 1.0
|
|
335
|
+
phases:
|
|
336
|
+
- name: build
|
|
337
|
+
steps:
|
|
338
|
+
- name: InstallSoftware
|
|
339
|
+
action: ExecutePowerShell
|
|
340
|
+
inputs:
|
|
341
|
+
commands:
|
|
342
|
+
- "# Your custom installation commands here"
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## Security Considerations
|
|
346
|
+
|
|
347
|
+
### Network Security
|
|
348
|
+
|
|
349
|
+
1. **Restrict CIDR blocks**: Only allow access from your known IP ranges
|
|
350
|
+
2. **Use VPC endpoints**: For private communication with AWS services
|
|
351
|
+
3. **Enable VPC Flow Logs**: For network monitoring and debugging
|
|
352
|
+
|
|
353
|
+
### AWS Authentication
|
|
354
|
+
|
|
355
|
+
Use [OIDC for GitHub Actions](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect) instead of long-term credentials:
|
|
356
|
+
|
|
357
|
+
```yaml
|
|
358
|
+
permissions:
|
|
359
|
+
id-token: write
|
|
360
|
+
contents: read
|
|
361
|
+
|
|
362
|
+
steps:
|
|
363
|
+
- name: Configure AWS credentials
|
|
364
|
+
uses: aws-actions/configure-aws-credentials@v4
|
|
365
|
+
with:
|
|
366
|
+
role-to-assume: arn:aws:iam::123456789012:role/GitHubActionsRole
|
|
367
|
+
aws-region: us-east-2
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### Instance Security
|
|
371
|
+
|
|
372
|
+
- **Terminate instances** immediately after use
|
|
373
|
+
- **Monitor costs** with AWS billing alerts
|
|
374
|
+
- **Use least-privilege IAM roles** for instance profiles
|
|
375
|
+
- **Enable CloudTrail** for audit logging
|
|
376
|
+
|
|
377
|
+
## Troubleshooting
|
|
378
|
+
|
|
379
|
+
### Common Issues
|
|
380
|
+
|
|
381
|
+
**Instance not responding in TestDriver CLI:**
|
|
382
|
+
|
|
383
|
+
When the CLI displays connection errors or timeouts, check:
|
|
384
|
+
|
|
385
|
+
- **Security group rules**: The CloudFormation template configures all necessary ports (RDP 3389, VNC 5900, and TestDriver communication ports). Verify your security group hasn't been modified.
|
|
386
|
+
- **Instance status checks**: Ensure the instance has passed both system and instance status checks in the AWS console.
|
|
387
|
+
- **AMI compatibility**: Verify the AMI is compatible with your selected instance type (some instance types don't support certain AMIs).
|
|
388
|
+
|
|
389
|
+
**Connection timeouts:**
|
|
390
|
+
|
|
391
|
+
- Verify network connectivity from runner to instance
|
|
392
|
+
- Check VPC routing and internet gateway configuration
|
|
393
|
+
- Confirm instance is in correct subnet
|
|
394
|
+
|
|
395
|
+
**AWS CLI errors:**
|
|
396
|
+
|
|
397
|
+
- Validate AWS credentials and permissions
|
|
398
|
+
- Check AWS service quotas and limits
|
|
399
|
+
- Verify region consistency across all resources
|
|
400
|
+
|
|
401
|
+
### Getting Help
|
|
402
|
+
|
|
403
|
+
For enterprise customers:
|
|
404
|
+
|
|
405
|
+
- Contact your account manager for AMI access issues
|
|
406
|
+
- Use support channels for infrastructure questions
|
|
407
|
+
- Check the TestDriver documentation for CLI usage
|
|
@@ -83,7 +83,7 @@ Now in the same `lifecycle/prerun.yaml` script, we set up Dashcam to track web l
|
|
|
83
83
|
lang: pwsh
|
|
84
84
|
code: |
|
|
85
85
|
dashcam track --name="Web Logs" --type="web" --pattern="*"
|
|
86
|
-
dashcam track --name=TestDriver --type=
|
|
86
|
+
dashcam track --name=TestDriver --type=app --pattern="C:\Users\testdriver\Documents\testdriver.log"
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
### Starting Dashcam
|
|
@@ -11,11 +11,10 @@ import GitignoreWarning from "/snippets/gitignore-warning.mdx";
|
|
|
11
11
|
The supported environment variables in TestDriver are:
|
|
12
12
|
|
|
13
13
|
<div className="env-vars-table">
|
|
14
|
-
| Variable
|
|
15
|
-
|
|
16
|
-
| TD_ANALYTICS
|
|
17
|
-
|
|
18
|
-
spawn VMs with TestDriver Pro. |
|
|
14
|
+
| Variable | Type | Description |
|
|
15
|
+
|:---------------:|:------------:|:-------------------------------------------------------------------------------:|
|
|
16
|
+
| `TD_ANALYTICS` | `boolean` | Send analytics to TestDriver servers. This helps provide feedback to inform our roadmap. |
|
|
17
|
+
| `TD_API_KEY` | `string` | Set this to spawn VMs with TestDriver Pro. |
|
|
19
18
|
</div>
|
|
20
19
|
<GitignoreWarning />
|
|
21
20
|
## Example
|
|
@@ -88,7 +88,7 @@ steps:
|
|
|
88
88
|
commands:
|
|
89
89
|
- command: exec
|
|
90
90
|
lang: pwsh
|
|
91
|
-
code: dashcam track --name=TestDriver --type=
|
|
91
|
+
code: dashcam track --name=TestDriver --type=app --pattern="C:\Users\testdriver\Documents\testdriver.log"
|
|
92
92
|
- command: exec
|
|
93
93
|
lang: pwsh
|
|
94
94
|
code: dashcam start
|