diff --git a/frontend/src/v2/__tests__/V2AgentBYOName.test.tsx b/frontend/src/v2/__tests__/V2AgentBYOName.test.tsx index bdbd6d5597..73b48d8af5 100644 --- a/frontend/src/v2/__tests__/V2AgentBYOName.test.tsx +++ b/frontend/src/v2/__tests__/V2AgentBYOName.test.tsx @@ -79,6 +79,22 @@ afterEach(() => { }); describe('BYO default agent name follows where it runs', () => { + test('pressing the connect action keeps the name field focused until click', async () => { + mockGet(); + renderAt(); + await waitFor(() => expect(screen.getByTestId('byo-mode-byo')).toBeInTheDocument()); + fireEvent.click(screen.getByTestId('byo-mode-byo')); + const action = screen.getByRole('button', { name: /get my connect command/i }); + await waitFor(() => expect(action).toBeEnabled()); + nameInput().focus(); + expect(nameInput()).toHaveFocus(); + expect(fireEvent.mouseDown(action, { cancelable: true })).toBe(false); + expect(nameInput()).toHaveFocus(); + const moreWays = screen.getByTestId('byo-more-ways').querySelector('summary'); + expect(fireEvent.mouseDown(moreWays, { cancelable: true })).toBe(false); + expect(nameInput()).toHaveFocus(); + }); + test('reconnect deep link keeps the name and rotates a revoked key with one action', async () => { mockGet([{ name: 'local', installedBy: 'u1', runtime: { runtimeType: 'webhook' }, connection: { state: 'revoked', lastSeenAt: null } }]); diff --git a/frontend/src/v2/__tests__/v2-layout-invariants.test.ts b/frontend/src/v2/__tests__/v2-layout-invariants.test.ts index 9e87921548..890abb1f21 100644 --- a/frontend/src/v2/__tests__/v2-layout-invariants.test.ts +++ b/frontend/src/v2/__tests__/v2-layout-invariants.test.ts @@ -213,6 +213,12 @@ describe('v2 layout invariants (CSS rule presence)', () => { expect(ruleBody(v2, '.v2-byo__hint')).toContain('margin: 0'); }); + test('BYO field hints take no space until focused or in error', () => { + expect(ruleBody(v2, '.v2-byo__field > .v2-byo__hint')).toContain('display: none'); + expect(selectorRuleBody(v2, '.v2-byo__field:focus-within > .v2-byo__hint,\n.v2-byo__field--error > .v2-byo__hint')) + .toContain('display: block'); + }); + // #2287 (QA BYO walk 1): "Other ways to connect" folds the alternatives so the // page shows one command, and the needs line is read before the Copy button. // jsdom cannot see either; sprint-review deleted all three rules and every diff --git a/frontend/src/v2/components/V2AgentBYO.tsx b/frontend/src/v2/components/V2AgentBYO.tsx index 5d34d92787..fe09611e33 100644 --- a/frontend/src/v2/components/V2AgentBYO.tsx +++ b/frontend/src/v2/components/V2AgentBYO.tsx @@ -1201,7 +1201,8 @@ const V2AgentBYO: React.FC = () => { {t('agentByo.actions.chooseFirst')} ) : canReconnect ? ( -