feat(convivo): pending-material chip opens the session detail directly
Tapping a session in the red-clip popup only did go('agenda'), leaving the
speaker to hunt for the talk the popup had just named. It now opens the same
SessionDetail sheet "My picks today" uses -- the upload form is inside it, so
one tap reaches the action.
CONV-MATERIAL-005 provisions its own speaker fixture (the old demo speaker died
with the pretix-import reseed), drives the real QR login, and asserts the
upload notice is visible with the home tab still active; mutation-checked by
restoring go('agenda') -- the test fails on the old behavior.
This commit is contained in:
1 parent
184449adb6
commit
0cb67bcabd
4 files changed
+93
-4
No files matched your search
@@ -1,10 +1,10 @@
|
||||
import path from 'node:path';
|
||||
import { test, expect } from './base';
|
||||
import { APP_URL, ID, SPEAKER_SESSION } from '../src/helpers/config';
|
||||
import { APP_URL, ID, SPEAKER_SESSION, EVENT_ID, type Identity } from '../src/helpers/config';
|
||||
import { login } from '../src/helpers/auth';
|
||||
import { createUser } from '../src/helpers/multi';
|
||||
import { signInJwt, userRpcResult } from '../src/helpers/api';
|
||||
import { db } from '../src/helpers/db';
|
||||
import { db, psql, psqlScalar, sqlQuote } from '../src/helpers/db';
|
||||
import { AppPage } from '../src/pages/AppPage';
|
||||
import { AgendaPage } from '../src/pages/AgendaPage';
|
||||
import { HomePage } from '../src/pages/HomePage';
|
||||
@@ -76,6 +76,66 @@ test.describe('Speaker + material upload', () => {
|
||||
await expect(page.getByTestId('material-upload-notice')).toBeVisible();
|
||||
});
|
||||
|
||||
test('CONV-MATERIAL-005 the pending-material pill opens the session directly', async ({ page }) => {
|
||||
// Self-contained fixture: the demo speaker of §27/§28 belongs to the old
|
||||
// seed and no longer exists since the pretix import, so this test provisions
|
||||
// its own speaker on a real session that has no material.
|
||||
const email = '[email protected]';
|
||||
const token = 'CVV-PENDING-PILL-01';
|
||||
const session = psqlScalar(`select s.id || '|' || s.title from public.sessions s
|
||||
join public.slots sl on sl.id = s.slot_id
|
||||
join public.session_speakers sp on sp.session_id = s.id
|
||||
where (s.material_path is null or s.material_path = '')
|
||||
and sl.type <> 'service_session'
|
||||
order by sl.id limit 1`).split('|')[0];
|
||||
const title = psqlScalar(`select title from public.sessions where id = ${sqlQuote(session)}`);
|
||||
|
||||
psql(`insert into public.contacts (email, full_name, is_admin)
|
||||
values (${sqlQuote(email)}, 'Pending Pill Speaker', false)
|
||||
on conflict (email) do update set full_name = excluded.full_name`);
|
||||
psql(`insert into public.registrations (event_id, contact_email, type, checked_in, points, qr_token)
|
||||
values (${sqlQuote(EVENT_ID)}, ${sqlQuote(email)}, 'speaker', true, 0, ${sqlQuote(token)})
|
||||
on conflict (event_id, contact_email)
|
||||
do update set type = 'speaker', checked_in = true, qr_token = excluded.qr_token`);
|
||||
psql(`insert into public.session_speakers (session_id, contact_email)
|
||||
values (${sqlQuote(session)}, ${sqlQuote(email)}) on conflict do nothing`);
|
||||
// Auth user, password = QR token (same trick ensureSponsor uses).
|
||||
psql(`insert into auth.users (instance_id, id, aud, role, email, encrypted_password, email_confirmed_at,
|
||||
confirmation_token, email_change_token_new, email_change, recovery_token, reauthentication_token,
|
||||
phone_change_token, raw_app_meta_data, raw_user_meta_data, created_at, updated_at)
|
||||
values ('00000000-0000-0000-0000-000000000000', gen_random_uuid(), 'authenticated', 'authenticated',
|
||||
${sqlQuote(email)}, extensions.crypt(${sqlQuote(token)}, extensions.gen_salt('bf')), now(),
|
||||
'', '', '', '', '', '', '{\"provider\":\"email\",\"providers\":[\"email\"]}', '{}', now(), now())
|
||||
on conflict (email) where is_sso_user = false do update
|
||||
set encrypted_password = extensions.crypt(${sqlQuote(token)}, extensions.gen_salt('bf'))`);
|
||||
|
||||
try {
|
||||
const app = new AppPage(page, APP_URL);
|
||||
const home = new HomePage(page);
|
||||
await login(page, APP_URL, { email, qrToken: token, type: 'speaker' } as Identity);
|
||||
await app.waitForAdmitted();
|
||||
|
||||
// Red clip -> the pending-material sheet, listing this session.
|
||||
await expect(home.materialPill()).toBeVisible();
|
||||
await home.materialPill().click();
|
||||
await expect(page.getByText('Pending material')).toBeVisible();
|
||||
|
||||
// Clicking the session opens THAT session's detail sheet with the upload
|
||||
// form in place — not the Agenda tab, which used to drop the speaker there
|
||||
// and make them hunt for the talk they were just told about.
|
||||
await page.locator('.pick-chip').filter({ hasText: title }).click();
|
||||
await expect(page.getByTestId('material-upload-notice')).toBeVisible();
|
||||
await expect(page.getByTestId('material-upload')).toBeVisible();
|
||||
// Still on Home: the sheet opened over it, the tab bar never moved.
|
||||
await expect(page.getByTestId('tab-home')).toHaveClass(/active/);
|
||||
} finally {
|
||||
psql(`delete from public.session_speakers where contact_email = ${sqlQuote(email)}`);
|
||||
psql(`delete from public.registrations where contact_email = ${sqlQuote(email)}`);
|
||||
psql(`delete from public.contacts where email = ${sqlQuote(email)}`);
|
||||
psql(`delete from auth.users where email = ${sqlQuote(email)}`);
|
||||
}
|
||||
});
|
||||
|
||||
test('CONV-MATERIAL-002 speaker uploads material and it persists across reload', async ({ page }) => {
|
||||
const app = new AppPage(page, APP_URL);
|
||||
const agenda = new AgendaPage(page);
|
||||
|
||||
Reference in new issue
Block a user