fix(home): hide the 'No pick yet' nudge once the user has any pick

The Now/Next cards fall back to a concurrent-session list when the user
has no pick for that specific slot, and always appended a 'No pick yet —
tap a session in the Agenda to choose.' hint. With picks on other slots
this contradicted the 'My picks today' list right below (screenshot).
ConcurrentList now takes hasPicks and renders the hint only while the
user has no picks at all.

e2e: two new 'Home session picks' cases (hint hidden with a pick on the
other slot; still shown with none, asserted per card). 43/43 local.
Docs: screens.md nudge rule, tests.md regression note.
This commit is contained in:
Lago committed 2026-10-17 10:36:58 +02:00
1 parent 7733af7625
commit 999527b188
4 files changed
+63 -8

No files matched your search

+41
View File
@@ -134,6 +134,47 @@ test.describe('Home session picks', () => {
await expect(page.locator('.sheet')).toHaveCount(0);
await expect(page.getByTestId('home-pick')).toHaveCount(1);
});
// The Now/Next card lists concurrent sessions when the user has no pick for
// that specific slot. Its "No pick yet" nudge must disappear once the user
// has any pick at all — otherwise it contradicts the "My picks today" list
// shown right below it (the reported bug).
const nowNextRows = [
{ slot_id: 1, slot_name: 'Slot 10:15–11:00', start_time: '10:15:00', end_time: '11:00:00', slot_type: 'session',
session_id: 'session-1', title: 'Now Talk', room: 'Room A', speakers: 'Ada Lovelace' },
{ slot_id: 2, slot_name: 'Slot 11:15–12:00', start_time: '11:15:00', end_time: '12:00:00', slot_type: 'session',
session_id: 'session-2', title: 'Next Talk', room: 'Room B', speakers: 'Grace Hopper' },
].map(row => ({ ...row, slot_date: '2026-02-20', description: '', material_path: null, capacity: null,
average_feedback: null, ai_generated_feedback: null, level: null, area: null }));
test('hides the "No pick yet" nudge once the user has any pick', async ({ page }) => {
const { session } = await mockApi(page, {
registered: true, checkedIn: true,
picks: [{ slot_id: 2, session_id: 'session-2' }],
});
await page.route('**/rest/v1/rpc/get_agenda', route => route.fulfill({ json: nowNextRows }));
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
await expect(page.getByTestId('tab-home')).toHaveClass(/active/);
// The pick lives on the Next slot, so the Now card falls back to the
// concurrent-session list — and must not nag about having no pick.
await expect(page.getByTestId('home-pick')).toHaveCount(1);
await expect(page.locator('.now-card')).toContainText('Now Talk');
await expect(page.getByText('No pick yet — tap a session in the Agenda to choose.')).toHaveCount(0);
});
test('still shows the "No pick yet" nudge when the user has no picks', async ({ page }) => {
const { session } = await mockApi(page, { registered: true, checkedIn: true });
await page.route('**/rest/v1/rpc/get_agenda', route => route.fulfill({ json: nowNextRows }));
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
await expect(page.getByTestId('tab-home')).toHaveClass(/active/);
await expect(page.getByTestId('home-pick')).toHaveCount(0);
await expect(page.locator('.now-card')).toContainText('Now Talk');
// Both the Now and the Next card fall back to the concurrent list, so the
// nudge is asserted per card rather than page-wide.
await expect(page.locator('.now-card').getByText('No pick yet — tap a session in the Agenda to choose.')).toBeVisible();
});
});
test.describe('Event demo clock', () => {