mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
Integration test for UI flickers (#11067)
This commit is contained in:
@@ -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 {
|
try {
|
||||||
const content = readFileSync(logFilePath, 'utf-8');
|
const content = readFileSync(logFilePath, 'utf-8');
|
||||||
// Check if file has meaningful content (at least one complete JSON object)
|
// Check if file has meaningful content (at least one complete JSON object)
|
||||||
return content.includes('"event.name"');
|
return content.includes('"scopeMetrics"');
|
||||||
} catch {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -908,7 +908,7 @@ export class TestRig {
|
|||||||
const options: pty.IPtyForkOptions = {
|
const options: pty.IPtyForkOptions = {
|
||||||
name: 'xterm-color',
|
name: 'xterm-color',
|
||||||
cols: 80,
|
cols: 80,
|
||||||
rows: 30,
|
rows: 24,
|
||||||
cwd: this.testDir!,
|
cwd: this.testDir!,
|
||||||
env: Object.fromEntries(
|
env: Object.fromEntries(
|
||||||
Object.entries(env).filter(([, v]) => v !== undefined),
|
Object.entries(env).filter(([, v]) => v !== undefined),
|
||||||
|
|||||||
Reference in New Issue
Block a user