diff --git a/integration-tests/flicker.test.ts b/integration-tests/flicker.test.ts new file mode 100644 index 0000000000..6b0665db65 --- /dev/null +++ b/integration-tests/flicker.test.ts @@ -0,0 +1,30 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { describe, it, expect } from 'vitest'; +import { TestRig } from './test-helper.js'; + +describe('Flicker Detector', () => { + it('should not detect a flicker under the max height budget', async () => { + const rig = new TestRig(); + await rig.setup('flicker-detector-test'); + + const run = await rig.runInteractive(); + const prompt = 'Tell me a fun fact.'; + await run.type(prompt); + await run.type('\r'); + + const hasUserPromptEvent = await rig.waitForTelemetryEvent('user_prompt'); + expect(hasUserPromptEvent).toBe(true); + + const sessionCountMetric = rig.readMetric('session.count'); + expect(sessionCountMetric).not.toBeNull(); + + // We expect NO flicker event to be found. + const flickerMetric = rig.readMetric('ui.flicker.count'); + expect(flickerMetric).toBeNull(); + }); +}); diff --git a/integration-tests/test-helper.ts b/integration-tests/test-helper.ts index 375f12545a..ee8a5c6297 100644 --- a/integration-tests/test-helper.ts +++ b/integration-tests/test-helper.ts @@ -545,7 +545,7 @@ export class TestRig { try { const content = readFileSync(logFilePath, 'utf-8'); // Check if file has meaningful content (at least one complete JSON object) - return content.includes('"event.name"'); + return content.includes('"scopeMetrics"'); } catch { return false; } @@ -908,7 +908,7 @@ export class TestRig { const options: pty.IPtyForkOptions = { name: 'xterm-color', cols: 80, - rows: 30, + rows: 24, cwd: this.testDir!, env: Object.fromEntries( Object.entries(env).filter(([, v]) => v !== undefined),