testdriverai 7.3.11 → 7.3.13

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.
Files changed (133) hide show
  1. package/.github/skills/testdriver:ai/SKILL.md +204 -0
  2. package/.github/skills/testdriver:assert/SKILL.md +284 -0
  3. package/.github/skills/testdriver:aws-setup/SKILL.md +515 -0
  4. package/.github/skills/testdriver:caching/SKILL.md +124 -0
  5. package/.github/skills/testdriver:captcha/SKILL.md +159 -0
  6. package/.github/skills/testdriver:ci-cd/SKILL.md +602 -0
  7. package/.github/skills/testdriver:click/SKILL.md +286 -0
  8. package/.github/skills/testdriver:client/SKILL.md +339 -0
  9. package/.github/skills/testdriver:cloud/SKILL.md +119 -0
  10. package/.github/skills/testdriver:customizing-devices/SKILL.md +153 -0
  11. package/.github/skills/testdriver:dashcam/SKILL.md +418 -0
  12. package/.github/skills/testdriver:debugging-with-screenshots/SKILL.md +271 -0
  13. package/.github/skills/testdriver:device-config/SKILL.md +317 -0
  14. package/.github/skills/testdriver:double-click/SKILL.md +102 -0
  15. package/.github/skills/testdriver:elements/SKILL.md +605 -0
  16. package/.github/skills/testdriver:enterprise/SKILL.md +114 -0
  17. package/.github/skills/testdriver:examples/SKILL.md +7 -0
  18. package/.github/skills/testdriver:exec/SKILL.md +345 -0
  19. package/.github/skills/testdriver:find/SKILL.md +721 -0
  20. package/.github/skills/testdriver:focus-application/SKILL.md +293 -0
  21. package/.github/skills/testdriver:generating-tests/SKILL.md +36 -0
  22. package/.github/skills/testdriver:hover/SKILL.md +278 -0
  23. package/.github/skills/testdriver:locating-elements/SKILL.md +71 -0
  24. package/.github/skills/testdriver:making-assertions/SKILL.md +32 -0
  25. package/.github/skills/testdriver:mcp-workflow/SKILL.md +410 -0
  26. package/.github/skills/testdriver:mouse-down/SKILL.md +161 -0
  27. package/.github/skills/testdriver:mouse-up/SKILL.md +164 -0
  28. package/.github/skills/testdriver:performing-actions/SKILL.md +51 -0
  29. package/.github/skills/testdriver:press-keys/SKILL.md +348 -0
  30. package/.github/skills/testdriver:quickstart/SKILL.md +161 -0
  31. package/.github/skills/testdriver:reusable-code/SKILL.md +240 -0
  32. package/.github/skills/testdriver:right-click/SKILL.md +123 -0
  33. package/.github/skills/testdriver:running-tests/SKILL.md +181 -0
  34. package/.github/skills/testdriver:screenshot/SKILL.md +167 -0
  35. package/.github/skills/testdriver:scroll/SKILL.md +299 -0
  36. package/.github/skills/testdriver:secrets/SKILL.md +115 -0
  37. package/.github/skills/testdriver:self-hosted/SKILL.md +65 -0
  38. package/.github/skills/testdriver:test-writer/SKILL.md +451 -0
  39. package/.github/skills/testdriver:testdriver/SKILL.md +523 -0
  40. package/.github/skills/testdriver:testdriver-mechanic/SKILL.md +165 -0
  41. package/.github/skills/testdriver:type/SKILL.md +357 -0
  42. package/.github/skills/testdriver:variables/SKILL.md +111 -0
  43. package/.github/skills/testdriver:waiting-for-elements/SKILL.md +66 -0
  44. package/.github/skills/testdriver:what-is-testdriver/SKILL.md +54 -0
  45. package/.github/workflows/acceptance-windows-scheduled.yaml +6 -1
  46. package/.github/workflows/acceptance.yaml +0 -36
  47. package/.github/workflows/update-examples.yaml +53 -0
  48. package/CHANGELOG.md +8 -0
  49. package/agent/events.js +1 -0
  50. package/agent/index.js +8 -0
  51. package/agent/lib/commands.js +48 -29
  52. package/agent/lib/redraw.js +3 -1
  53. package/agent/lib/sandbox.js +166 -14
  54. package/agent/lib/sdk.js +142 -3
  55. package/agent/lib/system.js +4 -6
  56. package/ai/skills/testdriver:ai/SKILL.md +204 -0
  57. package/ai/skills/testdriver:assert/SKILL.md +315 -0
  58. package/ai/skills/testdriver:aws-setup/SKILL.md +448 -0
  59. package/ai/skills/testdriver:caching/SKILL.md +124 -0
  60. package/ai/skills/testdriver:captcha/SKILL.md +159 -0
  61. package/ai/skills/testdriver:ci-cd/SKILL.md +602 -0
  62. package/ai/skills/testdriver:click/SKILL.md +286 -0
  63. package/ai/skills/testdriver:client/SKILL.md +372 -0
  64. package/ai/skills/testdriver:cloud/SKILL.md +119 -0
  65. package/ai/skills/testdriver:customizing-devices/SKILL.md +153 -0
  66. package/ai/skills/testdriver:dashcam/SKILL.md +418 -0
  67. package/ai/skills/testdriver:debugging-with-screenshots/SKILL.md +401 -0
  68. package/ai/skills/testdriver:device-config/SKILL.md +317 -0
  69. package/ai/skills/testdriver:double-click/SKILL.md +102 -0
  70. package/ai/skills/testdriver:elements/SKILL.md +605 -0
  71. package/ai/skills/testdriver:enterprise/SKILL.md +114 -0
  72. package/ai/skills/testdriver:examples/SKILL.md +7 -0
  73. package/ai/skills/testdriver:exec/SKILL.md +345 -0
  74. package/ai/skills/testdriver:find/SKILL.md +745 -0
  75. package/ai/skills/testdriver:focus-application/SKILL.md +293 -0
  76. package/ai/skills/testdriver:generating-tests/SKILL.md +36 -0
  77. package/ai/skills/testdriver:hover/SKILL.md +278 -0
  78. package/ai/skills/testdriver:locating-elements/SKILL.md +71 -0
  79. package/ai/skills/testdriver:making-assertions/SKILL.md +32 -0
  80. package/ai/skills/testdriver:mcp-workflow/SKILL.md +410 -0
  81. package/ai/skills/testdriver:mouse-down/SKILL.md +161 -0
  82. package/ai/skills/testdriver:mouse-up/SKILL.md +164 -0
  83. package/ai/skills/testdriver:ocr/SKILL.md +235 -0
  84. package/ai/skills/testdriver:performing-actions/SKILL.md +51 -0
  85. package/ai/skills/testdriver:press-keys/SKILL.md +348 -0
  86. package/ai/skills/testdriver:quickstart/SKILL.md +146 -0
  87. package/ai/skills/testdriver:reusable-code/SKILL.md +240 -0
  88. package/ai/skills/testdriver:right-click/SKILL.md +123 -0
  89. package/ai/skills/testdriver:running-tests/SKILL.md +185 -0
  90. package/ai/skills/testdriver:screenshot/SKILL.md +248 -0
  91. package/ai/skills/testdriver:scroll/SKILL.md +335 -0
  92. package/ai/skills/testdriver:secrets/SKILL.md +115 -0
  93. package/ai/skills/testdriver:self-hosted/SKILL.md +65 -0
  94. package/ai/skills/testdriver:test-writer/SKILL.md +451 -0
  95. package/ai/skills/testdriver:testdriver/SKILL.md +631 -0
  96. package/ai/skills/testdriver:testdriver-mechanic/SKILL.md +165 -0
  97. package/ai/skills/testdriver:type/SKILL.md +357 -0
  98. package/ai/skills/testdriver:variables/SKILL.md +111 -0
  99. package/ai/skills/testdriver:waiting-for-elements/SKILL.md +66 -0
  100. package/ai/skills/testdriver:what-is-testdriver/SKILL.md +54 -0
  101. package/debugger/index.html +12 -2
  102. package/docs/v7/examples/scroll-keyboard.mdx +1 -1
  103. package/docs/v7/find.mdx +1 -0
  104. package/examples/config.mjs +1 -1
  105. package/examples/findall-coffee-icons.test.mjs +42 -0
  106. package/examples/flake-diffthreshold-001.test.mjs +9 -0
  107. package/examples/flake-diffthreshold-01.test.mjs +9 -0
  108. package/examples/flake-diffthreshold-05.test.mjs +9 -0
  109. package/examples/{z_flake-noredraw-cache.test.mjs → flake-noredraw-cache.test.mjs} +2 -2
  110. package/examples/{z_flake-noredraw-nocache.test.mjs → flake-noredraw-nocache.test.mjs} +2 -2
  111. package/examples/{z_flake-redraw-cache.test.mjs → flake-redraw-cache.test.mjs} +2 -2
  112. package/examples/{z_flake-redraw-nocache.test.mjs → flake-redraw-nocache.test.mjs} +2 -2
  113. package/examples/flake-rocket-match.test.mjs +30 -0
  114. package/examples/{z_flake-shared.mjs → flake-shared.mjs} +2 -2
  115. package/examples/parse.test.mjs +19 -0
  116. package/examples/scroll-keyboard.test.mjs +1 -1
  117. package/interfaces/cli/lib/base.js +6 -0
  118. package/interfaces/logger.js +51 -13
  119. package/interfaces/vitest-plugin.mjs +137 -0
  120. package/lib/core/index.d.ts +22 -0
  121. package/lib/init-project.js +105 -6
  122. package/lib/vitest/hooks.mjs +2 -5
  123. package/lib/vitest/setup-disable-defender.mjs +52 -0
  124. package/package.json +2 -1
  125. package/sdk-log-formatter.js +90 -0
  126. package/sdk.d.ts +88 -51
  127. package/sdk.js +128 -21
  128. package/setup/aws/disable-defender.sh +42 -0
  129. package/vitest.config.mjs +1 -3
  130. package/examples/z_flake-diffthreshold-001.test.mjs +0 -9
  131. package/examples/z_flake-diffthreshold-01.test.mjs +0 -9
  132. package/examples/z_flake-diffthreshold-05.test.mjs +0 -9
  133. /package/{examples → manual}/captcha-api.test.mjs +0 -0
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: testdriver:captcha
3
+ description: Solve captchas using 2captcha service
4
+ ---
5
+ <!-- Generated from captcha.mdx. DO NOT EDIT. -->
6
+
7
+ # Captcha Solving
8
+
9
+ TestDriver can automatically solve captchas during your tests using the 2captcha service. This feature works on both **Linux** and **Windows** sandboxes.
10
+
11
+ ## Quick Start
12
+
13
+
14
+ ```javascript
15
+ const result = await testdriver.captcha({
16
+ apiKey: process.env.TWOCAPTCHA_API_KEY,
17
+ });
18
+
19
+ console.log(result.success); // true
20
+ console.log(result.token); // The solved captcha token
21
+ ```
22
+
23
+ That's it! TestDriver will automatically:
24
+ - Detect the captcha type on the page
25
+ - Extract the sitekey
26
+ - Solve the captcha via 2captcha
27
+ - Inject the token into the page
28
+ - Trigger any callbacks
29
+
30
+ ## Supported Captcha Types
31
+
32
+ | Type | Auto-Detected | Notes |
33
+ |------|---------------|-------|
34
+ | reCAPTCHA v2 | ✅ | Including invisible |
35
+ | reCAPTCHA v3 | ✅ | Action is auto-detected |
36
+ | hCaptcha | ✅ | |
37
+ | Cloudflare Turnstile | ✅ | |
38
+
39
+ ## Getting a 2captcha API Key
40
+
41
+ 1. Sign up at [2captcha.com](https://2captcha.com)
42
+ 2. Add funds to your account
43
+ 3. Copy your API key from the dashboard
44
+
45
+ ## Configuration Options
46
+
47
+ ```javascript
48
+ const result = await testdriver.captcha({
49
+ // Required
50
+ apiKey: '2CAPTCHA_API_KEY',
51
+
52
+ // Optional - usually auto-detected
53
+ sitekey: '6Le...', // Override auto-detected sitekey
54
+ type: 'recaptcha_v3', // Override auto-detected type
55
+ action: 'submit', // reCAPTCHA v3 action
56
+
57
+ // Timing
58
+ timeout: 120000, // Max wait time (default: 120s)
59
+ pollInterval: 5000, // Poll interval (default: 5s)
60
+ });
61
+ ```
62
+
63
+ ## Full Example
64
+
65
+ ```javascript
66
+ import { describe, expect, it } from "vitest";
67
+ import { TestDriver } from "testdriver";
68
+
69
+ describe("Checkout flow", () => {
70
+ it("should complete checkout with captcha", async (context) => {
71
+ const testdriver = TestDriver(context);
72
+
73
+ // Navigate to checkout page
74
+ await testdriver.provision.chrome({
75
+ url: 'https://example.com/checkout',
76
+ });
77
+
78
+ // Fill out form
79
+ await testdriver.type({ text: 'John Doe', selector: '#name' });
80
+ await testdriver.type({ text: 'john@example.com', selector: '#email' });
81
+
82
+ // Solve the captcha
83
+ const result = await testdriver.captcha({
84
+ apiKey: process.env.TWOCAPTCHA_API_KEY,
85
+ });
86
+
87
+ expect(result.success).toBe(true);
88
+
89
+ // Submit the form
90
+ await testdriver.click({ selector: '#submit' });
91
+
92
+ // Verify success
93
+ await testdriver.find({ text: 'Order confirmed' });
94
+ }, 180000);
95
+ });
96
+ ```
97
+
98
+ ## Environment Variables
99
+
100
+ You can set your API key as an environment variable:
101
+
102
+ ```bash
103
+ export TWOCAPTCHA_API_KEY=your_api_key_here
104
+ ```
105
+
106
+ Then use it in your tests:
107
+
108
+ ```javascript
109
+ ```javascript
110
+ const result = await testdriver.captcha({
111
+ apiKey: process.env.TWOCAPTCHA_API_KEY,
112
+ });
113
+ ```
114
+
115
+ ### GitHub Actions
116
+
117
+ Add the key to your repository secrets and expose it in your workflow:
118
+
119
+ ```yaml
120
+ - name: Run Tests
121
+ run: vitest run
122
+ env:
123
+ TWOCAPTCHA_API_KEY: ${{ secrets.TWOCAPTCHA_API_KEY }}
124
+ ```
125
+
126
+ ## How It Works
127
+
128
+ 1. **Detection**: Scans the page for captcha elements (`data-sitekey`, script tags, etc.)
129
+ 2. **Submit**: Sends the captcha challenge to 2captcha's solving service
130
+ 3. **Poll**: Waits for human solvers to complete the captcha
131
+ 4. **Inject**: Injects the solved token into the page's hidden fields
132
+ 5. **Callback**: Triggers any JavaScript callbacks the page expects
133
+
134
+ ## Troubleshooting
135
+
136
+ ### "Could not auto-detect captcha"
137
+
138
+ The captcha element wasn't found on the page. Try:
139
+ - Waiting for the page to fully load before calling `captcha()`
140
+ - Providing the `sitekey` and `type` manually
141
+
142
+ ### Timeout errors
143
+
144
+ Captcha solving typically takes 10-30 seconds. If you're getting timeouts:
145
+ - Increase the `timeout` option
146
+ - Check your 2captcha balance
147
+ - Verify the captcha type is correct
148
+
149
+ ### Token not working
150
+
151
+ Some sites validate tokens immediately. Make sure:
152
+ - The token is injected before form submission
153
+ - The captcha type matches what the site expects
154
+ - For reCAPTCHA v3, the `action` parameter matches the site's expected action
155
+
156
+ ## Requirements
157
+
158
+ - Chrome must be launched with remote debugging enabled (automatic on all sandboxes)
159
+ - A valid 2captcha API key with sufficient balance