From 7e7559d713b5181f719b9d4f32f1d5c862ff1e06 Mon Sep 17 00:00:00 2001 From: bymyself Date: Fri, 30 Oct 2026 03:31:11 +0000 Subject: [PATCH 1/6] fix(agent): point the tour card at its target and answer clicks on the highlight The tour card sat beside the spotlit Agent panel with nothing tying it to the highlight, so it read as another canvas node. Clicks on the highlighted panel were swallowed by the scrim with no response, and users clicked the panel for a minute thinking the tour was broken (PM-2276). Side-placed cards now carry an arrow pointing at the middle of their target. A click on the dimmed screen or the highlight briefly outlines the card and moves focus to its primary button. The card's scroll moves to an inner wrapper so the arrow is not clipped. Tests written first: OnboardingCoach unit cases for the arrow position, the click nudge and its timeout; an agentOnboarding e2e case that clicks the spotlit panel. --- .../tests/agent/agentOnboarding.spec.ts | 34 ++++++ src/workbench/extensions/agent/README.md | 5 + .../components/agent/OnboardingCoach.test.ts | 59 +++++++++ .../components/agent/OnboardingCoach.vue | 115 +++++++++++++++--- 4 files changed, 193 insertions(+), 20 deletions(-) diff --git a/browser_tests/tests/agent/agentOnboarding.spec.ts b/browser_tests/tests/agent/agentOnboarding.spec.ts index bc6b9f6b0ff..fdd654295b3 100644 --- a/browser_tests/tests/agent/agentOnboarding.spec.ts +++ b/browser_tests/tests/agent/agentOnboarding.spec.ts @@ -52,6 +52,40 @@ test.describe('Agent onboarding tour', { tag: ['@cloud', '@ui'] }, () => { .toBe('false') }) + test('points the user at the card when they click the highlighted panel', async ({ + page, + agentFlagEnabled + }) => { + // PM-2276: the panel is spotlit but inert while a card is up, and users + // clicked it for a minute without noticing the card beside it. + await bootAgentApp(page, agentFlagEnabled, { + onboardingCompleted: false + }) + const panel = new AgentPanel(page) + await panel.open() + + const firstCard = page.getByRole('dialog', { + name: enMessages.agent.coachTitle + }) + await expect(firstCard).toBeVisible() + await expect(page.getByTestId('agent-coach-arrow')).toBeVisible() + + const spotlight = await page + .getByTestId('agent-coach-spotlight') + .boundingBox() + if (!spotlight) throw new Error('spotlight has no box') + await page.mouse.click( + spotlight.x + spotlight.width / 2, + spotlight.y + spotlight.height / 2 + ) + + await expect(firstCard).toHaveAttribute('data-nudged', '') + await expect( + firstCard.getByRole('button', { name: enMessages.g.next }) + ).toBeFocused() + await expect(firstCard).toBeVisible() + }) + test('replays the tour from the header after it has been completed', async ({ page, agentFlagEnabled diff --git a/src/workbench/extensions/agent/README.md b/src/workbench/extensions/agent/README.md index 1e31f0005c6..c55f21697ce 100644 --- a/src/workbench/extensions/agent/README.md +++ b/src/workbench/extensions/agent/README.md @@ -137,6 +137,11 @@ panel, composer, graph and chat history. **Next** advances through the cards; **Done** on the last card, **Skip** on any card and Escape once a card is on screen all dismiss the tour and mark it complete. +Cards placed beside their target carry an arrow pointing at it. The rest of the +screen, the highlighted area included, does not respond while a card is up; a +click there briefly outlines the card and moves focus to **Next** (or **Done**) +so the user finds the controls instead of clicking the highlight. + Completion is device-local in `localStorage`, scoped to the authenticated user and active workspace; with either unresolved there is no scope to record, so no tour is shown at all. It does not sync through Global Settings. A different diff --git a/src/workbench/extensions/agent/components/agent/OnboardingCoach.test.ts b/src/workbench/extensions/agent/components/agent/OnboardingCoach.test.ts index ceaf45018c3..5d4844a1aff 100644 --- a/src/workbench/extensions/agent/components/agent/OnboardingCoach.test.ts +++ b/src/workbench/extensions/agent/components/agent/OnboardingCoach.test.ts @@ -230,6 +230,65 @@ describe('OnboardingCoach', () => { } }) + it('points an arrow from each side-placed card at the middle of its target', async () => { + const user = userEvent.setup() + mount() + for (const [index, step] of STEPS.entries()) { + const dialog = await screen.findByRole('dialog', { name: step.title }) + if (step.placement === 'graph-bottom') { + expect(screen.queryByTestId('agent-coach-arrow')).toBeNull() + } else { + const targetRect = rectangles[step.target.slice(1)] + const arrow = screen.getByTestId('agent-coach-arrow') + expect(dialog).toContainElement(arrow) + await waitFor(() => { + const arrowCenter = + parseFloat(dialog.style.top) + parseFloat(arrow.style.top) + expect(arrowCenter).toBeCloseTo( + targetRect.top + targetRect.height / 2, + 0 + ) + }) + } + if (index < 3) + await user.click(screen.getByRole('button', { name: 'Next' })) + } + }) + + it('draws attention to the card when the user clicks the dimmed screen or the highlighted area', async () => { + const user = userEvent.setup() + mount() + const dialog = await screen.findByRole('dialog', { name: STEPS[0].title }) + expect(dialog).not.toHaveAttribute('data-nudged') + + await user.click(screen.getByTestId('agent-coach-scrim')) + + expect(dialog).toHaveAttribute('data-nudged') + expect(screen.getByRole('button', { name: 'Next' })).toHaveFocus() + expect(screen.getByRole('dialog', { name: STEPS[0].title })).toBe(dialog) + expect(localStorage.getItem(KEY)).toBe('false') + expect(telemetry().trackAgentOnboardingStep).not.toHaveBeenCalled() + }) + + it('stops drawing attention to the card shortly after the click', async () => { + vi.useFakeTimers() + try { + const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime }) + mount() + const dialog = await screen.findByRole('dialog', { + name: STEPS[0].title + }) + await user.click(screen.getByTestId('agent-coach-scrim')) + expect(dialog).toHaveAttribute('data-nudged') + + await vi.advanceTimersByTimeAsync(2_000) + + expect(dialog).not.toHaveAttribute('data-nudged') + } finally { + vi.useRealTimers() + } + }) + it('shows the target in its hover state with its tooltip inside the spotlight', async () => { const user = userEvent.setup() const steps = STEPS.map((step, index) => diff --git a/src/workbench/extensions/agent/components/agent/OnboardingCoach.vue b/src/workbench/extensions/agent/components/agent/OnboardingCoach.vue index 4f6df60152e..d9188764b91 100644 --- a/src/workbench/extensions/agent/components/agent/OnboardingCoach.vue +++ b/src/workbench/extensions/agent/components/agent/OnboardingCoach.vue @@ -1,6 +1,6 @@