mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 10:10:56 -07:00
05bf04c852
- Enhance AppRig and matchers to support robust component discovery via node attributes and styles - Update SuggestionsDisplay to support logical component tagging - Fix act() warnings and stability issues in SuggestionsDisplay tests - Refresh snapshots and rebase on origin/main
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2026 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
import { AppRig } from '../../test-utils/AppRig.js';
|
|
import { SuggestionsDisplay } from './SuggestionsDisplay.js';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
describe('SuggestionsDisplay UX Journey', () => {
|
|
let rig: AppRig;
|
|
|
|
beforeEach(async () => {
|
|
const fakeResponsesPath = path.join(
|
|
__dirname,
|
|
'..',
|
|
'..',
|
|
'test-utils',
|
|
'fixtures',
|
|
'simple.responses',
|
|
);
|
|
rig = new AppRig({ fakeResponsesPath });
|
|
await rig.initialize();
|
|
await rig.render();
|
|
await rig.waitForIdle();
|
|
// Allow async command loading to settle
|
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
});
|
|
|
|
afterEach(async () => {
|
|
await rig.unmount();
|
|
});
|
|
|
|
it('should visually show the suggestions display when / is typed', async () => {
|
|
// Initially should not have suggestions
|
|
expect(rig).not.toVisuallyContain(SuggestionsDisplay.name);
|
|
|
|
// Type '/' to trigger suggestions
|
|
await rig.type('/');
|
|
|
|
// Wait for SuggestionsDisplay to appear (Automatic lookup!)
|
|
await rig.waitForComponent(SuggestionsDisplay.name);
|
|
|
|
// Assert that the component is now present in the tree
|
|
expect(rig).toVisuallyContain(SuggestionsDisplay.name);
|
|
|
|
// Also verify text for sanity
|
|
expect(rig.lastFrame).toContain('about');
|
|
|
|
// Capture the state for manual inspection if needed
|
|
await expect(rig).toMatchSvgSnapshot({ name: 'suggestions-opened' });
|
|
});
|
|
});
|