mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-24 22:55:13 +00:00
fix(tests): enable cyclic schema MCP tool test (#10912)
This commit is contained in:
@@ -195,8 +195,33 @@ export class InteractiveRun {
|
||||
expect(found, `Did not find expected text: "${text}"`).toBe(true);
|
||||
}
|
||||
|
||||
// Simulates typing a string one character at a time to avoid paste detection.
|
||||
// This types slowly to make sure command is correct, but only work for short
|
||||
// commands that are not multi-line, use sendKeys to type long prompts
|
||||
async type(text: string) {
|
||||
let typedSoFar = '';
|
||||
for (const char of text) {
|
||||
this.ptyProcess.write(char);
|
||||
typedSoFar += char;
|
||||
|
||||
// Wait for the typed sequence so far to be echoed back.
|
||||
const found = await poll(
|
||||
() => stripAnsi(this.output).includes(typedSoFar),
|
||||
5000, // 5s timeout per character (generous for CI)
|
||||
10, // check frequently
|
||||
);
|
||||
|
||||
if (!found) {
|
||||
throw new Error(
|
||||
`Timed out waiting for typed text to appear in output: "${typedSoFar}".\nStripped output:\n${stripAnsi(
|
||||
this.output,
|
||||
)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Simulates typing a string one character at a time to avoid paste detection.
|
||||
async sendKeys(text: string) {
|
||||
const delay = 5;
|
||||
for (const char of text) {
|
||||
this.ptyProcess.write(char);
|
||||
|
||||
Reference in New Issue
Block a user