testdriverai 7.2.63 → 7.2.65
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/agent/index.js +77 -59
- package/agent/interface.js +11 -251
- package/agent/lib/debugger-server.js +2 -1
- package/agent/lib/logger.js +56 -0
- package/agent/lib/sandbox.js +79 -29
- package/ai/agents/test-writer.md +457 -0
- package/{docs/v7/ai.mdx → ai/skills/testdriver:ai/SKILL.md} +3 -5
- package/{docs/v7/assert.mdx → ai/skills/testdriver:assert/SKILL.md} +3 -4
- package/{docs/v7/aws-setup.mdx → ai/skills/testdriver:aws-setup/SKILL.md} +3 -4
- package/{docs/v7/caching.mdx → ai/skills/testdriver:caching/SKILL.md} +3 -7
- package/{docs/v7/captcha.mdx → ai/skills/testdriver:captcha/SKILL.md} +4 -5
- package/{docs/v7/ci-cd.mdx → ai/skills/testdriver:ci-cd/SKILL.md} +3 -4
- package/{docs/v7/click.mdx → ai/skills/testdriver:click/SKILL.md} +3 -4
- package/{docs/v7/client.mdx → ai/skills/testdriver:client/SKILL.md} +11 -5
- package/{docs/v7/cloud.mdx → ai/skills/testdriver:cloud/SKILL.md} +3 -4
- package/{docs/v7/customizing-devices.mdx → ai/skills/testdriver:customizing-devices/SKILL.md} +36 -26
- package/{docs/v7/dashcam.mdx → ai/skills/testdriver:dashcam/SKILL.md} +3 -4
- package/{docs/v7/device-config.mdx → ai/skills/testdriver:device-config/SKILL.md} +3 -3
- package/{docs/v7/double-click.mdx → ai/skills/testdriver:double-click/SKILL.md} +3 -3
- package/{docs/v7/elements.mdx → ai/skills/testdriver:elements/SKILL.md} +3 -4
- package/{docs/v7/enterprise.mdx → ai/skills/testdriver:enterprise/SKILL.md} +3 -5
- package/ai/skills/testdriver:examples/SKILL.md +7 -0
- package/{docs/v7/exec.mdx → ai/skills/testdriver:exec/SKILL.md} +3 -4
- package/{docs/v7/find.mdx → ai/skills/testdriver:find/SKILL.md} +81 -4
- package/{docs/v7/focus-application.mdx → ai/skills/testdriver:focus-application/SKILL.md} +3 -4
- package/{docs/v7/generating-tests.mdx → ai/skills/testdriver:generating-tests/SKILL.md} +3 -3
- package/{docs/v7/hover.mdx → ai/skills/testdriver:hover/SKILL.md} +3 -4
- package/{docs/v7/locating-elements.mdx → ai/skills/testdriver:locating-elements/SKILL.md} +3 -3
- package/{docs/v7/making-assertions.mdx → ai/skills/testdriver:making-assertions/SKILL.md} +3 -3
- package/ai/skills/testdriver:mcp-workflow/SKILL.md +410 -0
- package/{docs/v7/mouse-down.mdx → ai/skills/testdriver:mouse-down/SKILL.md} +3 -3
- package/{docs/v7/mouse-up.mdx → ai/skills/testdriver:mouse-up/SKILL.md} +3 -3
- package/{docs/v7/performing-actions.mdx → ai/skills/testdriver:performing-actions/SKILL.md} +3 -3
- package/{docs/v7/press-keys.mdx → ai/skills/testdriver:press-keys/SKILL.md} +3 -4
- package/{docs/v7/quickstart.mdx → ai/skills/testdriver:quickstart/SKILL.md} +3 -4
- package/{docs/v7/reusable-code.mdx → ai/skills/testdriver:reusable-code/SKILL.md} +3 -3
- package/{docs/v7/right-click.mdx → ai/skills/testdriver:right-click/SKILL.md} +3 -3
- package/{docs/v7/running-tests.mdx → ai/skills/testdriver:running-tests/SKILL.md} +3 -3
- package/{docs/v7/screenshot.mdx → ai/skills/testdriver:screenshot/SKILL.md} +3 -4
- package/{docs/v7/scroll.mdx → ai/skills/testdriver:scroll/SKILL.md} +3 -4
- package/{docs/v7/secrets.mdx → ai/skills/testdriver:secrets/SKILL.md} +3 -3
- package/{docs/v7/self-hosted.mdx → ai/skills/testdriver:self-hosted/SKILL.md} +3 -4
- package/ai/skills/testdriver:testdriver/SKILL.md +31 -0
- package/{docs/v7/type.mdx → ai/skills/testdriver:type/SKILL.md} +3 -4
- package/{docs/v7/variables.mdx → ai/skills/testdriver:variables/SKILL.md} +3 -3
- package/{docs/v7/waiting-for-elements.mdx → ai/skills/testdriver:waiting-for-elements/SKILL.md} +3 -3
- package/{docs/v7/what-is-testdriver.mdx → ai/skills/testdriver:what-is-testdriver/SKILL.md} +3 -3
- package/interfaces/cli/commands/init.js +278 -1
- package/interfaces/cli/commands/setup.js +382 -0
- package/interfaces/vitest-plugin.mjs +190 -122
- package/lib/core/Dashcam.js +22 -15
- package/lib/sentry.js +4 -3
- package/lib/vitest/hooks.mjs +70 -16
- package/lib/vitest/setup-aws.mjs +0 -10
- package/package.json +29 -9
- package/sdk.d.ts +32 -5
- package/sdk.js +10 -9
- package/.env.example +0 -4
- package/.github/workflows/acceptance-linux-scheduled.yaml +0 -45
- package/.github/workflows/acceptance-windows-scheduled.yaml +0 -54
- package/.github/workflows/acceptance.yaml +0 -87
- package/.github/workflows/publish.yaml +0 -68
- package/.github/workflows/test-init.yml +0 -145
- package/.github/workflows/testdriver.yml +0 -170
- package/.github/workflows/windows-self-hosted.yaml +0 -82
- package/.prettierignore +0 -4
- package/.prettierrc +0 -1
- package/CHANGELOG.md +0 -30
- package/agents.md +0 -455
- package/debugger/bg.png +0 -0
- package/debugger/icon.png +0 -0
- package/debugger/index.html +0 -797
- package/debugger/td.png +0 -0
- package/debugger/tray-buffered.png +0 -0
- package/debugger/tray.png +0 -0
- package/docs/GITHUB_COMMENTS.md +0 -330
- package/docs/GITHUB_COMMENTS_ANNOUNCEMENT.md +0 -167
- package/docs/QUICK-START-GITHUB-COMMENTS.md +0 -84
- package/docs/TEST-GITHUB-COMMENTS.md +0 -129
- package/docs/_scripts/link-replacer.js +0 -164
- package/docs/_scripts/upload-docs-to-openai.js +0 -284
- package/docs/docs.json +0 -393
- package/docs/github-integration-setup.md +0 -266
- package/docs/guide/best-practices-polling.mdx +0 -154
- 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 +0 -1
- package/docs/images/content/extension/vscode.svg +0 -57
- package/docs/images/content/extension/windsurf.svg +0 -3
- 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/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 +0 -4
- package/docs/snippets/gitignore-warning.mdx +0 -7
- package/docs/snippets/lifecycle-warning.mdx +0 -6
- package/docs/snippets/test-prereqs.mdx +0 -12
- package/docs/snippets/tests/assert-replay.mdx +0 -7
- package/docs/snippets/tests/assert-yaml.mdx +0 -8
- package/docs/snippets/tests/exec-js-replay.mdx +0 -7
- package/docs/snippets/tests/exec-js-yaml.mdx +0 -32
- package/docs/snippets/tests/exec-shell-replay.mdx +0 -7
- package/docs/snippets/tests/exec-shell-yaml.mdx +0 -15
- package/docs/snippets/tests/hover-image-replay.mdx +0 -7
- package/docs/snippets/tests/hover-image-yaml.mdx +0 -17
- package/docs/snippets/tests/hover-text-replay.mdx +0 -7
- package/docs/snippets/tests/hover-text-with-description-replay.mdx +0 -7
- package/docs/snippets/tests/hover-text-with-description-yaml.mdx +0 -24
- package/docs/snippets/tests/hover-text-yaml.mdx +0 -14
- package/docs/snippets/tests/match-image-replay.mdx +0 -7
- package/docs/snippets/tests/match-image-yaml.mdx +0 -17
- package/docs/snippets/tests/press-keys-replay.mdx +0 -7
- package/docs/snippets/tests/press-keys-yaml.mdx +0 -36
- package/docs/snippets/tests/remember-replay.mdx +0 -7
- package/docs/snippets/tests/remember-yaml.mdx +0 -28
- package/docs/snippets/tests/scroll-replay.mdx +0 -7
- package/docs/snippets/tests/scroll-until-image-replay.mdx +0 -7
- package/docs/snippets/tests/scroll-until-image-yaml.mdx +0 -14
- package/docs/snippets/tests/scroll-until-text-replay.mdx +0 -7
- package/docs/snippets/tests/scroll-until-text-yaml.mdx +0 -17
- package/docs/snippets/tests/scroll-yaml.mdx +0 -30
- package/docs/snippets/tests/type-repeated-replay.mdx +0 -7
- package/docs/snippets/tests/type-repeated-yaml.mdx +0 -22
- package/docs/snippets/tests/type-replay.mdx +0 -7
- package/docs/snippets/tests/type-yaml.mdx +0 -28
- package/docs/snippets/tests/wait-for-image-replay.mdx +0 -7
- package/docs/snippets/tests/wait-for-image-yaml.mdx +0 -18
- package/docs/snippets/tests/wait-for-text-replay.mdx +0 -7
- package/docs/snippets/tests/wait-for-text-yaml.mdx +0 -18
- package/docs/snippets/tests/wait-replay.mdx +0 -7
- package/docs/snippets/tests/wait-yaml.mdx +0 -13
- package/docs/styles.css +0 -65
- package/docs/v6/account/dashboard.mdx +0 -16
- package/docs/v6/account/enterprise.mdx +0 -110
- package/docs/v6/account/pricing.mdx +0 -33
- package/docs/v6/account/projects.mdx +0 -33
- package/docs/v6/account/team.mdx +0 -35
- package/docs/v6/action/ami.mdx +0 -109
- package/docs/v6/action/performance.mdx +0 -105
- package/docs/v6/action/secrets.mdx +0 -93
- package/docs/v6/apps/chrome-extensions.mdx +0 -48
- package/docs/v6/apps/desktop-apps.mdx +0 -93
- package/docs/v6/apps/mobile-apps.mdx +0 -26
- package/docs/v6/apps/static-websites.mdx +0 -54
- package/docs/v6/apps/tauri-apps.mdx +0 -361
- package/docs/v6/bugs/jira.mdx +0 -232
- package/docs/v6/cli/overview.mdx +0 -66
- package/docs/v6/commands/assert.mdx +0 -45
- package/docs/v6/commands/exec.mdx +0 -282
- package/docs/v6/commands/focus-application.mdx +0 -44
- package/docs/v6/commands/hover-image.mdx +0 -69
- package/docs/v6/commands/hover-text.mdx +0 -47
- package/docs/v6/commands/if.mdx +0 -53
- package/docs/v6/commands/match-image.mdx +0 -67
- package/docs/v6/commands/press-keys.mdx +0 -87
- package/docs/v6/commands/remember.mdx +0 -49
- package/docs/v6/commands/run.mdx +0 -44
- package/docs/v6/commands/scroll-until-image.mdx +0 -66
- package/docs/v6/commands/scroll-until-text.mdx +0 -60
- package/docs/v6/commands/scroll.mdx +0 -69
- package/docs/v6/commands/type.mdx +0 -45
- package/docs/v6/commands/wait-for-image.mdx +0 -54
- package/docs/v6/commands/wait-for-text.mdx +0 -48
- package/docs/v6/commands/wait.mdx +0 -45
- package/docs/v6/exporting/junit.mdx +0 -218
- package/docs/v6/exporting/playwright.mdx +0 -197
- package/docs/v6/features/auto-healing.mdx +0 -144
- package/docs/v6/features/generation.mdx +0 -116
- package/docs/v6/features/parallel-testing.mdx +0 -151
- package/docs/v6/features/reusable-snippets.mdx +0 -131
- package/docs/v6/features/selectorless.mdx +0 -80
- package/docs/v6/features/visual-assertions.mdx +0 -139
- package/docs/v6/getting-started/ci.mdx +0 -146
- package/docs/v6/getting-started/cli.mdx +0 -91
- package/docs/v6/getting-started/editing.mdx +0 -100
- package/docs/v6/getting-started/playwright.mdx +0 -342
- package/docs/v6/getting-started/running.mdx +0 -48
- package/docs/v6/getting-started/self-hosting.mdx +0 -408
- package/docs/v6/getting-started/vscode.mdx +0 -89
- package/docs/v6/guide/assertions.mdx +0 -189
- package/docs/v6/guide/authentication.mdx +0 -136
- package/docs/v6/guide/code.mdx +0 -65
- package/docs/v6/guide/dashcam.mdx +0 -118
- package/docs/v6/guide/environment-variables.mdx +0 -26
- package/docs/v6/guide/lifecycle.mdx +0 -242
- package/docs/v6/guide/locating.mdx +0 -141
- package/docs/v6/guide/protips.mdx +0 -43
- package/docs/v6/guide/variables.mdx +0 -143
- package/docs/v6/guide/waiting.mdx +0 -130
- package/docs/v6/importing/csv.mdx +0 -196
- package/docs/v6/importing/gherkin.mdx +0 -143
- package/docs/v6/importing/jira.mdx +0 -164
- package/docs/v6/importing/testrail.mdx +0 -162
- package/docs/v6/integrations/electron.mdx +0 -146
- package/docs/v6/integrations/netlify.mdx +0 -100
- package/docs/v6/integrations/vercel.mdx +0 -125
- package/docs/v6/interactive/explore.mdx +0 -99
- package/docs/v6/interactive/run.mdx +0 -52
- package/docs/v6/interactive/save.mdx +0 -63
- package/docs/v6/overview/comparison.mdx +0 -101
- package/docs/v6/overview/faq.mdx +0 -162
- package/docs/v6/overview/performance.mdx +0 -52
- package/docs/v6/overview/quickstart.mdx +0 -137
- package/docs/v6/overview/what-is-testdriver.mdx +0 -85
- package/docs/v6/scenarios/ai-chatbot.mdx +0 -28
- package/docs/v6/scenarios/cookie-banner.mdx +0 -32
- package/docs/v6/scenarios/file-upload.mdx +0 -33
- package/docs/v6/scenarios/form-filling.mdx +0 -32
- package/docs/v6/scenarios/log-in.mdx +0 -75
- package/docs/v6/scenarios/pdf-generation.mdx +0 -25
- package/docs/v6/scenarios/spell-check.mdx +0 -22
- package/docs/v6/security/action.mdx +0 -84
- package/docs/v6/security/agent.mdx +0 -73
- package/docs/v6/security/platform.mdx +0 -77
- package/docs/v6/tutorials/advanced-test.mdx +0 -81
- package/docs/v6/tutorials/basic-test.mdx +0 -45
- package/docs/v7/_drafts/agents.mdx +0 -852
- package/docs/v7/_drafts/architecture.mdx +0 -399
- package/docs/v7/_drafts/auto-cache-key.mdx +0 -167
- package/docs/v7/_drafts/awesome-logs-quick-ref.mdx +0 -100
- package/docs/v7/_drafts/best-practices.mdx +0 -486
- package/docs/v7/_drafts/caching-ai.mdx +0 -215
- package/docs/v7/_drafts/caching-selectors.mdx +0 -424
- package/docs/v7/_drafts/caching.mdx +0 -366
- package/docs/v7/_drafts/cli-to-sdk-migration.mdx +0 -425
- package/docs/v7/_drafts/commands/assert.mdx +0 -45
- package/docs/v7/_drafts/commands/exec.mdx +0 -282
- package/docs/v7/_drafts/commands/focus-application.mdx +0 -44
- package/docs/v7/_drafts/commands/hover-image.mdx +0 -69
- package/docs/v7/_drafts/commands/hover-text.mdx +0 -47
- package/docs/v7/_drafts/commands/if.mdx +0 -53
- package/docs/v7/_drafts/commands/match-image.mdx +0 -67
- package/docs/v7/_drafts/commands/press-keys.mdx +0 -87
- package/docs/v7/_drafts/commands/remember.mdx +0 -49
- package/docs/v7/_drafts/commands/run.mdx +0 -44
- package/docs/v7/_drafts/commands/scroll-until-image.mdx +0 -66
- package/docs/v7/_drafts/commands/scroll-until-text.mdx +0 -60
- package/docs/v7/_drafts/commands/scroll.mdx +0 -69
- package/docs/v7/_drafts/commands/type.mdx +0 -45
- package/docs/v7/_drafts/commands/wait-for-image.mdx +0 -54
- package/docs/v7/_drafts/commands/wait-for-text.mdx +0 -48
- package/docs/v7/_drafts/commands/wait.mdx +0 -45
- package/docs/v7/_drafts/configuration.mdx +0 -378
- package/docs/v7/_drafts/contributing.mdx +0 -174
- package/docs/v7/_drafts/core.mdx +0 -458
- package/docs/v7/_drafts/dashcam-title-feature.mdx +0 -89
- package/docs/v7/_drafts/debugging.mdx +0 -349
- package/docs/v7/_drafts/error-handling.mdx +0 -501
- package/docs/v7/_drafts/faq.mdx +0 -393
- package/docs/v7/_drafts/hooks.mdx +0 -360
- package/docs/v7/_drafts/init-command.mdx +0 -95
- package/docs/v7/_drafts/installation.mdx +0 -420
- package/docs/v7/_drafts/migration.mdx +0 -562
- package/docs/v7/_drafts/observable.mdx +0 -604
- package/docs/v7/_drafts/playwright.mdx +0 -342
- package/docs/v7/_drafts/plugin-migration.mdx +0 -220
- package/docs/v7/_drafts/powerful.mdx +0 -419
- package/docs/v7/_drafts/presets.mdx +0 -210
- package/docs/v7/_drafts/progressive-disclosure.mdx +0 -230
- package/docs/v7/_drafts/prompt-cache.mdx +0 -200
- package/docs/v7/_drafts/provision.mdx +0 -390
- package/docs/v7/_drafts/quick-start-test-recording.mdx +0 -214
- package/docs/v7/_drafts/readme.mdx +0 -135
- package/docs/v7/_drafts/reports.mdx +0 -414
- package/docs/v7/_drafts/scalable.mdx +0 -754
- package/docs/v7/_drafts/screenshot.mdx +0 -155
- package/docs/v7/_drafts/sdk-awesome-logs.mdx +0 -468
- package/docs/v7/_drafts/sdk-browser-rendering.mdx +0 -167
- package/docs/v7/_drafts/sdk-migration.mdx +0 -474
- package/docs/v7/_drafts/sdk-v7-complete.mdx +0 -345
- package/docs/v7/_drafts/self-hosting.mdx +0 -369
- package/docs/v7/_drafts/test-recording.mdx +0 -382
- package/docs/v7/_drafts/troubleshooting.mdx +0 -526
- package/docs/v7/_drafts/vitest-plugin.mdx +0 -477
- package/docs/v7/_drafts/vitest.mdx +0 -535
- package/docs/v7/_drafts/writing-tests.mdx +0 -25
- package/docs/v7/examples.mdx +0 -5
- package/eslint.config.js +0 -67
- package/examples/ai.test.mjs +0 -30
- package/examples/assert.test.mjs +0 -46
- package/examples/captcha-api.test.mjs +0 -50
- package/examples/chrome-extension.test.mjs +0 -94
- package/examples/drag-and-drop.test.mjs +0 -58
- package/examples/element-not-found.test.mjs +0 -26
- package/examples/exec-output.test.mjs +0 -59
- package/examples/exec-pwsh.test.mjs +0 -57
- package/examples/focus-window.test.mjs +0 -36
- package/examples/formatted-logging.test.mjs +0 -26
- package/examples/hover-image.test.mjs +0 -52
- package/examples/hover-text-with-description.test.mjs +0 -56
- package/examples/hover-text.test.mjs +0 -27
- package/examples/installer.test.mjs +0 -49
- package/examples/launch-vscode-linux.test.mjs +0 -54
- package/examples/match-image.test.mjs +0 -54
- package/examples/no-provision.test.mjs +0 -23
- package/examples/press-keys.test.mjs +0 -50
- package/examples/prompt.test.mjs +0 -33
- package/examples/scroll-keyboard.test.mjs +0 -37
- package/examples/scroll-until-image.test.mjs +0 -39
- package/examples/scroll-until-text.test.mjs +0 -67
- package/examples/scroll.test.mjs +0 -41
- package/examples/type.test.mjs +0 -45
- package/examples/windows-installer.test.mjs +0 -53
- package/interfaces/cli/commands/edit.js +0 -3
- package/interfaces/cli/commands/generate.js +0 -3
- package/interfaces/cli/commands/run.js +0 -3
- package/interfaces/cli/utils/factory.js +0 -71
- package/jsconfig.json +0 -26
- package/manual/test-init-command.js +0 -223
- package/sdk-log-formatter.js +0 -930
- package/setup/aws/cloudformation.yaml +0 -470
- package/setup/aws/spawn-runner.sh +0 -190
- package/test/api-resilience.test.mjs +0 -0
- package/test/captcha-solver.test.mjs +0 -70
- package/test/chrome-remote-debugging.test.mjs +0 -66
- package/test/manual/debug-locate-response.js +0 -82
- package/test/manual/reconnect-provision.test.mjs +0 -49
- package/test/manual/test-console-logs.test.mjs +0 -42
- package/test/manual/test-find-api.js +0 -73
- package/test/manual/test-init.sh +0 -54
- package/test/manual/test-prompt-cache.js +0 -96
- package/test/manual/test-provision-auth.mjs +0 -22
- package/test/manual/test-sandbox-render.js +0 -28
- package/test/manual/test-sdk-methods.js +0 -15
- package/test/manual/test-sdk-refactor.js +0 -53
- package/test/manual/test-stack-trace.mjs +0 -57
- package/test/manual/verify-element-api.js +0 -89
- package/test/manual/verify-types.js +0 -0
- package/test/manual-unawaited-promise.test.mjs +0 -31
- package/testdriver-plugin/skills/actions/SKILL.md +0 -93
- package/testdriver-plugin/skills/assertions/SKILL.md +0 -77
- package/testdriver-plugin/skills/caching/SKILL.md +0 -66
- package/testdriver-plugin/skills/creating-tests/SKILL.md +0 -104
- package/testdriver-plugin/skills/finding-elements/SKILL.md +0 -77
- package/testdriver-plugin/skills/github-actions/SKILL.md +0 -100
- package/testdriver-plugin/skills/running-tests/SKILL.md +0 -77
- package/testdriver-plugin/skills/secrets/SKILL.md +0 -87
- package/testdriver-plugin/skills/self-hosting/SKILL.md +0 -89
- package/testdriver-plugin/skills/setup/SKILL.md +0 -76
- package/testdriver-plugin/skills/variables/SKILL.md +0 -88
- package/testdriver-plugin/skills/waiting/SKILL.md +0 -72
- package/vitest.config.mjs +0 -29
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for the captcha solver script
|
|
3
|
-
* These tests verify the solver script is valid JavaScript and can be loaded correctly
|
|
4
|
-
*/
|
|
5
|
-
import { describe, expect, it } from "vitest";
|
|
6
|
-
import fs from "fs";
|
|
7
|
-
import path from "path";
|
|
8
|
-
import { fileURLToPath } from "url";
|
|
9
|
-
import vm from "vm";
|
|
10
|
-
|
|
11
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
const solverPath = path.join(__dirname, "..", "lib", "captcha", "solver.js");
|
|
13
|
-
|
|
14
|
-
describe("Captcha Solver Script", () => {
|
|
15
|
-
it("should exist", () => {
|
|
16
|
-
expect(fs.existsSync(solverPath)).toBe(true);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("should be valid JavaScript syntax", () => {
|
|
20
|
-
const script = fs.readFileSync(solverPath, "utf8");
|
|
21
|
-
|
|
22
|
-
// This will throw if the syntax is invalid
|
|
23
|
-
expect(() => {
|
|
24
|
-
new vm.Script(script, { filename: "solver.js" });
|
|
25
|
-
}).not.toThrow();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("should contain required functions and variables", () => {
|
|
29
|
-
const script = fs.readFileSync(solverPath, "utf8");
|
|
30
|
-
|
|
31
|
-
// Check for key components
|
|
32
|
-
expect(script).toContain('require("https")');
|
|
33
|
-
expect(script).toContain('require("chrome-remote-interface")');
|
|
34
|
-
expect(script).toContain("detectCaptchaScript");
|
|
35
|
-
expect(script).toContain("getInjectScript");
|
|
36
|
-
expect(script).toContain("autoSubmitScript");
|
|
37
|
-
expect(script).toContain("checkSuccessScript");
|
|
38
|
-
expect(script).toContain("2captcha.com");
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("should handle all supported captcha types", () => {
|
|
42
|
-
const script = fs.readFileSync(solverPath, "utf8");
|
|
43
|
-
|
|
44
|
-
// Check for captcha type handling
|
|
45
|
-
expect(script).toContain("recaptcha_v2");
|
|
46
|
-
expect(script).toContain("recaptcha_v3");
|
|
47
|
-
expect(script).toContain("hcaptcha");
|
|
48
|
-
expect(script).toContain("turnstile");
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("should have proper auto-detection for captcha elements", () => {
|
|
52
|
-
const script = fs.readFileSync(solverPath, "utf8");
|
|
53
|
-
|
|
54
|
-
// Check for DOM selectors used in auto-detection
|
|
55
|
-
expect(script).toContain(".g-recaptcha[data-sitekey]");
|
|
56
|
-
expect(script).toContain(".h-captcha[data-sitekey]");
|
|
57
|
-
expect(script).toContain(".cf-turnstile[data-sitekey]");
|
|
58
|
-
expect(script).toContain("[data-sitekey]");
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it("should properly inject tokens into response fields", () => {
|
|
62
|
-
const script = fs.readFileSync(solverPath, "utf8");
|
|
63
|
-
|
|
64
|
-
// Check for token injection selectors
|
|
65
|
-
expect(script).toContain("[name=g-recaptcha-response]");
|
|
66
|
-
expect(script).toContain("[name=h-captcha-response]");
|
|
67
|
-
expect(script).toContain("[name=cf-turnstile-response]");
|
|
68
|
-
expect(script).toContain("___grecaptcha_cfg");
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test that validates Chrome remote debugging is working
|
|
3
|
-
* Installs chrome-remote-interface and connects to the active tab
|
|
4
|
-
*/
|
|
5
|
-
import { describe, expect, it } from "vitest";
|
|
6
|
-
import { TestDriver } from "../lib/vitest/hooks.mjs";
|
|
7
|
-
|
|
8
|
-
describe("Chrome Remote Debugging", () => {
|
|
9
|
-
|
|
10
|
-
it("should connect to Chrome via CDP and get page title", async (context) => {
|
|
11
|
-
const testdriver = TestDriver(context);
|
|
12
|
-
|
|
13
|
-
// Launch Chrome with a known URL
|
|
14
|
-
await testdriver.provision.chrome({
|
|
15
|
-
url: 'https://example.com',
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// Take a screenshot to verify Chrome launched
|
|
19
|
-
await testdriver.screenshot();
|
|
20
|
-
|
|
21
|
-
// Install chrome-remote-interface (needs sudo for global install)
|
|
22
|
-
const installResult = await testdriver.exec(
|
|
23
|
-
'sh',
|
|
24
|
-
'sudo npm install -g chrome-remote-interface',
|
|
25
|
-
60000
|
|
26
|
-
);
|
|
27
|
-
console.log('Install result:', installResult);
|
|
28
|
-
|
|
29
|
-
// Write the CDP script to a file to avoid quoting issues
|
|
30
|
-
const cdpScript = `
|
|
31
|
-
const CDP = require('chrome-remote-interface');
|
|
32
|
-
(async () => {
|
|
33
|
-
try {
|
|
34
|
-
const client = await CDP();
|
|
35
|
-
const { Runtime } = client;
|
|
36
|
-
const result = await Runtime.evaluate({
|
|
37
|
-
expression: 'document.title'
|
|
38
|
-
});
|
|
39
|
-
console.log('PAGE_TITLE:' + result.result.value);
|
|
40
|
-
await client.close();
|
|
41
|
-
process.exit(0);
|
|
42
|
-
} catch (err) {
|
|
43
|
-
console.error('CDP_ERROR:' + err.message);
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
})();
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
// Write script to file
|
|
50
|
-
await testdriver.exec('sh', `cat > /tmp/cdp-test.js << 'SCRIPT'
|
|
51
|
-
${cdpScript}
|
|
52
|
-
SCRIPT`, 5000);
|
|
53
|
-
|
|
54
|
-
// Run the CDP script with NODE_PATH set to find globally installed modules
|
|
55
|
-
const cdpResult = await testdriver.exec(
|
|
56
|
-
'sh',
|
|
57
|
-
'NODE_PATH=/usr/lib/node_modules node /tmp/cdp-test.js 2>&1 || echo "CDP_EXIT_CODE:$?"',
|
|
58
|
-
30000
|
|
59
|
-
);
|
|
60
|
-
console.log('CDP result:', cdpResult);
|
|
61
|
-
|
|
62
|
-
// Verify we got the page title
|
|
63
|
-
expect(cdpResult).toContain('PAGE_TITLE:');
|
|
64
|
-
expect(cdpResult).toContain('Example Domain');
|
|
65
|
-
});
|
|
66
|
-
});
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Debug script to inspect the full locate API response
|
|
5
|
-
* Run this with: TD_API_KEY=your_key node debug-locate-response.js
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const TestDriverSDK = require("./sdk.js");
|
|
9
|
-
|
|
10
|
-
async function debugLocateResponse() {
|
|
11
|
-
const client = new TestDriverSDK(process.env.TD_API_KEY);
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
console.log("Connecting to sandbox (Linux)...");
|
|
15
|
-
await client.connect({ headless: true });
|
|
16
|
-
|
|
17
|
-
console.log("Opening a test page...");
|
|
18
|
-
await client.focusApplication("Google Chrome");
|
|
19
|
-
await client.type("https://example.com");
|
|
20
|
-
await client.pressKeys(["enter"]);
|
|
21
|
-
|
|
22
|
-
// Wait for page to load
|
|
23
|
-
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
24
|
-
|
|
25
|
-
console.log("\nFinding an element to inspect the response...");
|
|
26
|
-
const element = await client.find("the heading that says Example Domain");
|
|
27
|
-
|
|
28
|
-
console.log("\n=".repeat(60));
|
|
29
|
-
console.log("FULL LOCATE API RESPONSE:");
|
|
30
|
-
console.log("=".repeat(60));
|
|
31
|
-
|
|
32
|
-
const response = element.getResponse();
|
|
33
|
-
console.log(JSON.stringify(response, null, 2));
|
|
34
|
-
|
|
35
|
-
console.log("\n=".repeat(60));
|
|
36
|
-
console.log("RESPONSE KEYS:");
|
|
37
|
-
console.log("=".repeat(60));
|
|
38
|
-
|
|
39
|
-
if (response) {
|
|
40
|
-
Object.keys(response).forEach((key) => {
|
|
41
|
-
const value = response[key];
|
|
42
|
-
const type = Array.isArray(value) ? "array" : typeof value;
|
|
43
|
-
const preview =
|
|
44
|
-
typeof value === "string" && value.length > 100
|
|
45
|
-
? `${value.substring(0, 100)}... (${value.length} chars)`
|
|
46
|
-
: typeof value === "object"
|
|
47
|
-
? JSON.stringify(value)
|
|
48
|
-
: value;
|
|
49
|
-
|
|
50
|
-
console.log(` ${key} (${type}): ${preview}`);
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
console.log("\n=".repeat(60));
|
|
55
|
-
console.log("ELEMENT PROPERTIES:");
|
|
56
|
-
console.log("=".repeat(60));
|
|
57
|
-
console.log(" found:", element.found());
|
|
58
|
-
console.log(" x:", element.x);
|
|
59
|
-
console.log(" y:", element.y);
|
|
60
|
-
console.log(" centerX:", element.centerX);
|
|
61
|
-
console.log(" centerY:", element.centerY);
|
|
62
|
-
console.log(" width:", element.width);
|
|
63
|
-
console.log(" height:", element.height);
|
|
64
|
-
console.log(" confidence:", element.confidence);
|
|
65
|
-
console.log(" text:", element.text);
|
|
66
|
-
console.log(" label:", element.label);
|
|
67
|
-
console.log(
|
|
68
|
-
" screenshot:",
|
|
69
|
-
element.screenshot ? `${element.screenshot.length} chars` : null,
|
|
70
|
-
);
|
|
71
|
-
console.log(" boundingBox:", element.boundingBox);
|
|
72
|
-
|
|
73
|
-
await client.disconnect();
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error("Error:", error.message);
|
|
76
|
-
console.error(error.stack);
|
|
77
|
-
await client.disconnect();
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
debugLocateResponse();
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TestDriver SDK - Reconnect Test Part 1: Provision
|
|
3
|
-
*
|
|
4
|
-
* This test provisions a new sandbox and navigates to the login page.
|
|
5
|
-
* The sandbox ID is saved to .testdriver/last-sandbox for the next test.
|
|
6
|
-
*
|
|
7
|
-
* The sandbox has keepAlive: 120000 (2 minutes) after disconnect.
|
|
8
|
-
* Run reconnect-signin.test.mjs within 2 minutes of this test completing.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* 1. npm test -- examples/reconnect-provision.test.mjs
|
|
12
|
-
* 2. (within 2 minutes) examples/reconnect-signin.test.mjs
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { afterAll, describe, expect, it } from "vitest";
|
|
16
|
-
import { TestDriver } from "../../lib/vitest/hooks.mjs";
|
|
17
|
-
|
|
18
|
-
describe("Reconnect Test - Part 1: Provision", () => {
|
|
19
|
-
|
|
20
|
-
afterAll(async () => {
|
|
21
|
-
// Explicitly DO NOT disconnect - we want the sandbox to stay alive
|
|
22
|
-
// for the reconnect test. The sandbox will auto-terminate after keepAlive TTL.
|
|
23
|
-
console.log("\n⚠️ NOT disconnecting - sandbox will stay alive for ~2 minutes (keepAlive: 120000)");
|
|
24
|
-
console.log(" Run reconnect-signin.test.mjs within 2 minutes to test reconnect\n");
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it("should provision sandbox and navigate to login page", async (context) => {
|
|
28
|
-
|
|
29
|
-
const testdriver = TestDriver(context, { newSandbox: true, headless: false });
|
|
30
|
-
|
|
31
|
-
// Provision Chrome and navigate to login page
|
|
32
|
-
await testdriver.provision.chrome({
|
|
33
|
-
url: 'http://testdriver-sandbox.vercel.app/login',
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
// Verify we're on the login page
|
|
38
|
-
const result = await testdriver.assert("I can see a Sign In button");
|
|
39
|
-
expect(result).toBeTruthy();
|
|
40
|
-
|
|
41
|
-
// Get the sandbox ID that was saved
|
|
42
|
-
const lastSandbox = testdriver.getLastSandboxId();
|
|
43
|
-
console.log("\n✅ Sandbox provisioned:", lastSandbox?.sandboxId);
|
|
44
|
-
console.log(" Sandbox info saved to .testdriver/last-sandbox");
|
|
45
|
-
|
|
46
|
-
expect(lastSandbox).toBeTruthy();
|
|
47
|
-
expect(lastSandbox.sandboxId).toBeTruthy();
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TestDriver SDK - Console Log Test
|
|
3
|
-
* Tests that console.log statements are captured and sent to dashcam
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, expect, it } from "vitest";
|
|
7
|
-
import { TestDriver } from "../../lib/vitest/hooks.mjs";
|
|
8
|
-
|
|
9
|
-
describe("Console Log Test", () => {
|
|
10
|
-
it("should capture console logs and send them to dashcam", async (context) => {
|
|
11
|
-
console.log("🎬 Test starting - this should appear in dashcam");
|
|
12
|
-
|
|
13
|
-
const testdriver = TestDriver(context, { headless: true });
|
|
14
|
-
await testdriver.provision.chrome({ url: 'http://testdriver-sandbox.vercel.app/login' });
|
|
15
|
-
|
|
16
|
-
console.log("✅ Chrome launched successfully");
|
|
17
|
-
|
|
18
|
-
// Give Chrome a moment to fully render the UI
|
|
19
|
-
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
20
|
-
|
|
21
|
-
console.log("🔍 Looking for Sign In button");
|
|
22
|
-
|
|
23
|
-
// Find and click the sign in button
|
|
24
|
-
const signInButton = await testdriver.find(
|
|
25
|
-
"Sign In, black button below the password field",
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
console.log("👆 Clicking Sign In button");
|
|
29
|
-
await signInButton.click();
|
|
30
|
-
|
|
31
|
-
console.log("🧪 Asserting error message appears");
|
|
32
|
-
|
|
33
|
-
// Assert error shows
|
|
34
|
-
const result = await testdriver.assert(
|
|
35
|
-
"an error shows that fields are required",
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
console.log("✅ Test completed successfully - all logs should be in dashcam");
|
|
39
|
-
|
|
40
|
-
expect(result).toBeTruthy();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Quick test of the new find() API
|
|
5
|
-
* This is a simple smoke test to verify the Element class works
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const TestDriver = require("../sdk");
|
|
9
|
-
|
|
10
|
-
async function testFindAPI() {
|
|
11
|
-
console.log("Testing new find() API...\n");
|
|
12
|
-
|
|
13
|
-
const client = new TestDriver("test-key", {
|
|
14
|
-
logging: false,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// Test 1: Create element without connecting
|
|
18
|
-
console.log("✓ Test 1: Creating Element instance");
|
|
19
|
-
const element = client.find("test element");
|
|
20
|
-
console.log(" Element description:", element.description);
|
|
21
|
-
console.log(" Element found():", element.found());
|
|
22
|
-
console.log(" Element coordinates:", element.getCoordinates());
|
|
23
|
-
|
|
24
|
-
// Test 2: Verify element methods exist
|
|
25
|
-
console.log("\n✓ Test 2: Verifying Element methods");
|
|
26
|
-
console.log(" Has find():", typeof element.find === "function");
|
|
27
|
-
console.log(" Has click():", typeof element.click === "function");
|
|
28
|
-
console.log(" Has hover():", typeof element.hover === "function");
|
|
29
|
-
console.log(
|
|
30
|
-
" Has doubleClick():",
|
|
31
|
-
typeof element.doubleClick === "function",
|
|
32
|
-
);
|
|
33
|
-
console.log(" Has rightClick():", typeof element.rightClick === "function");
|
|
34
|
-
console.log(" Has mouseDown():", typeof element.mouseDown === "function");
|
|
35
|
-
console.log(" Has mouseUp():", typeof element.mouseUp === "function");
|
|
36
|
-
console.log(" Has found():", typeof element.found === "function");
|
|
37
|
-
console.log(
|
|
38
|
-
" Has getCoordinates():",
|
|
39
|
-
typeof element.getCoordinates === "function",
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
// Test 3: Verify error handling for clicking unfound element
|
|
43
|
-
console.log("\n✓ Test 3: Error handling for unfound element");
|
|
44
|
-
try {
|
|
45
|
-
await element.click();
|
|
46
|
-
console.log(" ❌ Should have thrown error");
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.log(" ✓ Correctly throws error:", error.message);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Test 4: Verify TypeScript types exist (if running from TypeScript)
|
|
52
|
-
console.log("\n✓ Test 4: SDK methods");
|
|
53
|
-
console.log(" Has find():", typeof client.find === "function");
|
|
54
|
-
console.log(
|
|
55
|
-
" Has deprecated hoverText():",
|
|
56
|
-
typeof client.hoverText === "undefined" ? "not yet connected" : "exists",
|
|
57
|
-
);
|
|
58
|
-
console.log(
|
|
59
|
-
" Has deprecated waitForText():",
|
|
60
|
-
typeof client.waitForText === "undefined" ? "not yet connected" : "exists",
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
console.log("\n✅ All basic tests passed!");
|
|
64
|
-
console.log(
|
|
65
|
-
"\nNote: Full integration tests require connection to TestDriver sandbox.",
|
|
66
|
-
);
|
|
67
|
-
console.log("See examples/sdk-find-example.js for complete usage examples.");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
testFindAPI().catch((error) => {
|
|
71
|
-
console.error("Test failed:", error);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
});
|
package/test/manual/test-init.sh
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Test script for the init command
|
|
4
|
-
# Usage: ./test-init.sh
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
echo "🧪 Testing testdriverai init command..."
|
|
9
|
-
echo ""
|
|
10
|
-
|
|
11
|
-
# Cleanup function
|
|
12
|
-
cleanup() {
|
|
13
|
-
echo "🧹 Cleaning up test directories..."
|
|
14
|
-
rm -rf /tmp/testdriver-test-*
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
trap cleanup EXIT
|
|
18
|
-
|
|
19
|
-
# Test 1: Full init with all features
|
|
20
|
-
echo "1️⃣ Testing full initialization (package.json, tests, workflow, npm install)..."
|
|
21
|
-
cd /tmp
|
|
22
|
-
mkdir -p testdriver-test-init
|
|
23
|
-
cd testdriver-test-init
|
|
24
|
-
node /Users/ianjennings/Development/cli/bin/testdriverai.js init
|
|
25
|
-
echo ""
|
|
26
|
-
echo "✅ Files created:"
|
|
27
|
-
find . -type f -not -path "./node_modules/*" | sort
|
|
28
|
-
echo ""
|
|
29
|
-
echo "📄 package.json:"
|
|
30
|
-
cat package.json
|
|
31
|
-
echo ""
|
|
32
|
-
echo "📄 vitest.config.js:"
|
|
33
|
-
cat vitest.config.js
|
|
34
|
-
echo ""
|
|
35
|
-
echo "📄 GitHub workflow:"
|
|
36
|
-
cat .github/workflows/testdriver.yml
|
|
37
|
-
echo ""
|
|
38
|
-
echo "📄 First 15 lines of tests/example.test.js:"
|
|
39
|
-
head -15 tests/example.test.js
|
|
40
|
-
echo ""
|
|
41
|
-
echo "📦 Installed dependencies:"
|
|
42
|
-
npm list --depth=0
|
|
43
|
-
echo ""
|
|
44
|
-
echo "---"
|
|
45
|
-
echo ""
|
|
46
|
-
|
|
47
|
-
# Test 2: Help command
|
|
48
|
-
echo "2️⃣ Testing help command..."
|
|
49
|
-
node /Users/ianjennings/Development/cli/bin/testdriverai.js init --help
|
|
50
|
-
echo ""
|
|
51
|
-
echo "---"
|
|
52
|
-
echo ""
|
|
53
|
-
|
|
54
|
-
echo "✅ All tests passed!"
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Simple test to verify prompt caching functionality
|
|
5
|
-
*
|
|
6
|
-
* This test demonstrates that:
|
|
7
|
-
* 1. First .prompt() call makes an API request and caches the YAML response
|
|
8
|
-
* 2. Second .prompt() call with the same prompt uses the cached YAML
|
|
9
|
-
* 3. Cache can be disabled with TD_NO_PROMPT_CACHE=true
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const TestDriver = require("./sdk.js");
|
|
13
|
-
const promptCache = require("./agent/lib/cache.js");
|
|
14
|
-
|
|
15
|
-
async function testPromptCache() {
|
|
16
|
-
console.log("Testing prompt caching functionality...\n");
|
|
17
|
-
|
|
18
|
-
const client = new TestDriver(process.env.TD_API_KEY, {
|
|
19
|
-
os: "linux",
|
|
20
|
-
logging: true,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
// Connect to sandbox
|
|
25
|
-
console.log("Connecting to sandbox...");
|
|
26
|
-
await client.connect();
|
|
27
|
-
console.log("Connected!\n");
|
|
28
|
-
|
|
29
|
-
const testPrompt = "click the search button";
|
|
30
|
-
|
|
31
|
-
// Clear cache for this prompt to start fresh
|
|
32
|
-
const cachePath = promptCache.getCachePath(testPrompt);
|
|
33
|
-
console.log(`Cache path for "${testPrompt}": ${cachePath}\n`);
|
|
34
|
-
|
|
35
|
-
// Test 1: First call (should make API request and cache)
|
|
36
|
-
console.log("Test 1: First .ai() call (should cache the response)");
|
|
37
|
-
const stats1 = promptCache.getCacheStats();
|
|
38
|
-
console.log(`Cache before: ${stats1.count} files`);
|
|
39
|
-
|
|
40
|
-
await client.ai(testPrompt);
|
|
41
|
-
|
|
42
|
-
const stats2 = promptCache.getCacheStats();
|
|
43
|
-
console.log(`Cache after: ${stats2.count} files`);
|
|
44
|
-
console.log(
|
|
45
|
-
`Cache hit: ${promptCache.hasCache(testPrompt) ? "YES" : "NO"}\n`,
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
// Test 2: Second call (should use cache)
|
|
49
|
-
console.log(
|
|
50
|
-
"Test 2: Second .ai() call with same prompt (should use cache)",
|
|
51
|
-
);
|
|
52
|
-
console.log('Look for "(using cached response)" message above...\n');
|
|
53
|
-
await client.ai(testPrompt);
|
|
54
|
-
|
|
55
|
-
// Test 3: Third call with cache disabled (should make API call)
|
|
56
|
-
console.log(
|
|
57
|
-
"\nTest 3: Third .ai() call with cache=false (should bypass cache)",
|
|
58
|
-
);
|
|
59
|
-
await client.ai(testPrompt, false);
|
|
60
|
-
|
|
61
|
-
// Test 4: Show cache contents
|
|
62
|
-
console.log("\nTest 4: Cache contents");
|
|
63
|
-
const cachedYaml = promptCache.readCache(testPrompt);
|
|
64
|
-
if (cachedYaml) {
|
|
65
|
-
console.log("Cached YAML preview (first 500 chars):");
|
|
66
|
-
console.log(cachedYaml.substring(0, 500));
|
|
67
|
-
console.log("...\n");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Test 5: Cache statistics
|
|
71
|
-
console.log("Test 5: Cache statistics");
|
|
72
|
-
const finalStats = promptCache.getCacheStats();
|
|
73
|
-
console.log(`Total cached prompts: ${finalStats.count}`);
|
|
74
|
-
console.log(`Cache files:`, finalStats.files.slice(0, 5));
|
|
75
|
-
|
|
76
|
-
console.log("\n✅ Prompt caching test completed!");
|
|
77
|
-
console.log("\nTo disable caching, pass false: client.ai(prompt, false)");
|
|
78
|
-
console.log("To clear cache, delete .testdriver/.cache/*.yaml files");
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error("❌ Test failed:", error.message);
|
|
81
|
-
throw error;
|
|
82
|
-
} finally {
|
|
83
|
-
// Disconnect
|
|
84
|
-
await client.disconnect();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Run the test
|
|
89
|
-
if (require.main === module) {
|
|
90
|
-
testPromptCache().catch((error) => {
|
|
91
|
-
console.error("Test error:", error);
|
|
92
|
-
process.exit(1);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
module.exports = testPromptCache;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Quick test to verify provision() authentication works
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { test } from 'vitest';
|
|
6
|
-
import { provision } from '../../lib/presets/index.mjs';
|
|
7
|
-
|
|
8
|
-
test('provision auth test', async (context) => {
|
|
9
|
-
console.log('Starting provision...');
|
|
10
|
-
|
|
11
|
-
const { testdriver, dashcam } = await provision('chrome', {
|
|
12
|
-
url: 'http://testdriver-sandbox.vercel.app/',
|
|
13
|
-
}, context);
|
|
14
|
-
|
|
15
|
-
console.log('✅ Provision complete!');
|
|
16
|
-
console.log('TestDriver:', testdriver);
|
|
17
|
-
console.log('Dashcam:', dashcam);
|
|
18
|
-
|
|
19
|
-
// Try a simple find
|
|
20
|
-
const result = await testdriver.find('any element');
|
|
21
|
-
console.log('Find result:', result);
|
|
22
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const TestDriver = require("./sdk.js");
|
|
2
|
-
|
|
3
|
-
async function test() {
|
|
4
|
-
console.log("Testing sandbox rendering...");
|
|
5
|
-
|
|
6
|
-
const client = new TestDriver(process.env.TD_API_KEY, {
|
|
7
|
-
os: process.env.TEST_PLATFORM || "linux",
|
|
8
|
-
headless: false, // Should open browser
|
|
9
|
-
logging: true,
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
console.log("Connecting to sandbox...");
|
|
14
|
-
const instance = await client.connect();
|
|
15
|
-
console.log("Connected to instance:", instance);
|
|
16
|
-
|
|
17
|
-
// Wait a bit to see if browser opens
|
|
18
|
-
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
19
|
-
|
|
20
|
-
await client.disconnect();
|
|
21
|
-
console.log("Test completed successfully");
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.error("Test failed:", error);
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
test();
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const SDK = require("./sdk.js");
|
|
2
|
-
|
|
3
|
-
const client = new SDK("test-key");
|
|
4
|
-
|
|
5
|
-
// Get all public methods (non-private, non-constructor)
|
|
6
|
-
const methods = Object.getOwnPropertyNames(Object.getPrototypeOf(client))
|
|
7
|
-
.filter((m) => !m.startsWith("_") && m !== "constructor")
|
|
8
|
-
.sort();
|
|
9
|
-
|
|
10
|
-
console.log("Public SDK Methods:");
|
|
11
|
-
console.log(methods.join(", "));
|
|
12
|
-
console.log("\nTotal:", methods.length, "methods");
|
|
13
|
-
|
|
14
|
-
// Check if commands will be set up after connect
|
|
15
|
-
console.log("\nCommands before connect:", client.commands);
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Quick test to verify SDK refactoring works correctly
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const TestDriver = require("./sdk.js");
|
|
8
|
-
|
|
9
|
-
async function test() {
|
|
10
|
-
console.log("Testing SDK refactor...\n");
|
|
11
|
-
|
|
12
|
-
// Test 1: SDK construction
|
|
13
|
-
console.log("✓ Test 1: Creating SDK instance");
|
|
14
|
-
const client = new TestDriver(process.env.TD_API_KEY || "test-key", {
|
|
15
|
-
logging: false,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
console.log(" - agent exists:", !!client.agent);
|
|
19
|
-
console.log(" - emitter exists:", !!client.emitter);
|
|
20
|
-
console.log(" - config exists:", !!client.config);
|
|
21
|
-
console.log(" - session exists:", !!client.session);
|
|
22
|
-
console.log(" - apiClient exists:", !!client.apiClient);
|
|
23
|
-
console.log(" - analytics exists:", !!client.analytics);
|
|
24
|
-
console.log(" - sandbox exists:", !!client.sandbox);
|
|
25
|
-
console.log(" - system exists:", !!client.system);
|
|
26
|
-
|
|
27
|
-
// Test 2: Check agent methods are accessible
|
|
28
|
-
console.log("\n✓ Test 2: Checking agent methods");
|
|
29
|
-
console.log(
|
|
30
|
-
" - agent.exploratoryLoop exists:",
|
|
31
|
-
typeof client.agent.exploratoryLoop,
|
|
32
|
-
);
|
|
33
|
-
console.log(" - agent.buildEnv exists:", typeof client.agent.buildEnv);
|
|
34
|
-
console.log(
|
|
35
|
-
" - agent.getRecentSandboxId exists:",
|
|
36
|
-
typeof client.agent.getRecentSandboxId,
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
// Test 3: Check SDK methods
|
|
40
|
-
console.log("\n✓ Test 3: Checking SDK methods");
|
|
41
|
-
console.log(" - ai() exists:", typeof client.ai);
|
|
42
|
-
console.log(" - auth() exists:", typeof client.auth);
|
|
43
|
-
console.log(" - connect() exists:", typeof client.connect);
|
|
44
|
-
console.log(" - disconnect() exists:", typeof client.disconnect);
|
|
45
|
-
|
|
46
|
-
console.log("\n✅ All basic tests passed!");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
test().catch((error) => {
|
|
50
|
-
console.error("\n❌ Test failed:", error.message);
|
|
51
|
-
console.error(error.stack);
|
|
52
|
-
process.exit(1);
|
|
53
|
-
});
|