@testdriverai/agent 7.11.255-test → 7.11.257-test
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 +5 -3
- package/docs/bring-your-own-machine.mdx +0 -4
- package/docs/cache.mdx +0 -4
- package/docs/options.mdx +1 -1
- package/docs/parse.mdx +0 -4
- package/docs/screenshots.mdx +1 -5
- package/docs/secrets.mdx +2 -4
- package/package.json +1 -1
- package/sdk.d.ts +3 -3
- package/sdk.js +11 -3
package/agent/index.js
CHANGED
|
@@ -1691,8 +1691,9 @@ ${regression}
|
|
|
1691
1691
|
createNew = true;
|
|
1692
1692
|
}
|
|
1693
1693
|
|
|
1694
|
-
// If CI environment variable is true,
|
|
1695
|
-
|
|
1694
|
+
// If CI environment variable is true, create a new sandbox unless the
|
|
1695
|
+
// caller explicitly named one to connect to
|
|
1696
|
+
if (this.config.CI && !requireSandbox && !this.explicitSandboxId) {
|
|
1696
1697
|
createNew = true;
|
|
1697
1698
|
this.emitter.emit(
|
|
1698
1699
|
events.log.log,
|
|
@@ -1769,7 +1770,8 @@ ${regression}
|
|
|
1769
1770
|
return;
|
|
1770
1771
|
} else if (
|
|
1771
1772
|
this.sandboxId &&
|
|
1772
|
-
(requireSandbox ||
|
|
1773
|
+
(requireSandbox ||
|
|
1774
|
+
(!createNew && (!this.config.CI || this.explicitSandboxId)))
|
|
1773
1775
|
) {
|
|
1774
1776
|
// Only attempt to connect to existing sandbox if not in CI mode and not creating new
|
|
1775
1777
|
// Attempt to connect to known instance
|
|
@@ -171,10 +171,6 @@ describe('My machine', () => {
|
|
|
171
171
|
|
|
172
172
|
On a Windows machine, also pass `os: 'windows'`.
|
|
173
173
|
|
|
174
|
-
<Warning>
|
|
175
|
-
Run these tests with the `CI` environment variable unset. When `CI` is set, TestDriver always requests a new sandbox and ignores `sandboxId`, so the test waits for a runner that never connects.
|
|
176
|
-
</Warning>
|
|
177
|
-
|
|
178
174
|
Run the test from any computer:
|
|
179
175
|
|
|
180
176
|
```bash
|
package/docs/cache.mdx
CHANGED
|
@@ -163,10 +163,6 @@ Or for a whole run:
|
|
|
163
163
|
TD_NO_CACHE=true npx vitest run
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
-
<Warning>
|
|
167
|
-
`cache: { enabled: false }` doesn't turn the cache off. Use `cache: false` or `TD_NO_CACHE=true`.
|
|
168
|
-
</Warning>
|
|
169
|
-
|
|
170
166
|
## Inspect a result
|
|
171
167
|
|
|
172
168
|
Read the cache details from the element that `find()` returns:
|
package/docs/options.mdx
CHANGED
|
@@ -197,7 +197,7 @@ These options control the element cache, which reuses element positions from a p
|
|
|
197
197
|
<ParamField path="cache" type="boolean | object" default="true">
|
|
198
198
|
Pass `false` to turn the cache off, or an object to set the match thresholds.
|
|
199
199
|
|
|
200
|
-
`cache: { enabled: false }`
|
|
200
|
+
`cache: { enabled: false }` and `TD_NO_CACHE=true` also turn it off.
|
|
201
201
|
|
|
202
202
|
<Expandable title="advanced config">
|
|
203
203
|
<ParamField path="thresholds" type="object">
|
package/docs/parse.mdx
CHANGED
|
@@ -69,10 +69,6 @@ None. `parse()` analyzes the screen as it is when you call it.
|
|
|
69
69
|
</Expandable>
|
|
70
70
|
</ResponseField>
|
|
71
71
|
|
|
72
|
-
<Warning>
|
|
73
|
-
`interactivity` is a boolean, although the TypeScript types in `sdk.d.ts` declare it as a string. Compare it with `true`, not with a string like `'clickable'`.
|
|
74
|
-
</Warning>
|
|
75
|
-
|
|
76
72
|
## Errors
|
|
77
73
|
|
|
78
74
|
`parse()` throws if the screen analysis fails. The error message comes from the TestDriver API.
|
package/docs/screenshots.mdx
CHANGED
|
@@ -78,17 +78,13 @@ Each automatic screenshot is named:
|
|
|
78
78
|
The description comes from:
|
|
79
79
|
|
|
80
80
|
- The description passed to `find()` or `findAll()`.
|
|
81
|
-
- The first 20 characters typed by `type()`.
|
|
81
|
+
- The first 20 characters typed by `type()`, unless you pass `secret: true`.
|
|
82
82
|
- The keys passed to `pressKeys()`, joined with `+`.
|
|
83
83
|
- The direction passed to `scroll()`.
|
|
84
84
|
- The first 30 characters of the text passed to `assert()` or `extract()`.
|
|
85
85
|
|
|
86
86
|
TestDriver lowercases it, drops anything other than letters, digits, spaces, and hyphens, turns spaces into hyphens, and keeps the first 30 characters.
|
|
87
87
|
|
|
88
|
-
<Warning>
|
|
89
|
-
The description for `type()` uses the typed text even when you pass `secret: true`. Don't turn on `autoScreenshots` for tests that type passwords, or the start of the password ends up in a file name.
|
|
90
|
-
</Warning>
|
|
91
|
-
|
|
92
88
|
### Example
|
|
93
89
|
|
|
94
90
|
This test:
|
package/docs/secrets.mdx
CHANGED
|
@@ -45,11 +45,9 @@ With `secret: true`, TestDriver replaces the text with `****`:
|
|
|
45
45
|
- In the SDK's console output.
|
|
46
46
|
- In the record of the action that TestDriver stores for the test run.
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
With [`autoScreenshots`](/options#param-auto-screenshots) on, the typed text is also left out of screenshot file names.
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
With [`autoScreenshots`](/options#param-auto-screenshots) on, screenshot file names include the first characters of the typed text, even when `secret` is `true`. Leave `autoScreenshots` off in tests that type secrets.
|
|
52
|
-
</Warning>
|
|
50
|
+
The text is still typed into the sandbox, so `secret: true` can't hide what the screen shows. If the field displays its contents, the value appears in the [Dashcam](/dashcam) recording and in screenshots. Password fields usually mask what you type, but plain text fields don't.
|
|
53
51
|
|
|
54
52
|
## Store secrets locally
|
|
55
53
|
|
package/package.json
CHANGED
package/sdk.d.ts
CHANGED
|
@@ -435,8 +435,8 @@ export interface ParsedElement {
|
|
|
435
435
|
type: string;
|
|
436
436
|
/** Text content or description */
|
|
437
437
|
content: string;
|
|
438
|
-
/**
|
|
439
|
-
interactivity:
|
|
438
|
+
/** Whether the element appears to be clickable */
|
|
439
|
+
interactivity: boolean;
|
|
440
440
|
/** Bounding box in pixel coordinates */
|
|
441
441
|
bbox: ParsedElementBBox;
|
|
442
442
|
/** Bounding box as {left, top, width, height} */
|
|
@@ -1416,7 +1416,7 @@ export default class TestDriverSDK {
|
|
|
1416
1416
|
* @example
|
|
1417
1417
|
* // Find clickable elements
|
|
1418
1418
|
* const result = await testdriver.parse();
|
|
1419
|
-
* const clickable = result.elements.filter(e => e.interactivity
|
|
1419
|
+
* const clickable = result.elements.filter(e => e.interactivity);
|
|
1420
1420
|
*
|
|
1421
1421
|
* @example
|
|
1422
1422
|
* // Find text content
|
package/sdk.js
CHANGED
|
@@ -1576,7 +1576,9 @@ class TestDriverSDK {
|
|
|
1576
1576
|
// To enable cache, provide a cacheKey when calling find() or findAll()
|
|
1577
1577
|
// Also support TD_NO_CACHE environment variable and cache: false option for backwards compatibility
|
|
1578
1578
|
const cacheExplicitlyDisabled =
|
|
1579
|
-
options.cache === false ||
|
|
1579
|
+
options.cache === false ||
|
|
1580
|
+
options.cache?.enabled === false ||
|
|
1581
|
+
process.env.TD_NO_CACHE === "true";
|
|
1580
1582
|
|
|
1581
1583
|
// Track whether cache was explicitly disabled (not just default)
|
|
1582
1584
|
this._cacheExplicitlyDisabled = cacheExplicitlyDisabled;
|
|
@@ -2130,6 +2132,11 @@ CAPTCHA_SOLVER_EOF`,
|
|
|
2130
2132
|
};
|
|
2131
2133
|
|
|
2132
2134
|
// Set agent properties for buildEnv to use
|
|
2135
|
+
// A sandboxId the user passed (not one loaded from .testdriver/last-sandbox)
|
|
2136
|
+
// is honored even in CI, where buildEnv otherwise always creates a new sandbox.
|
|
2137
|
+
this.agent.explicitSandboxId = !!(
|
|
2138
|
+
connectOptions.sandboxId || this.options?.sandboxId
|
|
2139
|
+
);
|
|
2133
2140
|
if (connectOptions.sandboxId) {
|
|
2134
2141
|
this.agent.sandboxId = connectOptions.sandboxId;
|
|
2135
2142
|
} else if (this.sandboxId) {
|
|
@@ -2797,7 +2804,8 @@ CAPTCHA_SOLVER_EOF`,
|
|
|
2797
2804
|
|
|
2798
2805
|
switch (methodName) {
|
|
2799
2806
|
case "type":
|
|
2800
|
-
// For type, use the text being typed (truncated)
|
|
2807
|
+
// For type, use the text being typed (truncated), masked if secret
|
|
2808
|
+
if (args[1] && typeof args[1] === "object" && args[1].secret) return "****";
|
|
2801
2809
|
return typeof firstArg === "string" ? firstArg.substring(0, 20) : "";
|
|
2802
2810
|
case "pressKeys":
|
|
2803
2811
|
// For pressKeys, show the keys
|
|
@@ -3047,7 +3055,7 @@ CAPTCHA_SOLVER_EOF`,
|
|
|
3047
3055
|
* @example
|
|
3048
3056
|
* // Find clickable elements
|
|
3049
3057
|
* const result = await testdriver.parse();
|
|
3050
|
-
* const clickable = result.elements.filter(e => e.interactivity
|
|
3058
|
+
* const clickable = result.elements.filter(e => e.interactivity);
|
|
3051
3059
|
*
|
|
3052
3060
|
* @example
|
|
3053
3061
|
* // Find text content
|