Client options
Pass these toTestDriver(context, options) or new TestDriver(options). They apply to every call the client makes.
boolean | object
default:"true"
Pass
false to turn the cache off. Pass an object to change the match thresholds.string
The key cache entries are stored under. By default, TestDriver generates one from the test file. See Cache keys.
object
Deprecated. Use
cache.thresholds instead.Per-call options
Override the client settings for a single call.find()
string
Use this key for this call instead of the clientβs key.
number
Overrides
cache.thresholds.find.screen for this call.number
Overrides
cache.thresholds.find.element for this call.findAll()
findAll() takes cacheKey and cache.thresholds.screen. It doesnβt use the element threshold.
assert()
string
Use this key for this call instead of the clientβs key.
number
Overrides
cache.thresholds.assert for this call.Threshold priority
When a threshold is set in more than one place, the most specific wins:- The per-call option, such as
find(description, { cache: { thresholds: { screen: 0.1 } } }) - A legacy number argument, such as
find(description, 0.1) - The client option,
cache.thresholds - The defaults:
screen0.05,element0.8,assert0.05
Cache keys
Cache entries are stored under a key. By default, TestDriver generates the key from the test file:- It hashes the contents of the file that creates the client (SHA-256, first 16 hex characters).
- Editing the file changes the hash, so the file starts with a fresh cache.
- Each test file gets its own cache.
cacheKey to keep a cache across edits, or to share one between files that use the same screens:
find() and findAll() then skip the cache unless you set cacheKey.
What must match
A cached entry is reused only when all of these match the run that created it:- The cache key.
- The exact description passed to
find(), or the exact assertion text. - The sandbox OS and screen resolution.
Turn the cache off
Turn the cache off for one client:Inspect a result
Read the cache details from the element thatfind() returns:
object
Related
Caching
How the cache works and when it helps.
Options
Every client option, with its default.
find()
Locate an element by describing it.
assert()
Check the screen with an AI assertion.

