Skip to content

Commit f1d7af3

Browse files
committed
test(platform-web): pin each text-entry operation to its own hint
The assertion chose the expected hint from the error message, so a regression that relabelled typeText as fill would still pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016qAu53rMak1bXMuR5U2gF4
1 parent 373b157 commit f1d7af3

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

‎packages/platform-web/src/agent-browser-provider.test.ts‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,17 @@ test('agent-browser provider keeps typed text out of argv and error details when
149149
);
150150
};
151151
await withCommandExecutorOverride(executor, async () => {
152-
for (const attempt of [
153-
async () => await provider.fillRef?.('@e9', secret),
154-
() => provider.typeText(secret),
155-
() => provider.fill(11, 22, secret),
156-
]) {
152+
for (const [attempt, command, hint] of [
153+
[async () => await provider.fillRef?.('@e9', secret), 'fill', /snapshot -i/],
154+
[() => provider.typeText(secret), 'keyboard type', /Focus the field again/],
155+
[() => provider.fill(11, 22, secret), 'keyboard type', /Focus the field again/],
156+
] as const) {
157157
await assert.rejects(attempt, (error: unknown) => {
158158
assert.ok(error instanceof AppError);
159159
assert.equal(error.code, 'COMMAND_FAILED');
160-
assert.match(error.message, /^agent-browser (fill|keyboard type) failed/);
160+
assert.ok(error.message.startsWith(`agent-browser ${command} failed`), error.message);
161161
assert.equal(error.details?.reason, 'text-entry-failed');
162-
assert.match(
163-
String(error.details?.hint),
164-
error.message.startsWith('agent-browser fill')
165-
? /snapshot -i/
166-
: /Focus the field again/,
167-
);
162+
assert.match(String(error.details?.hint), hint);
168163
assert.equal(error.message.includes(secret), false);
169164
assert.equal(JSON.stringify(error.details).includes(secret), false);
170165
return true;

0 commit comments

Comments
 (0)