@testdriverai/agent 7.8.0-test.38
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/.claude/settings.local.json +7 -0
- package/.env.example +4 -0
- package/.prettierignore +4 -0
- package/.prettierrc +1 -0
- package/CHANGELOG.md +953 -0
- package/README.md +81 -0
- package/agent/events.js +135 -0
- package/agent/index.js +2450 -0
- package/agent/interface.js +35 -0
- package/agent/lib/analytics.js +22 -0
- package/agent/lib/censorship.js +75 -0
- package/agent/lib/commander.js +246 -0
- package/agent/lib/commands.js +1684 -0
- package/agent/lib/config.js +60 -0
- package/agent/lib/generator.js +91 -0
- package/agent/lib/http.js +144 -0
- package/agent/lib/logger.js +56 -0
- package/agent/lib/outputs.js +29 -0
- package/agent/lib/parser.js +209 -0
- package/agent/lib/redraw.js +386 -0
- package/agent/lib/resources/cursor-2.png +0 -0
- package/agent/lib/sandbox.js +1104 -0
- package/agent/lib/sdk.js +633 -0
- package/agent/lib/session.js +25 -0
- package/agent/lib/source-mapper.js +342 -0
- package/agent/lib/subimage/index.js +77 -0
- package/agent/lib/subimage/opencv.js +69 -0
- package/agent/lib/system.js +204 -0
- package/agent/lib/theme.js +14 -0
- package/agent/lib/valid-version.js +21 -0
- package/agent/lib/validation.js +169 -0
- package/ai/.claude-plugin/plugin.json +9 -0
- package/ai/agents/testdriver.md +638 -0
- package/ai/skills/testdriver-ai/SKILL.md +204 -0
- package/ai/skills/testdriver-assert/SKILL.md +315 -0
- package/ai/skills/testdriver-aws-setup/SKILL.md +448 -0
- package/ai/skills/testdriver-cache/SKILL.md +221 -0
- package/ai/skills/testdriver-caching/SKILL.md +124 -0
- package/ai/skills/testdriver-captcha/SKILL.md +158 -0
- package/ai/skills/testdriver-ci-cd/SKILL.md +602 -0
- package/ai/skills/testdriver-click/SKILL.md +286 -0
- package/ai/skills/testdriver-client/SKILL.md +477 -0
- package/ai/skills/testdriver-cloud/SKILL.md +119 -0
- package/ai/skills/testdriver-customizing-devices/SKILL.md +319 -0
- package/ai/skills/testdriver-dashcam/SKILL.md +418 -0
- package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +401 -0
- package/ai/skills/testdriver-device-config/SKILL.md +317 -0
- package/ai/skills/testdriver-double-click/SKILL.md +102 -0
- package/ai/skills/testdriver-elements/SKILL.md +605 -0
- package/ai/skills/testdriver-enterprise/SKILL.md +114 -0
- package/ai/skills/testdriver-errors/SKILL.md +246 -0
- package/ai/skills/testdriver-events/SKILL.md +356 -0
- package/ai/skills/testdriver-examples/SKILL.md +7 -0
- package/ai/skills/testdriver-exec/SKILL.md +317 -0
- package/ai/skills/testdriver-find/SKILL.md +829 -0
- package/ai/skills/testdriver-focus-application/SKILL.md +293 -0
- package/ai/skills/testdriver-generating-tests/SKILL.md +36 -0
- package/ai/skills/testdriver-hover/SKILL.md +278 -0
- package/ai/skills/testdriver-locating-elements/SKILL.md +71 -0
- package/ai/skills/testdriver-making-assertions/SKILL.md +32 -0
- package/ai/skills/testdriver-mcp/SKILL.md +7 -0
- package/ai/skills/testdriver-mcp-workflow/SKILL.md +410 -0
- package/ai/skills/testdriver-mouse-down/SKILL.md +161 -0
- package/ai/skills/testdriver-mouse-up/SKILL.md +164 -0
- package/ai/skills/testdriver-parse/SKILL.md +236 -0
- package/ai/skills/testdriver-performing-actions/SKILL.md +54 -0
- package/ai/skills/testdriver-press-keys/SKILL.md +348 -0
- package/ai/skills/testdriver-provision/SKILL.md +331 -0
- package/ai/skills/testdriver-quickstart/SKILL.md +144 -0
- package/ai/skills/testdriver-redraw/SKILL.md +214 -0
- package/ai/skills/testdriver-reusable-code/SKILL.md +249 -0
- package/ai/skills/testdriver-right-click/SKILL.md +123 -0
- package/ai/skills/testdriver-running-tests/SKILL.md +185 -0
- package/ai/skills/testdriver-screenshot/SKILL.md +248 -0
- package/ai/skills/testdriver-screenshots/SKILL.md +184 -0
- package/ai/skills/testdriver-scroll/SKILL.md +335 -0
- package/ai/skills/testdriver-secrets/SKILL.md +115 -0
- package/ai/skills/testdriver-self-hosted/SKILL.md +65 -0
- package/ai/skills/testdriver-test-writer/SKILL.md +448 -0
- package/ai/skills/testdriver-testdriver/SKILL.md +628 -0
- package/ai/skills/testdriver-testdriver-mechanic/SKILL.md +165 -0
- package/ai/skills/testdriver-type/SKILL.md +357 -0
- package/ai/skills/testdriver-variables/SKILL.md +111 -0
- package/ai/skills/testdriver-wait/SKILL.md +50 -0
- package/ai/skills/testdriver-waiting-for-elements/SKILL.md +90 -0
- package/ai/skills/testdriver-what-is-testdriver/SKILL.md +54 -0
- package/bin/testdriverai.js +22 -0
- package/debugger/bg.png +0 -0
- package/debugger/icon.png +0 -0
- package/debugger/index.html +469 -0
- package/debugger/td.png +0 -0
- package/debugger/tray-buffered.png +0 -0
- package/debugger/tray.png +0 -0
- package/docs/GITHUB_COMMENTS.md +330 -0
- package/docs/GITHUB_COMMENTS_ANNOUNCEMENT.md +167 -0
- package/docs/QUICK-START-GITHUB-COMMENTS.md +84 -0
- package/docs/TEST-GITHUB-COMMENTS.md +129 -0
- package/docs/_data/examples-manifest.json +177 -0
- package/docs/_data/examples-manifest.schema.json +41 -0
- package/docs/_scripts/extract-example-urls.js +165 -0
- package/docs/_scripts/generate-examples.js +560 -0
- package/docs/_scripts/generate-skills.js +154 -0
- package/docs/_scripts/link-replacer.js +164 -0
- package/docs/_scripts/upload-docs-to-openai.js +284 -0
- package/docs/changelog.mdx +161 -0
- package/docs/claude-mcp-plugin.mdx +160 -0
- package/docs/docs.json +442 -0
- package/docs/github-integration-setup.md +266 -0
- package/docs/guide/best-practices-polling.mdx +174 -0
- package/docs/images/content/account/newprojectsettings.png +0 -0
- package/docs/images/content/account/projectpage.png +0 -0
- package/docs/images/content/account/projectreplays.png +0 -0
- package/docs/images/content/account/team-manage.png +0 -0
- package/docs/images/content/account/teampage.png +0 -0
- package/docs/images/content/extension/cursor.svg +1 -0
- package/docs/images/content/extension/vscode.svg +57 -0
- package/docs/images/content/extension/windsurf.svg +3 -0
- package/docs/images/content/parse/output.png +0 -0
- package/docs/images/content/self-hosted/launchtemplateid.png +0 -0
- package/docs/images/content/side-by-side.png +0 -0
- package/docs/images/content/vscode/ide-full.png +0 -0
- package/docs/images/content/vscode/running.png +0 -0
- package/docs/images/content/vscode/v7-chat.png +0 -0
- package/docs/images/content/vscode/v7-choose-agent.png +0 -0
- package/docs/images/content/vscode/v7-full.png +0 -0
- package/docs/images/content/vscode/v7-onboarding.png +0 -0
- package/docs/images/content/vscode/vscode-2-assert.png +0 -0
- package/docs/images/content/vscode/vscode-agent-preview.png +0 -0
- package/docs/images/content/vscode/vscode-copilot-ask.png +0 -0
- package/docs/images/content/vscode/vscode-file-creation.png +0 -0
- package/docs/images/content/vscode/vscode-install.png +0 -0
- package/docs/images/content/vscode/vscode-overview.png +0 -0
- package/docs/images/content/vscode/vscode-setup-walkthrough.png +0 -0
- package/docs/images/content/vscode/vscode-stopchat.png +0 -0
- package/docs/images/content/vscode/vscode-stoptest.png +0 -0
- package/docs/images/content/vscode/vscode-tdservice.png +0 -0
- package/docs/images/content/vscode/vscode-test-output.png +0 -0
- package/docs/images/content/vscode/vscode-testhistory.png +0 -0
- package/docs/images/content/vscode/vscode-testpane-runtests.png +0 -0
- package/docs/images/content/vscode/vscode-testpane.png +0 -0
- package/docs/images/template/dark.png +0 -0
- package/docs/images/template/icon.png +0 -0
- package/docs/images/template/light.png +0 -0
- package/docs/snippets/calendar-link.mdx +4 -0
- package/docs/snippets/gitignore-warning.mdx +7 -0
- package/docs/snippets/lifecycle-warning.mdx +6 -0
- package/docs/snippets/test-prereqs.mdx +12 -0
- package/docs/snippets/tests/assert-replay.mdx +7 -0
- package/docs/snippets/tests/assert-yaml.mdx +8 -0
- package/docs/snippets/tests/exec-js-replay.mdx +7 -0
- package/docs/snippets/tests/exec-js-yaml.mdx +32 -0
- package/docs/snippets/tests/exec-shell-replay.mdx +7 -0
- package/docs/snippets/tests/exec-shell-yaml.mdx +15 -0
- package/docs/snippets/tests/hover-image-replay.mdx +7 -0
- package/docs/snippets/tests/hover-image-yaml.mdx +17 -0
- package/docs/snippets/tests/hover-text-replay.mdx +7 -0
- package/docs/snippets/tests/hover-text-with-description-replay.mdx +7 -0
- package/docs/snippets/tests/hover-text-with-description-yaml.mdx +24 -0
- package/docs/snippets/tests/hover-text-yaml.mdx +14 -0
- package/docs/snippets/tests/match-image-replay.mdx +7 -0
- package/docs/snippets/tests/match-image-yaml.mdx +17 -0
- package/docs/snippets/tests/press-keys-replay.mdx +7 -0
- package/docs/snippets/tests/press-keys-yaml.mdx +36 -0
- package/docs/snippets/tests/remember-replay.mdx +7 -0
- package/docs/snippets/tests/remember-yaml.mdx +28 -0
- package/docs/snippets/tests/scroll-replay.mdx +7 -0
- package/docs/snippets/tests/scroll-until-image-replay.mdx +7 -0
- package/docs/snippets/tests/scroll-until-image-yaml.mdx +14 -0
- package/docs/snippets/tests/scroll-until-text-replay.mdx +7 -0
- package/docs/snippets/tests/scroll-until-text-yaml.mdx +17 -0
- package/docs/snippets/tests/scroll-yaml.mdx +30 -0
- package/docs/snippets/tests/type-repeated-replay.mdx +7 -0
- package/docs/snippets/tests/type-repeated-yaml.mdx +22 -0
- package/docs/snippets/tests/type-replay.mdx +7 -0
- package/docs/snippets/tests/type-yaml.mdx +28 -0
- package/docs/snippets/tests/wait-for-image-replay.mdx +7 -0
- package/docs/snippets/tests/wait-for-image-yaml.mdx +18 -0
- package/docs/snippets/tests/wait-for-text-replay.mdx +7 -0
- package/docs/snippets/tests/wait-for-text-yaml.mdx +18 -0
- package/docs/snippets/tests/wait-replay.mdx +7 -0
- package/docs/snippets/tests/wait-yaml.mdx +13 -0
- package/docs/styles.css +65 -0
- package/docs/v6/account/dashboard.mdx +16 -0
- package/docs/v6/account/enterprise.mdx +110 -0
- package/docs/v6/account/pricing.mdx +33 -0
- package/docs/v6/account/projects.mdx +33 -0
- package/docs/v6/account/team.mdx +35 -0
- package/docs/v6/action/ami.mdx +109 -0
- package/docs/v6/action/performance.mdx +105 -0
- package/docs/v6/action/secrets.mdx +93 -0
- package/docs/v6/apps/chrome-extensions.mdx +48 -0
- package/docs/v6/apps/desktop-apps.mdx +93 -0
- package/docs/v6/apps/mobile-apps.mdx +26 -0
- package/docs/v6/apps/static-websites.mdx +54 -0
- package/docs/v6/apps/tauri-apps.mdx +361 -0
- package/docs/v6/bugs/jira.mdx +232 -0
- package/docs/v6/cli/overview.mdx +66 -0
- package/docs/v6/commands/assert.mdx +45 -0
- package/docs/v6/commands/exec.mdx +276 -0
- package/docs/v6/commands/focus-application.mdx +44 -0
- package/docs/v6/commands/hover-image.mdx +69 -0
- package/docs/v6/commands/hover-text.mdx +47 -0
- package/docs/v6/commands/if.mdx +53 -0
- package/docs/v6/commands/match-image.mdx +67 -0
- package/docs/v6/commands/press-keys.mdx +87 -0
- package/docs/v6/commands/remember.mdx +49 -0
- package/docs/v6/commands/run.mdx +44 -0
- package/docs/v6/commands/scroll-until-image.mdx +66 -0
- package/docs/v6/commands/scroll-until-text.mdx +60 -0
- package/docs/v6/commands/scroll.mdx +69 -0
- package/docs/v6/commands/type.mdx +45 -0
- package/docs/v6/commands/wait-for-image.mdx +54 -0
- package/docs/v6/commands/wait-for-text.mdx +48 -0
- package/docs/v6/commands/wait.mdx +45 -0
- package/docs/v6/exporting/junit.mdx +218 -0
- package/docs/v6/exporting/playwright.mdx +197 -0
- package/docs/v6/features/auto-healing.mdx +144 -0
- package/docs/v6/features/generation.mdx +116 -0
- package/docs/v6/features/parallel-testing.mdx +151 -0
- package/docs/v6/features/reusable-snippets.mdx +131 -0
- package/docs/v6/features/selectorless.mdx +80 -0
- package/docs/v6/features/visual-assertions.mdx +139 -0
- package/docs/v6/getting-started/ci.mdx +146 -0
- package/docs/v6/getting-started/cli.mdx +91 -0
- package/docs/v6/getting-started/editing.mdx +100 -0
- package/docs/v6/getting-started/playwright.mdx +342 -0
- package/docs/v6/getting-started/running.mdx +48 -0
- package/docs/v6/getting-started/self-hosting.mdx +408 -0
- package/docs/v6/getting-started/vscode.mdx +88 -0
- package/docs/v6/guide/assertions.mdx +189 -0
- package/docs/v6/guide/authentication.mdx +136 -0
- package/docs/v6/guide/code.mdx +65 -0
- package/docs/v6/guide/dashcam.mdx +118 -0
- package/docs/v6/guide/environment-variables.mdx +26 -0
- package/docs/v6/guide/lifecycle.mdx +242 -0
- package/docs/v6/guide/locating.mdx +141 -0
- package/docs/v6/guide/protips.mdx +43 -0
- package/docs/v6/guide/variables.mdx +143 -0
- package/docs/v6/guide/waiting.mdx +130 -0
- package/docs/v6/importing/csv.mdx +196 -0
- package/docs/v6/importing/gherkin.mdx +143 -0
- package/docs/v6/importing/jira.mdx +164 -0
- package/docs/v6/importing/testrail.mdx +162 -0
- package/docs/v6/integrations/electron.mdx +146 -0
- package/docs/v6/integrations/netlify.mdx +100 -0
- package/docs/v6/integrations/vercel.mdx +125 -0
- package/docs/v6/interactive/explore.mdx +99 -0
- package/docs/v6/interactive/run.mdx +52 -0
- package/docs/v6/interactive/save.mdx +63 -0
- package/docs/v6/overview/comparison.mdx +101 -0
- package/docs/v6/overview/faq.mdx +162 -0
- package/docs/v6/overview/performance.mdx +52 -0
- package/docs/v6/overview/quickstart.mdx +137 -0
- package/docs/v6/overview/what-is-testdriver.mdx +85 -0
- package/docs/v6/scenarios/ai-chatbot.mdx +28 -0
- package/docs/v6/scenarios/cookie-banner.mdx +32 -0
- package/docs/v6/scenarios/file-upload.mdx +33 -0
- package/docs/v6/scenarios/form-filling.mdx +32 -0
- package/docs/v6/scenarios/log-in.mdx +75 -0
- package/docs/v6/scenarios/pdf-generation.mdx +25 -0
- package/docs/v6/scenarios/spell-check.mdx +22 -0
- package/docs/v6/security/action.mdx +84 -0
- package/docs/v6/security/agent.mdx +73 -0
- package/docs/v6/security/platform.mdx +77 -0
- package/docs/v6/tutorials/advanced-test.mdx +81 -0
- package/docs/v6/tutorials/basic-test.mdx +45 -0
- package/docs/v7/_drafts/agents.mdx +843 -0
- package/docs/v7/_drafts/architecture.mdx +399 -0
- package/docs/v7/_drafts/auto-cache-key.mdx +167 -0
- package/docs/v7/_drafts/awesome-logs-quick-ref.mdx +100 -0
- package/docs/v7/_drafts/best-practices.mdx +486 -0
- package/docs/v7/_drafts/caching-ai.mdx +215 -0
- package/docs/v7/_drafts/caching-selectors.mdx +424 -0
- package/docs/v7/_drafts/caching.mdx +366 -0
- package/docs/v7/_drafts/cli-to-sdk-migration.mdx +425 -0
- package/docs/v7/_drafts/commands/assert.mdx +45 -0
- package/docs/v7/_drafts/commands/exec.mdx +276 -0
- package/docs/v7/_drafts/commands/focus-application.mdx +44 -0
- package/docs/v7/_drafts/commands/hover-image.mdx +69 -0
- package/docs/v7/_drafts/commands/hover-text.mdx +47 -0
- package/docs/v7/_drafts/commands/if.mdx +53 -0
- package/docs/v7/_drafts/commands/match-image.mdx +67 -0
- package/docs/v7/_drafts/commands/press-keys.mdx +87 -0
- package/docs/v7/_drafts/commands/remember.mdx +49 -0
- package/docs/v7/_drafts/commands/run.mdx +44 -0
- package/docs/v7/_drafts/commands/scroll-until-image.mdx +66 -0
- package/docs/v7/_drafts/commands/scroll-until-text.mdx +60 -0
- package/docs/v7/_drafts/commands/scroll.mdx +69 -0
- package/docs/v7/_drafts/commands/type.mdx +45 -0
- package/docs/v7/_drafts/commands/wait-for-image.mdx +54 -0
- package/docs/v7/_drafts/commands/wait-for-text.mdx +48 -0
- package/docs/v7/_drafts/commands/wait.mdx +45 -0
- package/docs/v7/_drafts/configuration.mdx +378 -0
- package/docs/v7/_drafts/contributing.mdx +174 -0
- package/docs/v7/_drafts/core.mdx +458 -0
- package/docs/v7/_drafts/dashcam-title-feature.mdx +89 -0
- package/docs/v7/_drafts/debugging.mdx +349 -0
- package/docs/v7/_drafts/error-handling.mdx +501 -0
- package/docs/v7/_drafts/faq.mdx +393 -0
- package/docs/v7/_drafts/hooks.mdx +360 -0
- package/docs/v7/_drafts/init-command.mdx +95 -0
- package/docs/v7/_drafts/installation.mdx +420 -0
- package/docs/v7/_drafts/migration.mdx +562 -0
- package/docs/v7/_drafts/observable.mdx +604 -0
- package/docs/v7/_drafts/playwright.mdx +342 -0
- package/docs/v7/_drafts/plugin-migration.mdx +220 -0
- package/docs/v7/_drafts/powerful.mdx +419 -0
- package/docs/v7/_drafts/presets.mdx +210 -0
- package/docs/v7/_drafts/progressive-disclosure.mdx +230 -0
- package/docs/v7/_drafts/prompt-cache.mdx +200 -0
- package/docs/v7/_drafts/provision.mdx +390 -0
- package/docs/v7/_drafts/quick-start-test-recording.mdx +214 -0
- package/docs/v7/_drafts/readme.mdx +135 -0
- package/docs/v7/_drafts/reports.mdx +414 -0
- package/docs/v7/_drafts/scalable.mdx +763 -0
- package/docs/v7/_drafts/screenshot.mdx +155 -0
- package/docs/v7/_drafts/sdk-awesome-logs.mdx +468 -0
- package/docs/v7/_drafts/sdk-browser-rendering.mdx +167 -0
- package/docs/v7/_drafts/sdk-migration.mdx +474 -0
- package/docs/v7/_drafts/sdk-v7-complete.mdx +345 -0
- package/docs/v7/_drafts/self-hosting.mdx +369 -0
- package/docs/v7/_drafts/test-recording.mdx +382 -0
- package/docs/v7/_drafts/troubleshooting.mdx +526 -0
- package/docs/v7/_drafts/vitest-plugin.mdx +477 -0
- package/docs/v7/_drafts/vitest.mdx +535 -0
- package/docs/v7/_drafts/writing-tests.mdx +25 -0
- package/docs/v7/ai.mdx +205 -0
- package/docs/v7/assert.mdx +316 -0
- package/docs/v7/aws-setup.mdx +449 -0
- package/docs/v7/cache.mdx +223 -0
- package/docs/v7/caching.mdx +128 -0
- package/docs/v7/captcha.mdx +159 -0
- package/docs/v7/ci-cd.mdx +603 -0
- package/docs/v7/click.mdx +287 -0
- package/docs/v7/client.mdx +478 -0
- package/docs/v7/copilot/auto-healing.mdx +265 -0
- package/docs/v7/copilot/creating-tests.mdx +156 -0
- package/docs/v7/copilot/github.mdx +143 -0
- package/docs/v7/copilot/running-tests.mdx +149 -0
- package/docs/v7/copilot/setup.mdx +143 -0
- package/docs/v7/customizing-devices.mdx +319 -0
- package/docs/v7/dashcam.mdx +419 -0
- package/docs/v7/debugging-with-screenshots.mdx +402 -0
- package/docs/v7/device-config.mdx +317 -0
- package/docs/v7/double-click.mdx +102 -0
- package/docs/v7/elements.mdx +606 -0
- package/docs/v7/enterprise.mdx +9 -0
- package/docs/v7/errors.mdx +248 -0
- package/docs/v7/events.mdx +358 -0
- package/docs/v7/examples/ai.mdx +72 -0
- package/docs/v7/examples/assert.mdx +72 -0
- package/docs/v7/examples/captcha-api.mdx +92 -0
- package/docs/v7/examples/chrome-extension.mdx +132 -0
- package/docs/v7/examples/drag-and-drop.mdx +100 -0
- package/docs/v7/examples/element-not-found.mdx +67 -0
- package/docs/v7/examples/exec-output.mdx +85 -0
- package/docs/v7/examples/exec-pwsh.mdx +83 -0
- package/docs/v7/examples/focus-window.mdx +62 -0
- package/docs/v7/examples/hover-image.mdx +94 -0
- package/docs/v7/examples/hover-text.mdx +69 -0
- package/docs/v7/examples/installer.mdx +91 -0
- package/docs/v7/examples/launch-vscode-linux.mdx +101 -0
- package/docs/v7/examples/match-image.mdx +96 -0
- package/docs/v7/examples/press-keys.mdx +92 -0
- package/docs/v7/examples/scroll-keyboard.mdx +79 -0
- package/docs/v7/examples/scroll-until-image.mdx +81 -0
- package/docs/v7/examples/scroll-until-text.mdx +109 -0
- package/docs/v7/examples/scroll.mdx +81 -0
- package/docs/v7/examples/type.mdx +92 -0
- package/docs/v7/examples/windows-installer.mdx +89 -0
- package/docs/v7/exec.mdx +318 -0
- package/docs/v7/find.mdx +830 -0
- package/docs/v7/focus-application.mdx +294 -0
- package/docs/v7/generating-tests.mdx +36 -0
- package/docs/v7/hosted.mdx +158 -0
- package/docs/v7/hover.mdx +279 -0
- package/docs/v7/locating-elements.mdx +71 -0
- package/docs/v7/making-assertions.mdx +32 -0
- package/docs/v7/mcp.mdx +9 -0
- package/docs/v7/mouse-down.mdx +161 -0
- package/docs/v7/mouse-up.mdx +164 -0
- package/docs/v7/parse.mdx +237 -0
- package/docs/v7/performing-actions.mdx +54 -0
- package/docs/v7/press-keys.mdx +349 -0
- package/docs/v7/provision.mdx +333 -0
- package/docs/v7/quickstart.mdx +173 -0
- package/docs/v7/redraw.mdx +216 -0
- package/docs/v7/reusable-code.mdx +249 -0
- package/docs/v7/right-click.mdx +123 -0
- package/docs/v7/running-tests.mdx +185 -0
- package/docs/v7/screenshot.mdx +249 -0
- package/docs/v7/screenshots.mdx +186 -0
- package/docs/v7/scroll.mdx +336 -0
- package/docs/v7/secrets.mdx +115 -0
- package/docs/v7/self-hosted.mdx +149 -0
- package/docs/v7/type.mdx +358 -0
- package/docs/v7/variables.mdx +111 -0
- package/docs/v7/wait.mdx +52 -0
- package/docs/v7/waiting-for-elements.mdx +90 -0
- package/docs/v7/what-is-testdriver.mdx +54 -0
- package/eslint.config.js +67 -0
- package/examples/ai.test.mjs +31 -0
- package/examples/assert.test.mjs +47 -0
- package/examples/chrome-extension.test.mjs +97 -0
- package/examples/config.mjs +5 -0
- package/examples/element-not-found.test.mjs +27 -0
- package/examples/exec-output.test.mjs +60 -0
- package/examples/exec-pwsh.test.mjs +58 -0
- package/examples/findall-coffee-icons.test.mjs +42 -0
- package/examples/focus-window.test.mjs +37 -0
- package/examples/formatted-logging.test.mjs +27 -0
- package/examples/hover-image.test.mjs +53 -0
- package/examples/hover-text-with-description.test.mjs +57 -0
- package/examples/hover-text.test.mjs +28 -0
- package/examples/installer.test.mjs +50 -0
- package/examples/launch-vscode-linux.test.mjs +55 -0
- package/examples/match-image.test.mjs +55 -0
- package/examples/parse.test.mjs +19 -0
- package/examples/press-keys.test.mjs +44 -0
- package/examples/prompt.test.mjs +34 -0
- package/examples/scroll-keyboard.test.mjs +38 -0
- package/examples/scroll-until-image.test.mjs +40 -0
- package/examples/scroll.test.mjs +42 -0
- package/examples/type.test.mjs +46 -0
- package/examples/windows-installer.test.mjs +54 -0
- package/index.js +2 -0
- package/interfaces/cli/commands/init.js +438 -0
- package/interfaces/cli/commands/setup.js +382 -0
- package/interfaces/cli/lib/base.js +285 -0
- package/interfaces/cli.js +20 -0
- package/interfaces/junit-reporter.js +290 -0
- package/interfaces/logger.js +388 -0
- package/interfaces/readline.js +234 -0
- package/interfaces/shared-test-state.mjs +64 -0
- package/interfaces/vitest-plugin.d.ts +115 -0
- package/interfaces/vitest-plugin.mjs +1698 -0
- package/lib/captcha/solver.js +358 -0
- package/lib/core/Dashcam.js +533 -0
- package/lib/core/index.d.ts +172 -0
- package/lib/core/index.js +12 -0
- package/lib/environments.json +18 -0
- package/lib/github-comment-formatter.js +263 -0
- package/lib/github-comment.mjs +452 -0
- package/lib/init-project.js +575 -0
- package/lib/presets/index.mjs +331 -0
- package/lib/resolve-channel.js +46 -0
- package/lib/sentry.js +417 -0
- package/lib/vitest/hooks.d.ts +57 -0
- package/lib/vitest/hooks.mjs +674 -0
- package/lib/vitest/setup-aws.mjs +247 -0
- package/lib/vitest/setup-self-hosted.mjs +151 -0
- package/lib/vitest/setup.mjs +46 -0
- package/manual/captcha-api.test.mjs +51 -0
- package/manual/drag-and-drop.test.mjs +59 -0
- package/manual/flake-diffthreshold-001.test.mjs +9 -0
- package/manual/flake-diffthreshold-01.test.mjs +9 -0
- package/manual/flake-diffthreshold-05.test.mjs +9 -0
- package/manual/flake-noredraw-cache.test.mjs +9 -0
- package/manual/flake-noredraw-nocache.test.mjs +9 -0
- package/manual/flake-redraw-cache.test.mjs +9 -0
- package/manual/flake-redraw-nocache.test.mjs +9 -0
- package/manual/flake-rocket-match.test.mjs +30 -0
- package/manual/flake-shared.mjs +51 -0
- package/manual/no-provision.test.mjs +31 -0
- package/manual/packer-hover-image.test.mjs +176 -0
- package/manual/scroll-until-text.test.mjs +68 -0
- package/manual/test-init-command.js +223 -0
- package/mcp-server/README.md +322 -0
- package/mcp-server/dist/codegen.d.ts +9 -0
- package/mcp-server/dist/codegen.js +165 -0
- package/mcp-server/dist/mcp-app.html +114 -0
- package/mcp-server/dist/package.json +1 -0
- package/mcp-server/dist/provision-types.d.ts +290 -0
- package/mcp-server/dist/provision-types.js +174 -0
- package/mcp-server/dist/server.d.ts +6 -0
- package/mcp-server/dist/server.mjs +1925 -0
- package/mcp-server/dist/session.d.ts +85 -0
- package/mcp-server/dist/session.js +152 -0
- package/mcp-server/mcp-app.html +28 -0
- package/mcp-server/mcp-config.example.json +19 -0
- package/mcp-server/package-lock.json +4027 -0
- package/mcp-server/package.json +31 -0
- package/mcp-server/src/codegen.ts +189 -0
- package/mcp-server/src/mcp-app.css +360 -0
- package/mcp-server/src/mcp-app.ts +547 -0
- package/mcp-server/src/provision-types.ts +209 -0
- package/mcp-server/src/server.ts +2391 -0
- package/mcp-server/src/session.ts +194 -0
- package/mcp-server/tsconfig.json +16 -0
- package/mcp-server/vite.config.ts +23 -0
- package/package.json +158 -0
- package/schema.json +1046 -0
- package/scripts/generate-skills.js +94 -0
- package/sdk-log-formatter.js +1157 -0
- package/sdk.d.ts +1486 -0
- package/sdk.js +4336 -0
- package/setup/aws/cloudformation.yaml +463 -0
- package/setup/aws/disable-defender.sh +42 -0
- package/setup/aws/install-dev-runner.sh +79 -0
- package/setup/aws/spawn-runner.sh +289 -0
- package/test/captcha-solver.test.mjs +152 -0
- package/test/chrome-remote-debugging.test.mjs +66 -0
- package/test/duckduckgo/experiment.test.mjs +28 -0
- package/test/duckduckgo/setup.test.mjs +29 -0
- package/test/manual/debug-locate-response.js +82 -0
- package/test/manual/reconnect-provision.test.mjs +49 -0
- package/test/manual/test-console-logs.test.mjs +42 -0
- package/test/manual/test-find-api.js +73 -0
- package/test/manual/test-init.sh +54 -0
- package/test/manual/test-prompt-cache.js +97 -0
- package/test/manual/test-provision-auth.mjs +22 -0
- package/test/manual/test-sandbox-render.js +29 -0
- package/test/manual/test-sdk-methods.js +15 -0
- package/test/manual/test-sdk-refactor.js +53 -0
- package/test/manual/test-stack-trace.mjs +57 -0
- package/test/manual/verify-element-api.js +89 -0
- package/test/manual/verify-types.js +0 -0
- package/test/manual-unawaited-promise.test.mjs +31 -0
- package/vitest.config.mjs +58 -0
- package/vitest.runner.config.mjs +33 -0
- package/vscode-extension/.vscodeignore +12 -0
- package/vscode-extension/README.md +94 -0
- package/vscode-extension/media/icon.png +0 -0
- package/vscode-extension/package-lock.json +4126 -0
- package/vscode-extension/package.json +86 -0
- package/vscode-extension/src/extension.ts +829 -0
- package/vscode-extension/testdriverai-0.1.0.vsix +0 -0
- package/vscode-extension/tsconfig.json +16 -0
package/sdk.d.ts
ADDED
|
@@ -0,0 +1,1486 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TestDriver SDK - TypeScript Definitions
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Type Definitions
|
|
6
|
+
export type ClickAction =
|
|
7
|
+
| "click"
|
|
8
|
+
| "right-click"
|
|
9
|
+
| "double-click"
|
|
10
|
+
| "hover"
|
|
11
|
+
| "mouseDown"
|
|
12
|
+
| "mouseUp";
|
|
13
|
+
export type ScrollDirection = "up" | "down" | "left" | "right";
|
|
14
|
+
export type ScrollMethod = "keyboard" | "mouse";
|
|
15
|
+
export type TextMatchMethod = "ai" | "turbo";
|
|
16
|
+
export type ExecLanguage = "sh" | "pwsh";
|
|
17
|
+
/**
|
|
18
|
+
* Preview mode for live test visualization
|
|
19
|
+
* - "browser": Opens debugger in default browser (default)
|
|
20
|
+
* - "ide": Opens preview in IDE panel (VSCode, Cursor, etc.)
|
|
21
|
+
* - "none": Headless mode, no visual preview
|
|
22
|
+
*/
|
|
23
|
+
export type PreviewMode = "browser" | "ide" | "none";
|
|
24
|
+
export type KeyboardKey =
|
|
25
|
+
| "\t"
|
|
26
|
+
| "\n"
|
|
27
|
+
| "\r"
|
|
28
|
+
| " "
|
|
29
|
+
| "!"
|
|
30
|
+
| '"'
|
|
31
|
+
| "#"
|
|
32
|
+
| "$"
|
|
33
|
+
| "%"
|
|
34
|
+
| "&"
|
|
35
|
+
| "'"
|
|
36
|
+
| "("
|
|
37
|
+
| ")"
|
|
38
|
+
| "*"
|
|
39
|
+
| "+"
|
|
40
|
+
| ","
|
|
41
|
+
| "-"
|
|
42
|
+
| "."
|
|
43
|
+
| "/"
|
|
44
|
+
| "0"
|
|
45
|
+
| "1"
|
|
46
|
+
| "2"
|
|
47
|
+
| "3"
|
|
48
|
+
| "4"
|
|
49
|
+
| "5"
|
|
50
|
+
| "6"
|
|
51
|
+
| "7"
|
|
52
|
+
| "8"
|
|
53
|
+
| "9"
|
|
54
|
+
| ":"
|
|
55
|
+
| ";"
|
|
56
|
+
| "<"
|
|
57
|
+
| "="
|
|
58
|
+
| ">"
|
|
59
|
+
| "?"
|
|
60
|
+
| "@"
|
|
61
|
+
| "["
|
|
62
|
+
| "\\"
|
|
63
|
+
| "]"
|
|
64
|
+
| "^"
|
|
65
|
+
| "_"
|
|
66
|
+
| "`"
|
|
67
|
+
| "a"
|
|
68
|
+
| "b"
|
|
69
|
+
| "c"
|
|
70
|
+
| "d"
|
|
71
|
+
| "e"
|
|
72
|
+
| "f"
|
|
73
|
+
| "g"
|
|
74
|
+
| "h"
|
|
75
|
+
| "i"
|
|
76
|
+
| "j"
|
|
77
|
+
| "k"
|
|
78
|
+
| "l"
|
|
79
|
+
| "m"
|
|
80
|
+
| "n"
|
|
81
|
+
| "o"
|
|
82
|
+
| "p"
|
|
83
|
+
| "q"
|
|
84
|
+
| "r"
|
|
85
|
+
| "s"
|
|
86
|
+
| "t"
|
|
87
|
+
| "u"
|
|
88
|
+
| "v"
|
|
89
|
+
| "w"
|
|
90
|
+
| "x"
|
|
91
|
+
| "y"
|
|
92
|
+
| "z"
|
|
93
|
+
| "{"
|
|
94
|
+
| "|"
|
|
95
|
+
| "}"
|
|
96
|
+
| "~"
|
|
97
|
+
| "accept"
|
|
98
|
+
| "add"
|
|
99
|
+
| "alt"
|
|
100
|
+
| "altleft"
|
|
101
|
+
| "altright"
|
|
102
|
+
| "apps"
|
|
103
|
+
| "backspace"
|
|
104
|
+
| "browserback"
|
|
105
|
+
| "browserfavorites"
|
|
106
|
+
| "browserforward"
|
|
107
|
+
| "browserhome"
|
|
108
|
+
| "browserrefresh"
|
|
109
|
+
| "browsersearch"
|
|
110
|
+
| "browserstop"
|
|
111
|
+
| "capslock"
|
|
112
|
+
| "clear"
|
|
113
|
+
| "convert"
|
|
114
|
+
| "ctrl"
|
|
115
|
+
| "ctrlleft"
|
|
116
|
+
| "ctrlright"
|
|
117
|
+
| "decimal"
|
|
118
|
+
| "del"
|
|
119
|
+
| "delete"
|
|
120
|
+
| "divide"
|
|
121
|
+
| "down"
|
|
122
|
+
| "end"
|
|
123
|
+
| "enter"
|
|
124
|
+
| "esc"
|
|
125
|
+
| "escape"
|
|
126
|
+
| "execute"
|
|
127
|
+
| "f1"
|
|
128
|
+
| "f2"
|
|
129
|
+
| "f3"
|
|
130
|
+
| "f4"
|
|
131
|
+
| "f5"
|
|
132
|
+
| "f6"
|
|
133
|
+
| "f7"
|
|
134
|
+
| "f8"
|
|
135
|
+
| "f9"
|
|
136
|
+
| "f10"
|
|
137
|
+
| "f11"
|
|
138
|
+
| "f12"
|
|
139
|
+
| "f13"
|
|
140
|
+
| "f14"
|
|
141
|
+
| "f15"
|
|
142
|
+
| "f16"
|
|
143
|
+
| "f17"
|
|
144
|
+
| "f18"
|
|
145
|
+
| "f19"
|
|
146
|
+
| "f20"
|
|
147
|
+
| "f21"
|
|
148
|
+
| "f22"
|
|
149
|
+
| "f23"
|
|
150
|
+
| "f24"
|
|
151
|
+
| "final"
|
|
152
|
+
| "fn"
|
|
153
|
+
| "hanguel"
|
|
154
|
+
| "hangul"
|
|
155
|
+
| "hanja"
|
|
156
|
+
| "help"
|
|
157
|
+
| "home"
|
|
158
|
+
| "insert"
|
|
159
|
+
| "junja"
|
|
160
|
+
| "kana"
|
|
161
|
+
| "kanji"
|
|
162
|
+
| "launchapp1"
|
|
163
|
+
| "launchapp2"
|
|
164
|
+
| "launchmail"
|
|
165
|
+
| "launchmediaselect"
|
|
166
|
+
| "left"
|
|
167
|
+
| "modechange"
|
|
168
|
+
| "multiply"
|
|
169
|
+
| "nexttrack"
|
|
170
|
+
| "nonconvert"
|
|
171
|
+
| "num0"
|
|
172
|
+
| "num1"
|
|
173
|
+
| "num2"
|
|
174
|
+
| "num3"
|
|
175
|
+
| "num4"
|
|
176
|
+
| "num5"
|
|
177
|
+
| "num6"
|
|
178
|
+
| "num7"
|
|
179
|
+
| "num8"
|
|
180
|
+
| "num9"
|
|
181
|
+
| "numlock"
|
|
182
|
+
| "pagedown"
|
|
183
|
+
| "pageup"
|
|
184
|
+
| "pause"
|
|
185
|
+
| "pgdn"
|
|
186
|
+
| "pgup"
|
|
187
|
+
| "playpause"
|
|
188
|
+
| "prevtrack"
|
|
189
|
+
| "print"
|
|
190
|
+
| "printscreen"
|
|
191
|
+
| "prntscrn"
|
|
192
|
+
| "prtsc"
|
|
193
|
+
| "prtscr"
|
|
194
|
+
| "return"
|
|
195
|
+
| "right"
|
|
196
|
+
| "scrolllock"
|
|
197
|
+
| "select"
|
|
198
|
+
| "separator"
|
|
199
|
+
| "shift"
|
|
200
|
+
| "shiftleft"
|
|
201
|
+
| "shiftright"
|
|
202
|
+
| "sleep"
|
|
203
|
+
| "space"
|
|
204
|
+
| "stop"
|
|
205
|
+
| "subtract"
|
|
206
|
+
| "tab"
|
|
207
|
+
| "up"
|
|
208
|
+
| "volumedown"
|
|
209
|
+
| "volumemute"
|
|
210
|
+
| "volumeup"
|
|
211
|
+
| "win"
|
|
212
|
+
| "winleft"
|
|
213
|
+
| "winright"
|
|
214
|
+
| "yen"
|
|
215
|
+
| "command"
|
|
216
|
+
| "option"
|
|
217
|
+
| "optionleft"
|
|
218
|
+
| "optionright";
|
|
219
|
+
|
|
220
|
+
export interface TestDriverOptions {
|
|
221
|
+
/** API endpoint URL (default depends on release channel: latest → 'https://api.testdriver.ai') */
|
|
222
|
+
apiRoot?: string;
|
|
223
|
+
/** Sandbox resolution (default: '1366x768') */
|
|
224
|
+
resolution?: string;
|
|
225
|
+
/** Operating system for the sandbox (default: 'linux') */
|
|
226
|
+
os?: "windows" | "linux";
|
|
227
|
+
/** Enable analytics tracking (default: true) */
|
|
228
|
+
analytics?: boolean;
|
|
229
|
+
/** Enable console logging output (default: true) */
|
|
230
|
+
logging?: boolean;
|
|
231
|
+
/** Enable/disable cache, or configure with thresholds
|
|
232
|
+
* @example { cache: { enabled: true, thresholds: { find: { screen: 0.05, element: 0.8 }, assert: 0.05 } } }
|
|
233
|
+
*/
|
|
234
|
+
cache?: boolean | {
|
|
235
|
+
enabled?: boolean;
|
|
236
|
+
thresholds?: {
|
|
237
|
+
/** Thresholds for find operations */
|
|
238
|
+
find?: {
|
|
239
|
+
/** Pixel diff threshold for screen comparison (0-1, default 0.05 = 5% diff allowed) */
|
|
240
|
+
screen?: number;
|
|
241
|
+
/** OpenCV template match threshold for element matching (0-1, default 0.8 = 80% correlation) */
|
|
242
|
+
element?: number;
|
|
243
|
+
};
|
|
244
|
+
/** Pixel diff threshold for assert operations (0-1, default 0.05 = 5% diff allowed) */
|
|
245
|
+
assert?: number;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
ai?: AIConfig;
|
|
249
|
+
/** @deprecated Use cache.thresholds instead */
|
|
250
|
+
cacheThreshold?: {
|
|
251
|
+
/** Threshold for find operations (default: 0.05 = 5% difference, 95% similarity) */
|
|
252
|
+
find?: number;
|
|
253
|
+
/** Threshold for findAll operations (default: 0.05 = 5% difference, 95% similarity) */
|
|
254
|
+
findAll?: number;
|
|
255
|
+
};
|
|
256
|
+
/** Force creation of a new sandbox (default: true) */
|
|
257
|
+
newSandbox?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Preview mode for live test visualization (default: "browser")
|
|
260
|
+
* - "browser": Opens debugger in default browser
|
|
261
|
+
* - "ide": Opens preview in IDE panel (VSCode, Cursor, etc.)
|
|
262
|
+
* - "none": Headless mode, no visual preview
|
|
263
|
+
*/
|
|
264
|
+
preview?: PreviewMode;
|
|
265
|
+
/**
|
|
266
|
+
* @deprecated Use `preview: "none"` instead. Run in headless mode (default: false)
|
|
267
|
+
* For backward compatibility: headless: true maps to preview: "none"
|
|
268
|
+
*/
|
|
269
|
+
headless?: boolean;
|
|
270
|
+
/** Direct IP address to connect to a running sandbox instance */
|
|
271
|
+
ip?: string;
|
|
272
|
+
/** Custom AMI ID for sandbox instance (e.g., 'ami-1234') */
|
|
273
|
+
sandboxAmi?: string;
|
|
274
|
+
/** EC2 instance type for sandbox (e.g., 'i3.metal') */
|
|
275
|
+
sandboxInstance?: string;
|
|
276
|
+
/** Cache key for element finding operations. If provided, enables caching tied to this key */
|
|
277
|
+
cacheKey?: string;
|
|
278
|
+
/** Reconnect to the last used sandbox instead of creating a new one. When true, provision methods (chrome, vscode, installer, etc.) will be skipped since the application is already running. Throws error if no previous sandbox exists. */
|
|
279
|
+
reconnect?: boolean;
|
|
280
|
+
/** Enable/disable Dashcam video recording (default: true) */
|
|
281
|
+
dashcam?: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Enable automatic screenshots before and after each command (default: true)
|
|
284
|
+
* Screenshots are saved to .testdriver/screenshots/<test>/ with descriptive filenames
|
|
285
|
+
* Format: <seq>-<action>-<phase>-L<line>-<description>.png
|
|
286
|
+
* Example: 001-click-before-L42-submit-button.png
|
|
287
|
+
*/
|
|
288
|
+
autoScreenshots?: boolean;
|
|
289
|
+
/** Redraw configuration for screen change detection
|
|
290
|
+
* @example { redraw: { enabled: true, thresholds: { screen: 0.05, network: true } } }
|
|
291
|
+
*/
|
|
292
|
+
redraw?:
|
|
293
|
+
| boolean
|
|
294
|
+
| {
|
|
295
|
+
/** Enable redraw detection (default: true) */
|
|
296
|
+
enabled?: boolean;
|
|
297
|
+
/** Threshold configuration */
|
|
298
|
+
thresholds?: {
|
|
299
|
+
/** Screen diff threshold (0-1). Set to false to disable screen redraw detection. Default: 0.05 */
|
|
300
|
+
screen?: number | false;
|
|
301
|
+
/** Enable/disable network activity monitoring (default: false) */
|
|
302
|
+
network?: boolean;
|
|
303
|
+
};
|
|
304
|
+
/** @deprecated Use thresholds.screen instead */
|
|
305
|
+
diffThreshold?: number;
|
|
306
|
+
/** @deprecated Use thresholds.screen !== false instead */
|
|
307
|
+
screenRedraw?: boolean;
|
|
308
|
+
/** @deprecated Use thresholds.network instead */
|
|
309
|
+
networkMonitor?: boolean;
|
|
310
|
+
};
|
|
311
|
+
/** @deprecated Use redraw option instead */
|
|
312
|
+
redrawThreshold?: number | object;
|
|
313
|
+
/** Additional environment variables */
|
|
314
|
+
environment?: Record<string, any>;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export interface ConnectOptions {
|
|
318
|
+
/** Existing sandbox ID to reconnect to */
|
|
319
|
+
sandboxId?: string;
|
|
320
|
+
/** Force creation of a new sandbox */
|
|
321
|
+
newSandbox?: boolean;
|
|
322
|
+
/** Reconnect to the last used sandbox instead of creating a new one. When true, provision methods (chrome, vscode, installer, etc.) will be skipped since the application is already running. Throws error if no previous sandbox exists. */
|
|
323
|
+
reconnect?: boolean;
|
|
324
|
+
/** Direct IP address to connect to a running sandbox instance */
|
|
325
|
+
ip?: string;
|
|
326
|
+
/** Custom AMI ID for sandbox instance (e.g., 'ami-1234') */
|
|
327
|
+
sandboxAmi?: string;
|
|
328
|
+
/** EC2 instance type for sandbox (e.g., 'i3.metal') */
|
|
329
|
+
sandboxInstance?: string;
|
|
330
|
+
/** Operating system for the sandbox (default: 'linux') */
|
|
331
|
+
os?: "windows" | "linux";
|
|
332
|
+
/**
|
|
333
|
+
* Preview mode for live test visualization (default: "browser")
|
|
334
|
+
* - "browser": Opens debugger in default browser
|
|
335
|
+
* - "ide": Opens preview in IDE panel (VSCode, Cursor, etc.)
|
|
336
|
+
* - "none": Headless mode, no visual preview
|
|
337
|
+
*/
|
|
338
|
+
preview?: PreviewMode;
|
|
339
|
+
/**
|
|
340
|
+
* @deprecated Use `preview: "none"` instead. Run in headless mode (default: false)
|
|
341
|
+
* For backward compatibility: headless: true maps to preview: "none"
|
|
342
|
+
*/
|
|
343
|
+
headless?: boolean;
|
|
344
|
+
/** Reuse recent connection if available (default: true) */
|
|
345
|
+
reuseConnection?: boolean;
|
|
346
|
+
/** Keep sandbox alive for specified milliseconds after disconnect (default: 60000). Set to 0 to terminate immediately on disconnect. */
|
|
347
|
+
keepAlive?: number;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface SandboxInstance {
|
|
351
|
+
instanceId: string;
|
|
352
|
+
ip: string;
|
|
353
|
+
vncPort: number;
|
|
354
|
+
[key: string]: any;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface ElementCoordinates {
|
|
358
|
+
x: number;
|
|
359
|
+
y: number;
|
|
360
|
+
centerX: number;
|
|
361
|
+
centerY: number;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export interface ElementBoundingBox {
|
|
365
|
+
top: number;
|
|
366
|
+
left: number;
|
|
367
|
+
bottom: number;
|
|
368
|
+
right: number;
|
|
369
|
+
[key: string]: any;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export interface ElementResponse {
|
|
373
|
+
coordinates: ElementCoordinates;
|
|
374
|
+
confidence?: number;
|
|
375
|
+
screenshot?: string;
|
|
376
|
+
width?: number;
|
|
377
|
+
height?: number;
|
|
378
|
+
boundingBox?: ElementBoundingBox;
|
|
379
|
+
text?: string;
|
|
380
|
+
label?: string;
|
|
381
|
+
[key: string]: any;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export interface HoverResult {
|
|
385
|
+
x: number;
|
|
386
|
+
y: number;
|
|
387
|
+
centerX: number;
|
|
388
|
+
centerY: number;
|
|
389
|
+
[key: string]: any;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/** Bounding box for a parsed element (pixel coordinates) */
|
|
393
|
+
export interface ParsedElementBBox {
|
|
394
|
+
/** Left edge X coordinate */
|
|
395
|
+
x0: number;
|
|
396
|
+
/** Top edge Y coordinate */
|
|
397
|
+
y0: number;
|
|
398
|
+
/** Right edge X coordinate */
|
|
399
|
+
x1: number;
|
|
400
|
+
/** Bottom edge Y coordinate */
|
|
401
|
+
y1: number;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/** Bounding box as {left, top, width, height} */
|
|
405
|
+
export interface ParsedElementBoundingBox {
|
|
406
|
+
left: number;
|
|
407
|
+
top: number;
|
|
408
|
+
width: number;
|
|
409
|
+
height: number;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/** Individual element detected by OmniParser */
|
|
413
|
+
export interface ParsedElement {
|
|
414
|
+
/** Element index */
|
|
415
|
+
index: number;
|
|
416
|
+
/** Element type (e.g. "text", "icon", "button") */
|
|
417
|
+
type: string;
|
|
418
|
+
/** Text content or description */
|
|
419
|
+
content: string;
|
|
420
|
+
/** Interactivity level (e.g. "clickable", "non-interactive") */
|
|
421
|
+
interactivity: string;
|
|
422
|
+
/** Bounding box in pixel coordinates */
|
|
423
|
+
bbox: ParsedElementBBox;
|
|
424
|
+
/** Bounding box as {left, top, width, height} */
|
|
425
|
+
boundingBox: ParsedElementBoundingBox;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/** Result from OmniParser screen analysis */
|
|
429
|
+
export interface ParseResult {
|
|
430
|
+
/** Array of detected UI elements */
|
|
431
|
+
elements: ParsedElement[];
|
|
432
|
+
/** URL of the annotated screenshot */
|
|
433
|
+
annotatedImageUrl: string;
|
|
434
|
+
/** Width of the analyzed screenshot */
|
|
435
|
+
imageWidth: number;
|
|
436
|
+
/** Height of the analyzed screenshot */
|
|
437
|
+
imageHeight: number;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// ====================================
|
|
441
|
+
// Command Options Interfaces
|
|
442
|
+
// ====================================
|
|
443
|
+
|
|
444
|
+
/** Options for scroll command */
|
|
445
|
+
export interface ScrollOptions {
|
|
446
|
+
/** Direction to scroll */
|
|
447
|
+
direction?: ScrollDirection;
|
|
448
|
+
/** Amount to scroll in pixels */
|
|
449
|
+
amount?: number;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** Options for click command */
|
|
453
|
+
export interface ClickOptions {
|
|
454
|
+
/** X coordinate */
|
|
455
|
+
x: number;
|
|
456
|
+
/** Y coordinate */
|
|
457
|
+
y: number;
|
|
458
|
+
/** Type of click action */
|
|
459
|
+
action?: ClickAction;
|
|
460
|
+
/** Prompt for tracking */
|
|
461
|
+
prompt?: string;
|
|
462
|
+
/** Whether cache was hit */
|
|
463
|
+
cacheHit?: boolean;
|
|
464
|
+
/** Selector used */
|
|
465
|
+
selector?: string;
|
|
466
|
+
/** Whether selector was used */
|
|
467
|
+
selectorUsed?: boolean;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/** Options for hover command */
|
|
471
|
+
export interface HoverOptions {
|
|
472
|
+
/** X coordinate */
|
|
473
|
+
x: number;
|
|
474
|
+
/** Y coordinate */
|
|
475
|
+
y: number;
|
|
476
|
+
/** Prompt for tracking */
|
|
477
|
+
prompt?: string;
|
|
478
|
+
/** Whether cache was hit */
|
|
479
|
+
cacheHit?: boolean;
|
|
480
|
+
/** Selector used */
|
|
481
|
+
selector?: string;
|
|
482
|
+
/** Whether selector was used */
|
|
483
|
+
selectorUsed?: boolean;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/** Options for hoverText command */
|
|
487
|
+
export interface HoverTextOptions {
|
|
488
|
+
/** Text to find and hover over */
|
|
489
|
+
text: string;
|
|
490
|
+
/** Optional description of the element */
|
|
491
|
+
description?: string | null;
|
|
492
|
+
/** Action to perform */
|
|
493
|
+
action?: ClickAction;
|
|
494
|
+
/** Timeout in milliseconds */
|
|
495
|
+
timeout?: number;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/** Options for hoverImage command */
|
|
499
|
+
export interface HoverImageOptions {
|
|
500
|
+
/** Description of the image to find */
|
|
501
|
+
description: string;
|
|
502
|
+
/** Action to perform */
|
|
503
|
+
action?: ClickAction;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/** Options for matchImage command */
|
|
507
|
+
export interface MatchImageOptions {
|
|
508
|
+
/** Path to the image template */
|
|
509
|
+
path: string;
|
|
510
|
+
/** Action to perform */
|
|
511
|
+
action?: ClickAction;
|
|
512
|
+
/** Invert the match */
|
|
513
|
+
invert?: boolean;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/** Options for type command */
|
|
517
|
+
export interface TypeOptions {
|
|
518
|
+
/** Text to type */
|
|
519
|
+
text: string | number;
|
|
520
|
+
/** Delay between keystrokes in milliseconds */
|
|
521
|
+
delay?: number;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/** Options for pressKeys command */
|
|
525
|
+
export interface PressKeysOptions {
|
|
526
|
+
/** Array of keys to press */
|
|
527
|
+
keys: KeyboardKey[];
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** Options for wait command */
|
|
531
|
+
export interface WaitOptions {
|
|
532
|
+
/** Time to wait in milliseconds */
|
|
533
|
+
timeout?: number;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/** Options for waitForText command */
|
|
537
|
+
export interface WaitForTextOptions {
|
|
538
|
+
/** Text to wait for */
|
|
539
|
+
text: string;
|
|
540
|
+
/** Timeout in milliseconds */
|
|
541
|
+
timeout?: number;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/** Options for waitForImage command */
|
|
545
|
+
export interface WaitForImageOptions {
|
|
546
|
+
/** Description of the image */
|
|
547
|
+
description: string;
|
|
548
|
+
/** Timeout in milliseconds */
|
|
549
|
+
timeout?: number;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/** Options for scrollUntilText command */
|
|
553
|
+
export interface ScrollUntilTextOptions {
|
|
554
|
+
/** Text to find */
|
|
555
|
+
text: string;
|
|
556
|
+
/** Scroll direction */
|
|
557
|
+
direction?: ScrollDirection;
|
|
558
|
+
/** Maximum distance to scroll in pixels */
|
|
559
|
+
maxDistance?: number;
|
|
560
|
+
/** Invert the match */
|
|
561
|
+
invert?: boolean;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/** Options for scrollUntilImage command */
|
|
565
|
+
export interface ScrollUntilImageOptions {
|
|
566
|
+
/** Description of the image */
|
|
567
|
+
description?: string;
|
|
568
|
+
/** Scroll direction */
|
|
569
|
+
direction?: ScrollDirection;
|
|
570
|
+
/** Maximum distance to scroll in pixels */
|
|
571
|
+
maxDistance?: number;
|
|
572
|
+
/** Scroll method */
|
|
573
|
+
method?: ScrollMethod;
|
|
574
|
+
/** Path to image template */
|
|
575
|
+
path?: string;
|
|
576
|
+
/** Invert the match */
|
|
577
|
+
invert?: boolean;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/** Options for focusApplication command */
|
|
581
|
+
export interface FocusApplicationOptions {
|
|
582
|
+
/** Application name */
|
|
583
|
+
name: string;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/** AI sampling configuration for controlling model behavior */
|
|
587
|
+
export interface AIConfig {
|
|
588
|
+
/** Temperature for AI sampling (0 = deterministic, higher = more creative). Default: 0 for find verification, model default for assert. */
|
|
589
|
+
temperature?: number;
|
|
590
|
+
/** Top-P and Top-K sampling parameters */
|
|
591
|
+
top?: {
|
|
592
|
+
/** Top-P (nucleus sampling). Controls diversity by limiting to top P probability mass. Range: 0-1. */
|
|
593
|
+
p?: number;
|
|
594
|
+
/** Top-K sampling. Limits choices to top K tokens. 1 = always pick most likely. 0 = disabled. */
|
|
595
|
+
k?: number;
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/** Options for extract command */
|
|
600
|
+
export interface ExtractOptions {
|
|
601
|
+
/** What to extract */
|
|
602
|
+
description: string;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/** Options for assert command */
|
|
606
|
+
export interface AssertOptions {
|
|
607
|
+
/** Assertion to check */
|
|
608
|
+
assertion: string;
|
|
609
|
+
/** Cache threshold (0-1). Lower values require closer matches. Set to -1 to disable cache. */
|
|
610
|
+
threshold?: number;
|
|
611
|
+
/** Cache key for grouping cached assertions (enables caching when provided) */
|
|
612
|
+
cacheKey?: string;
|
|
613
|
+
/** Operating system identifier for cache partitioning */
|
|
614
|
+
os?: string;
|
|
615
|
+
/** Screen resolution for cache partitioning */
|
|
616
|
+
resolution?: string;
|
|
617
|
+
/** AI sampling configuration (overrides global ai config) */
|
|
618
|
+
ai?: AIConfig;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/** Options for exec command */
|
|
622
|
+
export interface ExecOptions {
|
|
623
|
+
/** Language ('js', 'pwsh', or 'sh') */
|
|
624
|
+
language?: ExecLanguage;
|
|
625
|
+
/** Code to execute */
|
|
626
|
+
code: string;
|
|
627
|
+
/** Timeout in milliseconds */
|
|
628
|
+
timeout?: number;
|
|
629
|
+
/** Suppress output */
|
|
630
|
+
silent?: boolean;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/** Options for captcha command */
|
|
634
|
+
export interface CaptchaOptions {
|
|
635
|
+
/** 2captcha API key (required) */
|
|
636
|
+
apiKey: string;
|
|
637
|
+
/** Override auto-detected sitekey */
|
|
638
|
+
sitekey?: string;
|
|
639
|
+
/** Captcha type: 'recaptcha_v2', 'recaptcha_v3', 'hcaptcha', 'turnstile' */
|
|
640
|
+
type?: string;
|
|
641
|
+
/** reCAPTCHA v3 action (default: 'verify') */
|
|
642
|
+
action?: string;
|
|
643
|
+
/** Whether to auto-submit the form (default: true) */
|
|
644
|
+
autoSubmit?: boolean;
|
|
645
|
+
/** Polling interval in ms for 2captcha (default: 5000) */
|
|
646
|
+
pollInterval?: number;
|
|
647
|
+
/** Max time in ms to wait for solution (default: 120000) */
|
|
648
|
+
timeout?: number;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/** Result of captcha solving */
|
|
652
|
+
export interface CaptchaResult {
|
|
653
|
+
/** Whether the captcha was solved successfully */
|
|
654
|
+
success: boolean;
|
|
655
|
+
/** Success/error message */
|
|
656
|
+
message: string;
|
|
657
|
+
/** The solved captcha token */
|
|
658
|
+
token: string | null;
|
|
659
|
+
/** Raw output from the solver script */
|
|
660
|
+
output: string;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* A Promise that resolves to an Element but also has chainable element methods.
|
|
665
|
+
* This enables syntax like: await testdriver.find("button").click()
|
|
666
|
+
*/
|
|
667
|
+
export interface ChainableElementPromise extends Promise<Element> {
|
|
668
|
+
/**
|
|
669
|
+
* Click on the element (chainable)
|
|
670
|
+
* @param action - Type of click action (default: 'click')
|
|
671
|
+
*/
|
|
672
|
+
click(action?: ClickAction): Promise<void>;
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Hover over the element (chainable)
|
|
676
|
+
*/
|
|
677
|
+
hover(): Promise<void>;
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Double-click on the element (chainable)
|
|
681
|
+
*/
|
|
682
|
+
doubleClick(): Promise<void>;
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Right-click on the element (chainable)
|
|
686
|
+
*/
|
|
687
|
+
rightClick(): Promise<void>;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Press mouse button down on this element (chainable)
|
|
691
|
+
*/
|
|
692
|
+
mouseDown(): Promise<void>;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Release mouse button on this element (chainable)
|
|
696
|
+
*/
|
|
697
|
+
mouseUp(): Promise<void>;
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Check if element was found (chainable)
|
|
701
|
+
*/
|
|
702
|
+
found(): Promise<boolean>;
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Get the coordinates of the element (chainable)
|
|
706
|
+
*/
|
|
707
|
+
getCoordinates(): Promise<ElementCoordinates | null>;
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Get the full API response data (chainable)
|
|
711
|
+
*/
|
|
712
|
+
getResponse(): Promise<ElementResponse | null>;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Get the x coordinate (chainable)
|
|
716
|
+
*/
|
|
717
|
+
readonly x: Promise<number | null>;
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Get the y coordinate (chainable)
|
|
721
|
+
*/
|
|
722
|
+
readonly y: Promise<number | null>;
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Get the center x coordinate (chainable)
|
|
726
|
+
*/
|
|
727
|
+
readonly centerX: Promise<number | null>;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Get the center y coordinate (chainable)
|
|
731
|
+
*/
|
|
732
|
+
readonly centerY: Promise<number | null>;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Element class representing a located or to-be-located element on screen
|
|
737
|
+
*/
|
|
738
|
+
export class Element {
|
|
739
|
+
constructor(description: string);
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Check if element was found
|
|
743
|
+
*/
|
|
744
|
+
found(): boolean;
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Find the element on screen
|
|
748
|
+
* @param newDescription - Optional new description to search for
|
|
749
|
+
* @param options - Cache options: number for threshold, or object with cache.thresholds
|
|
750
|
+
*/
|
|
751
|
+
find(newDescription?: string, cacheThreshold?: number): Promise<Element>;
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Click on the element
|
|
755
|
+
* @param action - Type of click action (default: 'click')
|
|
756
|
+
*/
|
|
757
|
+
click(action?: ClickAction): Promise<void>;
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Hover over the element
|
|
761
|
+
*/
|
|
762
|
+
hover(): Promise<void>;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* Double-click on the element
|
|
766
|
+
*/
|
|
767
|
+
doubleClick(): Promise<void>;
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Right-click on the element
|
|
771
|
+
*/
|
|
772
|
+
rightClick(): Promise<void>;
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Press mouse button down on this element
|
|
776
|
+
*/
|
|
777
|
+
mouseDown(): Promise<void>;
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Release mouse button on this element
|
|
781
|
+
*/
|
|
782
|
+
mouseUp(): Promise<void>;
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Get the coordinates of the element
|
|
786
|
+
*/
|
|
787
|
+
getCoordinates(): ElementCoordinates | null;
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Get the x coordinate (top-left)
|
|
791
|
+
*/
|
|
792
|
+
readonly x: number | null;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Get the y coordinate (top-left)
|
|
796
|
+
*/
|
|
797
|
+
readonly y: number | null;
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Get the center x coordinate
|
|
801
|
+
*/
|
|
802
|
+
readonly centerX: number | null;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Get the center y coordinate
|
|
806
|
+
*/
|
|
807
|
+
readonly centerY: number | null;
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Get the full API response data
|
|
811
|
+
*/
|
|
812
|
+
getResponse(): ElementResponse | null;
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Get element screenshot if available (base64 encoded)
|
|
816
|
+
*/
|
|
817
|
+
readonly screenshot: string | null;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Get element confidence score if available
|
|
821
|
+
*/
|
|
822
|
+
readonly confidence: number | null;
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Get element width if available
|
|
826
|
+
*/
|
|
827
|
+
readonly width: number | null;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Get element height if available
|
|
831
|
+
*/
|
|
832
|
+
readonly height: number | null;
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Get element bounding box if available
|
|
836
|
+
*/
|
|
837
|
+
readonly boundingBox: ElementBoundingBox | null;
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Get element text content if available
|
|
841
|
+
*/
|
|
842
|
+
readonly text: string | null;
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Get element label if available
|
|
846
|
+
*/
|
|
847
|
+
readonly label: string | null;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
// ====================================
|
|
851
|
+
// Provision API Interfaces
|
|
852
|
+
// ====================================
|
|
853
|
+
|
|
854
|
+
/** Options for provision.chrome */
|
|
855
|
+
export interface ProvisionChromeOptions {
|
|
856
|
+
/** URL to navigate to (default: 'http://testdriver-sandbox.vercel.app/') */
|
|
857
|
+
url?: string;
|
|
858
|
+
/** Start maximized (default: true) */
|
|
859
|
+
maximized?: boolean;
|
|
860
|
+
/** Use guest mode (default: false) */
|
|
861
|
+
guest?: boolean;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
/** Options for provision.chromeExtension */
|
|
865
|
+
export interface ProvisionChromeExtensionOptions {
|
|
866
|
+
/** Local filesystem path to the unpacked extension directory */
|
|
867
|
+
extensionPath?: string;
|
|
868
|
+
/** Chrome Web Store extension ID */
|
|
869
|
+
extensionId?: string;
|
|
870
|
+
/** Start maximized (default: true) */
|
|
871
|
+
maximized?: boolean;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/** Options for provision.vscode */
|
|
875
|
+
export interface ProvisionVSCodeOptions {
|
|
876
|
+
/** Path to workspace or folder to open */
|
|
877
|
+
workspace?: string;
|
|
878
|
+
/** Array of extension IDs to install */
|
|
879
|
+
extensions?: string[];
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/** Options for provision.installer */
|
|
883
|
+
export interface ProvisionInstallerOptions {
|
|
884
|
+
/** URL to download the installer from */
|
|
885
|
+
url: string;
|
|
886
|
+
/** Filename to save as (auto-detected from URL if not provided) */
|
|
887
|
+
filename?: string;
|
|
888
|
+
/** Application name to focus after install */
|
|
889
|
+
appName?: string;
|
|
890
|
+
/** Whether to launch the app after installation (default: true) */
|
|
891
|
+
launch?: boolean;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
/** Options for provision.electron */
|
|
895
|
+
export interface ProvisionElectronOptions {
|
|
896
|
+
/** Path to Electron app (required) */
|
|
897
|
+
appPath: string;
|
|
898
|
+
/** Additional electron args */
|
|
899
|
+
args?: string[];
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/** Options for provision.dashcam */
|
|
903
|
+
export interface ProvisionDashcamOptions {
|
|
904
|
+
/** Path to log file (auto-generated if not provided) */
|
|
905
|
+
logPath?: string;
|
|
906
|
+
/** Display name for the log (default: 'TestDriver Log') */
|
|
907
|
+
logName?: string;
|
|
908
|
+
/** Enable web log tracking (default: true) */
|
|
909
|
+
webLogs?: boolean;
|
|
910
|
+
/** Custom title for the recording */
|
|
911
|
+
title?: string;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/** Provision API for launching applications */
|
|
915
|
+
export interface ProvisionAPI {
|
|
916
|
+
/**
|
|
917
|
+
* Launch Chrome browser
|
|
918
|
+
* @param options - Chrome launch options
|
|
919
|
+
*/
|
|
920
|
+
chrome(options?: ProvisionChromeOptions): Promise<void>;
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Launch Chrome browser with a custom extension loaded
|
|
924
|
+
* @param options - Chrome extension launch options
|
|
925
|
+
*/
|
|
926
|
+
chromeExtension(options?: ProvisionChromeExtensionOptions): Promise<void>;
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* Launch VS Code
|
|
930
|
+
* @param options - VS Code launch options
|
|
931
|
+
*/
|
|
932
|
+
vscode(options?: ProvisionVSCodeOptions): Promise<void>;
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Download and install an application
|
|
936
|
+
* @param options - Installer options
|
|
937
|
+
* @returns Path to the downloaded file
|
|
938
|
+
*/
|
|
939
|
+
installer(options: ProvisionInstallerOptions): Promise<string>;
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Launch Electron app
|
|
943
|
+
* @param options - Electron launch options
|
|
944
|
+
*/
|
|
945
|
+
electron(options: ProvisionElectronOptions): Promise<void>;
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Initialize Dashcam recording with logging
|
|
949
|
+
* @param options - Dashcam options
|
|
950
|
+
*/
|
|
951
|
+
dashcam(options?: ProvisionDashcamOptions): Promise<void>;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/** Dashcam API for screen recording */
|
|
955
|
+
export interface DashcamAPI {
|
|
956
|
+
/**
|
|
957
|
+
* Start recording
|
|
958
|
+
*/
|
|
959
|
+
start(): Promise<void>;
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Stop recording and get replay URL
|
|
963
|
+
*/
|
|
964
|
+
stop(): Promise<string | null>;
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Check if currently recording
|
|
968
|
+
*/
|
|
969
|
+
isRecording(): boolean;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
export default class TestDriverSDK {
|
|
973
|
+
/**
|
|
974
|
+
* Create a new TestDriverSDK instance
|
|
975
|
+
* Automatically loads environment variables from .env file via dotenv.
|
|
976
|
+
*
|
|
977
|
+
* @param apiKey - API key (optional, defaults to TD_API_KEY environment variable)
|
|
978
|
+
* @param options - SDK configuration options
|
|
979
|
+
*
|
|
980
|
+
* @example
|
|
981
|
+
* // API key loaded automatically from TD_API_KEY in .env
|
|
982
|
+
* const client = new TestDriver();
|
|
983
|
+
*
|
|
984
|
+
* @example
|
|
985
|
+
* // Pass options only (API key from .env)
|
|
986
|
+
* const client = new TestDriver({ os: 'windows' });
|
|
987
|
+
*
|
|
988
|
+
* @example
|
|
989
|
+
* // Or pass API key explicitly
|
|
990
|
+
* const client = new TestDriver('your-api-key');
|
|
991
|
+
*/
|
|
992
|
+
constructor(apiKey?: string | TestDriverOptions, options?: TestDriverOptions);
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* Whether the SDK is currently connected to a sandbox
|
|
996
|
+
*/
|
|
997
|
+
readonly connected: boolean;
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* The operating system of the sandbox
|
|
1001
|
+
*/
|
|
1002
|
+
readonly os: "windows" | "linux";
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Provision API for launching applications
|
|
1006
|
+
*/
|
|
1007
|
+
readonly provision: ProvisionAPI;
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* Dashcam API for screen recording
|
|
1011
|
+
*/
|
|
1012
|
+
readonly dashcam: DashcamAPI;
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Whether Dashcam recording is enabled (default: true)
|
|
1016
|
+
*/
|
|
1017
|
+
readonly dashcamEnabled: boolean;
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Wait for the sandbox to be ready
|
|
1021
|
+
* Called automatically by provision methods
|
|
1022
|
+
*/
|
|
1023
|
+
ready(): Promise<void>;
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* Authenticate with TestDriver API
|
|
1027
|
+
*/
|
|
1028
|
+
auth(): Promise<string>;
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* Connect to a sandbox environment
|
|
1032
|
+
*/
|
|
1033
|
+
connect(options?: ConnectOptions): Promise<SandboxInstance>;
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Disconnect from the sandbox
|
|
1037
|
+
*/
|
|
1038
|
+
disconnect(): Promise<void>;
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* Get the last sandbox info from the stored file
|
|
1042
|
+
* @returns Last sandbox info or null if not found
|
|
1043
|
+
*/
|
|
1044
|
+
getLastSandboxId(): {
|
|
1045
|
+
sandboxId: string | null;
|
|
1046
|
+
os: "windows" | "linux";
|
|
1047
|
+
ami: string | null;
|
|
1048
|
+
instanceType: string | null;
|
|
1049
|
+
timestamp: string | null;
|
|
1050
|
+
} | null;
|
|
1051
|
+
|
|
1052
|
+
// Element Finding API
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Find an element by description
|
|
1056
|
+
* Automatically locates the element and returns it
|
|
1057
|
+
*
|
|
1058
|
+
* @param description - Description of the element to find
|
|
1059
|
+
* @param options - Cache threshold (number) or options object with cache.thresholds
|
|
1060
|
+
* @returns Chainable promise that resolves to Element instance
|
|
1061
|
+
*
|
|
1062
|
+
* @example
|
|
1063
|
+
* // Find and click immediately (chainable)
|
|
1064
|
+
* await client.find('the sign in button').click();
|
|
1065
|
+
*
|
|
1066
|
+
* @example
|
|
1067
|
+
* // Find and click (traditional)
|
|
1068
|
+
* const element = await client.find('the sign in button');
|
|
1069
|
+
* await element.click();
|
|
1070
|
+
*
|
|
1071
|
+
* @example
|
|
1072
|
+
* // Find with custom cache thresholds
|
|
1073
|
+
* const element = await client.find('login button', {
|
|
1074
|
+
* cache: { thresholds: { screen: 0.05, element: 0.9 } }
|
|
1075
|
+
* });
|
|
1076
|
+
*
|
|
1077
|
+
* @example
|
|
1078
|
+
* // Poll for element with timeout (retries every 5 seconds)
|
|
1079
|
+
* const element = await client.find('loading complete indicator', { timeout: 30000 });
|
|
1080
|
+
* await element.click();
|
|
1081
|
+
*/
|
|
1082
|
+
find(description: string, cacheThreshold?: number): ChainableElementPromise;
|
|
1083
|
+
find(
|
|
1084
|
+
description: string,
|
|
1085
|
+
options?: { cacheThreshold?: number; cacheKey?: string; timeout?: number; confidence?: number; type?: "text" | "image" | "ui" | "any"; ai?: AIConfig; cache?: { thresholds?: { screen?: number; element?: number } } },
|
|
1086
|
+
): ChainableElementPromise;
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* Find all elements matching a description
|
|
1090
|
+
* @param description - Description of the elements to find
|
|
1091
|
+
* @param cacheThreshold - Cache threshold for this specific findAll (overrides global setting)
|
|
1092
|
+
* @returns Array of Element instances
|
|
1093
|
+
*
|
|
1094
|
+
* @example
|
|
1095
|
+
* // Find all buttons
|
|
1096
|
+
* const buttons = await client.findAll('button');
|
|
1097
|
+
*
|
|
1098
|
+
* @example
|
|
1099
|
+
* // Find with custom cache threshold
|
|
1100
|
+
* const items = await client.findAll('list item', 0.05);
|
|
1101
|
+
*/
|
|
1102
|
+
findAll(description: string, cacheThreshold?: number): Promise<Element[]>;
|
|
1103
|
+
findAll(
|
|
1104
|
+
description: string,
|
|
1105
|
+
options?: { cacheThreshold?: number; cacheKey?: string; cache?: { thresholds?: { screen?: number } } },
|
|
1106
|
+
): Promise<Element[]>;
|
|
1107
|
+
|
|
1108
|
+
// Text Interaction Methods
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* Hover over text on screen
|
|
1112
|
+
* @deprecated Use find() and element.click() instead
|
|
1113
|
+
* @param options - Options object with text, description, action, and timeout
|
|
1114
|
+
*/
|
|
1115
|
+
hoverText(options: HoverTextOptions): Promise<HoverResult>;
|
|
1116
|
+
/**
|
|
1117
|
+
* Hover over text on screen (positional arguments - legacy)
|
|
1118
|
+
* @deprecated Use find() and element.click() instead
|
|
1119
|
+
* @param text - Text to find and hover over
|
|
1120
|
+
* @param description - Optional description of the element
|
|
1121
|
+
* @param action - Action to perform (default: 'click')
|
|
1122
|
+
* @param timeout - Timeout in milliseconds (default: 5000)
|
|
1123
|
+
*/
|
|
1124
|
+
hoverText(
|
|
1125
|
+
text: string,
|
|
1126
|
+
description?: string | null,
|
|
1127
|
+
action?: ClickAction,
|
|
1128
|
+
timeout?: number,
|
|
1129
|
+
): Promise<HoverResult>;
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Type text
|
|
1133
|
+
* @param text - Text to type
|
|
1134
|
+
* @param options - Options object with delay and secret
|
|
1135
|
+
*
|
|
1136
|
+
* @example
|
|
1137
|
+
* // Type regular text
|
|
1138
|
+
* await client.type('hello world');
|
|
1139
|
+
*
|
|
1140
|
+
* @example
|
|
1141
|
+
* // Type a password securely (not logged or stored)
|
|
1142
|
+
* await client.type(process.env.TD_PASSWORD, { secret: true });
|
|
1143
|
+
*
|
|
1144
|
+
* @example
|
|
1145
|
+
* // Type with custom delay
|
|
1146
|
+
* await client.type('slow typing', { delay: 100 });
|
|
1147
|
+
*/
|
|
1148
|
+
type(
|
|
1149
|
+
text: string | number,
|
|
1150
|
+
options?: { delay?: number; secret?: boolean },
|
|
1151
|
+
): Promise<void>;
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Wait for text to appear on screen
|
|
1155
|
+
* @deprecated Use find() in a polling loop instead
|
|
1156
|
+
* @param options - Options object with text and timeout
|
|
1157
|
+
*/
|
|
1158
|
+
waitForText(options: WaitForTextOptions): Promise<void>;
|
|
1159
|
+
/**
|
|
1160
|
+
* Wait for text to appear on screen (positional arguments - legacy)
|
|
1161
|
+
* @deprecated Use find() in a polling loop instead
|
|
1162
|
+
* @param text - Text to wait for
|
|
1163
|
+
* @param timeout - Timeout in milliseconds (default: 5000)
|
|
1164
|
+
*/
|
|
1165
|
+
waitForText(text: string, timeout?: number): Promise<void>;
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* Scroll until text is found
|
|
1169
|
+
* @param options - Options object with text, direction, maxDistance, and invert
|
|
1170
|
+
*/
|
|
1171
|
+
scrollUntilText(options: ScrollUntilTextOptions): Promise<void>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Scroll until text is found (positional arguments - legacy)
|
|
1174
|
+
* @param text - Text to find
|
|
1175
|
+
* @param direction - Scroll direction (default: 'down')
|
|
1176
|
+
* @param maxDistance - Maximum distance to scroll in pixels (default: 10000)
|
|
1177
|
+
* @param invert - Invert the match (default: false)
|
|
1178
|
+
*/
|
|
1179
|
+
scrollUntilText(
|
|
1180
|
+
text: string,
|
|
1181
|
+
direction?: ScrollDirection,
|
|
1182
|
+
maxDistance?: number,
|
|
1183
|
+
invert?: boolean,
|
|
1184
|
+
): Promise<void>;
|
|
1185
|
+
|
|
1186
|
+
// Image Interaction Methods
|
|
1187
|
+
|
|
1188
|
+
/**
|
|
1189
|
+
* Hover over an image on screen
|
|
1190
|
+
* @deprecated Use find() and element.click() instead
|
|
1191
|
+
* @param options - Options object with description and action
|
|
1192
|
+
*/
|
|
1193
|
+
hoverImage(options: HoverImageOptions): Promise<HoverResult>;
|
|
1194
|
+
/**
|
|
1195
|
+
* Hover over an image on screen (positional arguments - legacy)
|
|
1196
|
+
* @deprecated Use find() and element.click() instead
|
|
1197
|
+
* @param description - Description of the image to find
|
|
1198
|
+
* @param action - Action to perform (default: 'click')
|
|
1199
|
+
*/
|
|
1200
|
+
hoverImage(description: string, action?: ClickAction): Promise<HoverResult>;
|
|
1201
|
+
|
|
1202
|
+
/**
|
|
1203
|
+
* Match and interact with an image template
|
|
1204
|
+
* @param options - Options object with path, action, and invert
|
|
1205
|
+
*/
|
|
1206
|
+
matchImage(options: MatchImageOptions): Promise<boolean>;
|
|
1207
|
+
/**
|
|
1208
|
+
* Match and interact with an image template (positional arguments - legacy)
|
|
1209
|
+
* @param imagePath - Path to the image template
|
|
1210
|
+
* @param action - Action to perform (default: 'click')
|
|
1211
|
+
* @param invert - Invert the match (default: false)
|
|
1212
|
+
*/
|
|
1213
|
+
matchImage(
|
|
1214
|
+
imagePath: string,
|
|
1215
|
+
action?: ClickAction,
|
|
1216
|
+
invert?: boolean,
|
|
1217
|
+
): Promise<boolean>;
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
* Wait for image to appear on screen
|
|
1221
|
+
* @deprecated Use find() in a polling loop instead
|
|
1222
|
+
* @param options - Options object with description and timeout
|
|
1223
|
+
*/
|
|
1224
|
+
waitForImage(options: WaitForImageOptions): Promise<void>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Wait for image to appear on screen (positional arguments - legacy)
|
|
1227
|
+
* @deprecated Use find() in a polling loop instead
|
|
1228
|
+
* @param description - Description of the image
|
|
1229
|
+
* @param timeout - Timeout in milliseconds (default: 10000)
|
|
1230
|
+
*/
|
|
1231
|
+
waitForImage(description: string, timeout?: number): Promise<void>;
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* Scroll until image is found
|
|
1235
|
+
* @param options - Options object with description, direction, maxDistance, method, path, and invert
|
|
1236
|
+
*/
|
|
1237
|
+
scrollUntilImage(options: ScrollUntilImageOptions): Promise<void>;
|
|
1238
|
+
/**
|
|
1239
|
+
* Scroll until image is found (positional arguments - legacy)
|
|
1240
|
+
* @param description - Description of the image (or use path parameter)
|
|
1241
|
+
* @param direction - Scroll direction (default: 'down')
|
|
1242
|
+
* @param maxDistance - Maximum distance to scroll in pixels (default: 10000)
|
|
1243
|
+
* @param method - Scroll method (default: 'keyboard')
|
|
1244
|
+
* @param path - Path to image template (default: null)
|
|
1245
|
+
* @param invert - Invert the match (default: false)
|
|
1246
|
+
*/
|
|
1247
|
+
scrollUntilImage(
|
|
1248
|
+
description: string,
|
|
1249
|
+
direction?: ScrollDirection,
|
|
1250
|
+
maxDistance?: number,
|
|
1251
|
+
method?: ScrollMethod,
|
|
1252
|
+
path?: string | null,
|
|
1253
|
+
invert?: boolean,
|
|
1254
|
+
): Promise<void>;
|
|
1255
|
+
|
|
1256
|
+
// Mouse & Keyboard Methods
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* Click at coordinates
|
|
1260
|
+
* @param options - Options object with x, y, and action
|
|
1261
|
+
*/
|
|
1262
|
+
click(options: ClickOptions): Promise<void>;
|
|
1263
|
+
/**
|
|
1264
|
+
* Click at coordinates (positional arguments - legacy)
|
|
1265
|
+
* @param x - X coordinate
|
|
1266
|
+
* @param y - Y coordinate
|
|
1267
|
+
* @param action - Type of click action (default: 'click')
|
|
1268
|
+
*/
|
|
1269
|
+
click(x: number, y: number, action?: ClickAction): Promise<void>;
|
|
1270
|
+
|
|
1271
|
+
/**
|
|
1272
|
+
* Hover at coordinates
|
|
1273
|
+
* @param options - Options object with x and y
|
|
1274
|
+
*/
|
|
1275
|
+
hover(options: HoverOptions): Promise<void>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Hover at coordinates (positional arguments - legacy)
|
|
1278
|
+
* @param x - X coordinate
|
|
1279
|
+
* @param y - Y coordinate
|
|
1280
|
+
*/
|
|
1281
|
+
hover(x: number, y: number): Promise<void>;
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Press keyboard keys
|
|
1285
|
+
* @param keys - Array of keys to press
|
|
1286
|
+
* @param options - Additional options (reserved for future use)
|
|
1287
|
+
*/
|
|
1288
|
+
pressKeys(keys: KeyboardKey[], options?: object): Promise<void>;
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* Scroll the page
|
|
1292
|
+
* @param direction - Direction to scroll (default: 'down')
|
|
1293
|
+
* @param options - Options object with amount
|
|
1294
|
+
*/
|
|
1295
|
+
scroll(
|
|
1296
|
+
direction?: ScrollDirection,
|
|
1297
|
+
options?: { amount?: number },
|
|
1298
|
+
): Promise<void>;
|
|
1299
|
+
|
|
1300
|
+
// Application Control
|
|
1301
|
+
|
|
1302
|
+
/**
|
|
1303
|
+
* Focus an application by name
|
|
1304
|
+
* @param name - Application name
|
|
1305
|
+
* @param options - Additional options (reserved for future use)
|
|
1306
|
+
*/
|
|
1307
|
+
focusApplication(name: string, options?: object): Promise<string>;
|
|
1308
|
+
|
|
1309
|
+
// AI-Powered Methods
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Make an AI-powered assertion
|
|
1313
|
+
* @param assertion - Assertion to check
|
|
1314
|
+
* @param options - Cache options for the assertion
|
|
1315
|
+
*
|
|
1316
|
+
* @example
|
|
1317
|
+
* // Simple assertion
|
|
1318
|
+
* await client.assert('the login form is visible');
|
|
1319
|
+
*
|
|
1320
|
+
* @example
|
|
1321
|
+
* // With caching enabled via cacheKey
|
|
1322
|
+
* await client.assert('the submit button is enabled', { cacheKey: 'my-test-run' });
|
|
1323
|
+
*
|
|
1324
|
+
* @example
|
|
1325
|
+
* // With custom threshold
|
|
1326
|
+
* await client.assert('the page loaded', { threshold: 0.05, cacheKey: 'login-test' });
|
|
1327
|
+
*/
|
|
1328
|
+
assert(assertion: string, options?: { threshold?: number; cacheKey?: string; os?: string; resolution?: string; ai?: AIConfig }): Promise<boolean>;
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Extract information from the screen using AI
|
|
1332
|
+
* @param options - Options object with description
|
|
1333
|
+
*/
|
|
1334
|
+
extract(options: { description: string }): Promise<string>;
|
|
1335
|
+
/**
|
|
1336
|
+
* Extract information from the screen using AI (positional arguments - legacy)
|
|
1337
|
+
* @param description - What to extract
|
|
1338
|
+
*/
|
|
1339
|
+
extract(description: string): Promise<string>;
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* Solve a captcha on the current page using 2captcha service
|
|
1343
|
+
* @param options - Captcha solving options
|
|
1344
|
+
*/
|
|
1345
|
+
captcha(options: CaptchaOptions): Promise<CaptchaResult>;
|
|
1346
|
+
|
|
1347
|
+
// Code Execution
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Execute code in the sandbox
|
|
1351
|
+
* @param options - Options object with language, code, timeout, and silent
|
|
1352
|
+
*/
|
|
1353
|
+
exec(options: ExecOptions): Promise<string>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Execute code in the sandbox (positional arguments - legacy)
|
|
1356
|
+
* @param language - Language ('js' or 'pwsh')
|
|
1357
|
+
* @param code - Code to execute
|
|
1358
|
+
* @param timeout - Timeout in milliseconds
|
|
1359
|
+
* @param silent - Suppress output (default: false)
|
|
1360
|
+
*/
|
|
1361
|
+
exec(
|
|
1362
|
+
language: ExecLanguage,
|
|
1363
|
+
code: string,
|
|
1364
|
+
timeout: number,
|
|
1365
|
+
silent?: boolean,
|
|
1366
|
+
): Promise<string>;
|
|
1367
|
+
|
|
1368
|
+
// Utility Methods
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* Capture a screenshot of the current screen and save it to .testdriver/screenshots
|
|
1372
|
+
* @param filename - Custom filename (without .png extension)
|
|
1373
|
+
* @returns The file path where the screenshot was saved
|
|
1374
|
+
*
|
|
1375
|
+
* @example
|
|
1376
|
+
* // Capture a screenshot with auto-generated filename
|
|
1377
|
+
* const screenshotPath = await testdriver.screenshot();
|
|
1378
|
+
*
|
|
1379
|
+
* @example
|
|
1380
|
+
* // Capture with custom filename
|
|
1381
|
+
* const screenshotPath = await testdriver.screenshot("login-page");
|
|
1382
|
+
* // Saves to: .testdriver/screenshots/<test>/login-page.png
|
|
1383
|
+
*/
|
|
1384
|
+
screenshot(filename?: string): Promise<string>;
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Parse the current screen using OmniParser v2 to detect all UI elements
|
|
1388
|
+
* Returns structured data with element types, bounding boxes, and content
|
|
1389
|
+
* Requires enterprise or self-hosted plan.
|
|
1390
|
+
*
|
|
1391
|
+
* @returns Parsed screen elements with positions and types
|
|
1392
|
+
*
|
|
1393
|
+
* @example
|
|
1394
|
+
* // Get all elements on screen
|
|
1395
|
+
* const result = await testdriver.parse();
|
|
1396
|
+
* console.log(`Found ${result.elements.length} elements`);
|
|
1397
|
+
*
|
|
1398
|
+
* @example
|
|
1399
|
+
* // Find clickable elements
|
|
1400
|
+
* const result = await testdriver.parse();
|
|
1401
|
+
* const clickable = result.elements.filter(e => e.interactivity === 'clickable');
|
|
1402
|
+
*
|
|
1403
|
+
* @example
|
|
1404
|
+
* // Find text content
|
|
1405
|
+
* const result = await testdriver.parse();
|
|
1406
|
+
* const textElements = result.elements.filter(e => e.type === 'text');
|
|
1407
|
+
*/
|
|
1408
|
+
parse(): Promise<ParseResult>;
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Wait for specified time. Useful for adding delays between actions, waiting for
|
|
1412
|
+
* animations to complete, or pausing for state changes to settle.
|
|
1413
|
+
*
|
|
1414
|
+
* For waiting for specific elements to appear, prefer `find()` with a `timeout` option instead.
|
|
1415
|
+
*
|
|
1416
|
+
* @param timeout - Time to wait in milliseconds (default: 3000)
|
|
1417
|
+
* @param options - Additional options (reserved for future use)
|
|
1418
|
+
*
|
|
1419
|
+
* @example
|
|
1420
|
+
* // Wait 2 seconds for an animation to complete
|
|
1421
|
+
* await testdriver.wait(2000);
|
|
1422
|
+
*
|
|
1423
|
+
* @example
|
|
1424
|
+
* // Wait after a click for state to settle
|
|
1425
|
+
* await testdriver.find('submit button').click();
|
|
1426
|
+
* await testdriver.wait(1000);
|
|
1427
|
+
*/
|
|
1428
|
+
wait(timeout?: number, options?: object): Promise<void>;
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Get the current sandbox instance details
|
|
1432
|
+
*/
|
|
1433
|
+
getInstance(): SandboxInstance | null;
|
|
1434
|
+
|
|
1435
|
+
/**
|
|
1436
|
+
* Get the session ID
|
|
1437
|
+
*/
|
|
1438
|
+
getSessionId(): string | null;
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* Enable or disable logging output
|
|
1442
|
+
*/
|
|
1443
|
+
setLogging(enabled: boolean): void;
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* Get the event emitter for custom event handling
|
|
1447
|
+
*/
|
|
1448
|
+
getEmitter(): any; // EventEmitter2 type
|
|
1449
|
+
|
|
1450
|
+
// AI Methods (Exploratory Loop)
|
|
1451
|
+
|
|
1452
|
+
/**
|
|
1453
|
+
* @deprecated Use ai() instead
|
|
1454
|
+
* Execute a natural language task using AI
|
|
1455
|
+
* This is the SDK equivalent of the CLI's exploratory loop
|
|
1456
|
+
*
|
|
1457
|
+
* @param task - Natural language description of what to do
|
|
1458
|
+
* @param options - Execution options
|
|
1459
|
+
* @returns Final AI response if validateAndLoop is true
|
|
1460
|
+
*
|
|
1461
|
+
* @example
|
|
1462
|
+
* // Simple execution
|
|
1463
|
+
* await client.ai('Click the submit button');
|
|
1464
|
+
*
|
|
1465
|
+
* @example
|
|
1466
|
+
* // With validation loop
|
|
1467
|
+
* const result = await client.ai('Fill out the contact form', { validateAndLoop: true });
|
|
1468
|
+
* console.log(result); // AI's final assessment
|
|
1469
|
+
*/
|
|
1470
|
+
act(
|
|
1471
|
+
task: string,
|
|
1472
|
+
options?: { validateAndLoop?: boolean },
|
|
1473
|
+
): Promise<string | void>;
|
|
1474
|
+
|
|
1475
|
+
/**
|
|
1476
|
+
* Execute a natural language task using AI
|
|
1477
|
+
*
|
|
1478
|
+
* @param task - Natural language description of what to do
|
|
1479
|
+
* @param options - Execution options
|
|
1480
|
+
* @returns Final AI response if validateAndLoop is true
|
|
1481
|
+
*/
|
|
1482
|
+
ai(
|
|
1483
|
+
task: string,
|
|
1484
|
+
options?: { validateAndLoop?: boolean },
|
|
1485
|
+
): Promise<string | void>;
|
|
1486
|
+
}
|