mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -07:00
Integration test for UI flickers (#11067)
This commit is contained in:
30
integration-tests/flicker.test.ts
Normal file
30
integration-tests/flicker.test.ts
Normal file
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user