mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-19 02:20:42 -07:00
test(ui): update snapshots and fix test utility crashes for compact header
This commit is contained in:
@@ -211,7 +211,7 @@ class XtermStdout extends EventEmitter {
|
||||
}
|
||||
await act(async () => {
|
||||
if (vi.isFakeTimers()) {
|
||||
await vi.advanceTimersByTimeAsync(50);
|
||||
await vi.advanceTimersByTimeAsync(200);
|
||||
} else {
|
||||
// Wait for at least one render to be called if we haven't rendered yet or since start of this call,
|
||||
// but don't wait forever as some renders might be synchronous or skipped.
|
||||
@@ -220,7 +220,7 @@ class XtermStdout extends EventEmitter {
|
||||
this.once('render', resolve),
|
||||
);
|
||||
const timeoutPromise = new Promise((resolve) =>
|
||||
setTimeout(resolve, 50),
|
||||
setTimeout(resolve, 200),
|
||||
);
|
||||
await Promise.race([renderPromise, timeoutPromise]);
|
||||
}
|
||||
@@ -264,6 +264,13 @@ class XtermStdout extends EventEmitter {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.lastRenderOutput === undefined && currentFrame !== '') {
|
||||
// If Ink hasn't reported a render yet but terminal has content,
|
||||
// it means a render happened but metrics weren't captured or reported yet.
|
||||
// In this case, we consider it a match if we are just waiting for "anything" (empty expected).
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.lastRenderOutput === undefined) {
|
||||
return false;
|
||||
}
|
||||
@@ -528,12 +535,13 @@ export const mockSettings = new LoadedSettings(
|
||||
// A minimal mock UIState to satisfy the context provider.
|
||||
// Tests that need specific UIState values should provide their own.
|
||||
const baseMockUiState = {
|
||||
history: [],
|
||||
renderMarkdown: true,
|
||||
streamingState: StreamingState.Idle,
|
||||
terminalWidth: 100,
|
||||
terminalHeight: 40,
|
||||
currentModel: 'gemini-pro',
|
||||
terminalBackgroundColor: 'black',
|
||||
terminalBackgroundColor: 'black' as const,
|
||||
cleanUiDetailsVisible: false,
|
||||
allowPlanMode: true,
|
||||
activePtyId: undefined,
|
||||
@@ -552,6 +560,9 @@ const baseMockUiState = {
|
||||
warningText: '',
|
||||
},
|
||||
bannerVisible: false,
|
||||
nightly: false,
|
||||
updateInfo: null,
|
||||
pendingHistoryItems: [],
|
||||
};
|
||||
|
||||
export const mockAppState: AppState = {
|
||||
|
||||
@@ -4,8 +4,8 @@ exports[`App > Snapshots > renders default layout correctly 1`] = `
|
||||
"
|
||||
▝▜▄ Gemini CLI v1.2.3
|
||||
▝▜▄
|
||||
▗▟▀ Authenticated with undefined /auth
|
||||
▝▀ Gemini Code Assist for individuals /upgrade
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
|
||||
Tips for getting started:
|
||||
@@ -49,23 +49,24 @@ Footer
|
||||
|
||||
▝▜▄ Gemini CLI v1.2.3
|
||||
▝▜▄
|
||||
▗▟▀ Authenticated with undefined /auth
|
||||
▝▀ Gemini Code Assist for individuals /upgrade
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
|
||||
Tips for getting started:
|
||||
1. /help for more information
|
||||
2. Ask coding questions, edit code or run commands
|
||||
3. Be specific for the best results
|
||||
Composer"
|
||||
Composer
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`App > Snapshots > renders with dialogs visible 1`] = `
|
||||
"
|
||||
▝▜▄ Gemini CLI v1.2.3
|
||||
▝▜▄
|
||||
▗▟▀ Authenticated with undefined /auth
|
||||
▝▀ Gemini Code Assist for individuals /upgrade
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
|
||||
|
||||
@@ -107,8 +108,8 @@ exports[`App > should render ToolConfirmationQueue along with Composer when tool
|
||||
"
|
||||
▝▜▄ Gemini CLI v1.2.3
|
||||
▝▜▄
|
||||
▗▟▀ Authenticated with undefined /auth
|
||||
▝▀ Gemini Code Assist for individuals /upgrade
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
|
||||
Tips for getting started:
|
||||
@@ -116,19 +117,19 @@ Tips for getting started:
|
||||
2. Ask coding questions, edit code or run commands
|
||||
3. Be specific for the best results
|
||||
HistoryItemDisplay
|
||||
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ Action Required │
|
||||
│ │
|
||||
│ ? ls list directory │
|
||||
│ │
|
||||
│ ls │
|
||||
│ Allow execution of: 'ls'? │
|
||||
│ │
|
||||
│ ● 1. Allow once │
|
||||
│ 2. Allow for this session │
|
||||
│ 3. No, suggest changes (esc) │
|
||||
│ │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ Action Required │
|
||||
│ │
|
||||
│ ? ls list directory │
|
||||
│ │
|
||||
│ ls │
|
||||
│ Allow execution of: 'ls'? │
|
||||
│ │
|
||||
│ ● 1. Allow once │
|
||||
│ 2. Allow for this session │
|
||||
│ 3. No, suggest changes (esc) │
|
||||
│ │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -213,6 +213,12 @@ describe('<AppHeader />', () => {
|
||||
|
||||
it('should NOT render Tips when tipsShown is 10 or more', async () => {
|
||||
const mockConfig = makeFakeConfig();
|
||||
const uiState = {
|
||||
bannerData: {
|
||||
defaultText: '',
|
||||
warningText: '',
|
||||
},
|
||||
};
|
||||
|
||||
persistentStateMock.setData({ tipsShown: 10 });
|
||||
|
||||
@@ -220,6 +226,7 @@ describe('<AppHeader />', () => {
|
||||
<AppHeader version="1.0.0" />,
|
||||
{
|
||||
config: mockConfig,
|
||||
uiState,
|
||||
},
|
||||
);
|
||||
await waitUntilReady();
|
||||
|
||||
@@ -4,8 +4,8 @@ exports[`AlternateBufferQuittingDisplay > renders with a tool awaiting confirmat
|
||||
"
|
||||
▝▜▄ Gemini CLI v0.10.0
|
||||
▝▜▄
|
||||
▗▟▀ Authenticated with undefined /auth
|
||||
▝▀ Gemini Code Assist for individuals /upgrade
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
|
||||
Tips for getting started:
|
||||
@@ -23,8 +23,8 @@ exports[`AlternateBufferQuittingDisplay > renders with active and pending tool m
|
||||
"
|
||||
▝▜▄ Gemini CLI v0.10.0
|
||||
▝▜▄
|
||||
▗▟▀ Authenticated with undefined /auth
|
||||
▝▀ Gemini Code Assist for individuals /upgrade
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
|
||||
Tips for getting started:
|
||||
@@ -38,29 +38,31 @@ Tips for getting started:
|
||||
╭──────────────────────────────────────────────────────────────────────────╮
|
||||
│ ✓ tool2 Description for tool 2 │
|
||||
│ │
|
||||
╰──────────────────────────────────────────────────────────────────────────╯"
|
||||
╰──────────────────────────────────────────────────────────────────────────╯
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`AlternateBufferQuittingDisplay > renders with empty history and no pending items > empty 1`] = `
|
||||
"
|
||||
▝▜▄ Gemini CLI v0.10.0
|
||||
▝▜▄
|
||||
▗▟▀ Authenticated with undefined /auth
|
||||
▝▀ Gemini Code Assist for individuals /upgrade
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
|
||||
Tips for getting started:
|
||||
1. /help for more information
|
||||
2. Ask coding questions, edit code or run commands
|
||||
3. Be specific for the best results"
|
||||
3. Be specific for the best results
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`AlternateBufferQuittingDisplay > renders with history but no pending items > with_history_no_pending 1`] = `
|
||||
"
|
||||
▝▜▄ Gemini CLI v0.10.0
|
||||
▝▜▄
|
||||
▗▟▀ Authenticated with undefined /auth
|
||||
▝▀ Gemini Code Assist for individuals /upgrade
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
|
||||
Tips for getting started:
|
||||
@@ -74,29 +76,31 @@ Tips for getting started:
|
||||
╭──────────────────────────────────────────────────────────────────────────╮
|
||||
│ ✓ tool2 Description for tool 2 │
|
||||
│ │
|
||||
╰──────────────────────────────────────────────────────────────────────────╯"
|
||||
╰──────────────────────────────────────────────────────────────────────────╯
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`AlternateBufferQuittingDisplay > renders with pending items but no history > with_pending_no_history 1`] = `
|
||||
"
|
||||
▝▜▄ Gemini CLI v0.10.0
|
||||
▝▜▄
|
||||
▗▟▀ Authenticated with undefined /auth
|
||||
▝▀ Gemini Code Assist for individuals /upgrade
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
|
||||
Tips for getting started:
|
||||
1. /help for more information
|
||||
2. Ask coding questions, edit code or run commands
|
||||
3. Be specific for the best results"
|
||||
3. Be specific for the best results
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`AlternateBufferQuittingDisplay > renders with user and gemini messages > with_user_gemini_messages 1`] = `
|
||||
"
|
||||
▝▜▄ Gemini CLI v0.10.0
|
||||
▝▜▄
|
||||
▗▟▀ Authenticated with undefined /auth
|
||||
▝▀ Gemini Code Assist for individuals /upgrade
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
|
||||
Tips for getting started:
|
||||
|
||||
@@ -11,7 +11,8 @@ exports[`<AppHeader /> > should not render the banner when no flags are set 1`]
|
||||
Tips for getting started:
|
||||
1. /help for more information
|
||||
2. Ask coding questions, edit code or run commands
|
||||
3. Be specific for the best results"
|
||||
3. Be specific for the best results
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`<AppHeader /> > should not render the default banner if shown count is 5 or more 1`] = `
|
||||
@@ -25,7 +26,8 @@ exports[`<AppHeader /> > should not render the default banner if shown count is
|
||||
Tips for getting started:
|
||||
1. /help for more information
|
||||
2. Ask coding questions, edit code or run commands
|
||||
3. Be specific for the best results"
|
||||
3. Be specific for the best results
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`<AppHeader /> > should render the banner with default text 1`] = `
|
||||
@@ -35,14 +37,15 @@ exports[`<AppHeader /> > should render the banner with default text 1`] = `
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ This is the default banner │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ This is the default banner │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
|
||||
Tips for getting started:
|
||||
1. /help for more information
|
||||
2. Ask coding questions, edit code or run commands
|
||||
3. Be specific for the best results"
|
||||
3. Be specific for the best results
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`<AppHeader /> > should render the banner with warning text 1`] = `
|
||||
@@ -52,12 +55,13 @@ exports[`<AppHeader /> > should render the banner with warning text 1`] = `
|
||||
▗▟▀
|
||||
▝▀
|
||||
|
||||
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ There are capacity issues │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ There are capacity issues │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
|
||||
Tips for getting started:
|
||||
1. /help for more information
|
||||
2. Ask coding questions, edit code or run commands
|
||||
3. Be specific for the best results"
|
||||
3. Be specific for the best results
|
||||
"
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user