Skip to content

Commit aab46a4

Browse files
fix: restore +New button (desktop only) and fix E2E tests (#155)
Fixes E2E tests that were broken by the code viewer PR (#154). ### Problem The code viewer PR removed the `+ New` button and hid session name + status dot on mobile, which broke E2E tests: - Tests clicking `[data-testid="tab-new-btn"]` couldn't find it - Mobile tests checking `[data-testid="status-dot"].connected` couldn't find it - Mobile test creating sessions via `button[title="New tab"]` failed ### Fix - **Restored `+ New` button** with `desktopOnly` class — visible on desktop (where E2E runs at 1280x720), hidden on mobile - **Keep status dot visible** on all viewports — it's small and useful, and mobile E2E tests check it - **Session name hidden** on mobile only (not on desktop) - **Fixed keybar E2E test**: mobile session-creation test now uses side panel "`+ New Session`" button instead of the top bar button ### Verification All 85 E2E tests pass locally: ``` 85 passed (1.7m) ``` Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8c2169e commit aab46a4

3 files changed

Lines changed: 30 additions & 3 deletions

File tree

src/frontend/src/components/TerminalApp/TerminalApp.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@
169169
display: flex !important;
170170
}
171171
.sessionName,
172-
.statusDot,
173172
.statusText {
174173
display: none;
175174
}

src/frontend/src/components/TerminalApp/TerminalApp.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export function TerminalApp() {
4040
const closeCommandPalette = useUIStore((s) => s.closeCommandPalette);
4141
const closeSearchBar = useUIStore((s) => s.closeSearchBar);
4242
const openSidePanel = useUIStore((s) => s.openSidePanel);
43+
const openNewSessionModal = useUIStore((s) => s.openNewSessionModal);
4344
const fontSize = useUIStore((s) => s.fontSize);
4445
const showDownload = useUIStore((s) => s.downloadModalOpen);
4546
const closeDownloadModal = useUIStore((s) => s.closeDownloadModal);
@@ -373,6 +374,31 @@ export function TerminalApp() {
373374
<TabBar inline />
374375

375376
<div className={styles.right}>
377+
<button
378+
className={`${styles.barBtn} ${styles.barBtnWithLabel} ${styles.desktopOnly}`}
379+
data-testid="tab-new-btn"
380+
onClick={() => {
381+
if (document.activeElement instanceof HTMLElement) document.activeElement.blur();
382+
openNewSessionModal();
383+
}}
384+
onTouchStart={(e) => e.stopPropagation()}
385+
aria-label="New tab"
386+
title="New tab"
387+
>
388+
<svg
389+
width="14"
390+
height="14"
391+
viewBox="0 0 24 24"
392+
fill="none"
393+
stroke="currentColor"
394+
strokeWidth="2.5"
395+
strokeLinecap="round"
396+
>
397+
<line x1="12" y1="5" x2="12" y2="19" />
398+
<line x1="5" y1="12" x2="19" y2="12" />
399+
</svg>
400+
<span className={styles.btnLabel}>New</span>
401+
</button>
376402
<button
377403
className={styles.barBtn}
378404
onClick={toggleCommandPalette}

test/e2e-keybar.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,8 +741,10 @@ test.describe('Top Bar — Side Panel (mobile viewport)', () => {
741741
await runCommand(page, `echo ${marker1}`);
742742
await waitForTerminalOutput(page, marker1);
743743

744-
// Create a second session via modal
745-
await page.locator('button[title="New tab"]').click();
744+
// Create a second session via side panel (mobile — top bar + New is hidden)
745+
await page.locator('[aria-label="Toggle panel"]').click();
746+
await expect(page.locator('[data-testid="side-panel"]')).toBeVisible();
747+
await page.getByRole('button', { name: '+ New Session' }).click();
746748
await expect(page.locator('[data-testid="new-session-modal"]')).toBeVisible();
747749
await page.locator('[data-testid="ns-name"]').fill('Second');
748750
await page.locator('[data-testid="ns-create"]').click();

0 commit comments

Comments
 (0)