fix(tests): enable cyclic schema MCP tool test (#10912)

This commit is contained in:
Sandy Tao
2025-10-14 18:46:54 -07:00
committed by GitHub
parent dabe161a6f
commit 4f5b335792
5 changed files with 41 additions and 23 deletions

View File

@@ -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);