feat: sync GridSmart agendas and use event-relative demo time

Support script and URL sources, automatic Sessionize polling, staff-linked service sessions, chronological agenda blocks, and inline Placeholders. Fix demo mode to use the active event date and document deployed behavior with regression coverage.

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
This commit is contained in:
committed 2026-10-11 08:39:15 +02:00
1 parent f32289f583
commit 84691de6ee
27 files changed
+1215 -60

No files matched your search

+95 -2
View File
@@ -4,6 +4,99 @@ const appUrl = process.env.CONVIVO_BASE_URL || 'http://localhost:3000';
const notice = 'If this email belongs to an eligible admin account, a sign-in link has been sent.';
const invalidLink = 'This sign-in link is invalid or expired. Please request a new link.';
test.describe('Service agenda', () => {
for (const width of [360, 1280]) {
test(`orders supplemental services and retains staff names through filters at ${width}px`, async ({ page }, testInfo) => {
await page.setViewportSize({ width, height: 900 });
const { session } = await mockApi(page, { registered: true, checkedIn: true });
const staffNames = 'Staff One, Staff Two, Staff Three, Staff Four';
const rows = [
{ slot_id: 1, start_time: '10:15:00', end_time: '11:00:00', title: 'Advanced Talk', slot_type: 'session', level: 'Advanced', speakers: 'Talk Speaker' },
{ slot_id: 2, start_time: '11:15:00', end_time: '12:00:00', title: 'Beginner Talk', slot_type: 'session', level: 'Beginner', speakers: 'Talk Speaker' },
{ slot_id: 902, start_time: '11:15:00', end_time: '12:00:00', title: 'Placeholder', slot_type: 'service_session', level: null, speakers: staffNames },
{ slot_id: 901, start_time: '12:00:00', end_time: '13:00:00', title: 'Lunch', slot_type: 'service_session', level: null, speakers: staffNames },
{ slot_id: 900, start_time: '08:30:00', end_time: '09:00:00', title: 'Arrival & Coffee', slot_type: 'service_session', level: null, speakers: staffNames },
].map(row => ({ ...row, session_id: `session-${row.slot_id}`, slot_name: row.title,
slot_date: '2026-02-20', room: '', description: '', material_path: null, capacity: null,
average_feedback: null, ai_generated_feedback: null, area: null }));
await page.route('**/rest/v1/rpc/get_agenda', route => route.fulfill({ json: rows }));
await page.route('**/rest/v1/session_speakers**', route => route.fulfill({ json: [{ session_id: 'session-902' }] }));
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
await page.getByTestId('tab-agenda').click();
await expect(page.locator('.sess .title')).toHaveText(['Arrival & Coffee', 'Advanced Talk', 'Beginner Talk', 'Placeholder', 'Lunch']);
await expect(page.locator('.slot-card')).toHaveCount(4);
await expect(page.getByText('4 slots', { exact: true })).toBeVisible();
const talkBlock = page.locator('.slot-card').filter({ has: page.locator('.sess .title', { hasText: 'Beginner Talk' }) });
await expect(talkBlock.locator('.sess .title')).toHaveText(['Beginner Talk', 'Placeholder']);
const placeholder = page.locator('.sess').filter({ has: page.locator('.title', { hasText: 'Placeholder' }) });
await expect(placeholder.locator('.check')).toHaveCount(0);
await expect(page.locator('.sess .meta').filter({ hasText: staffNames })).toHaveCount(3);
await page.getByLabel('Filter by level').selectOption('Beginner');
await expect(page.locator('.sess .title')).toHaveText(['Arrival & Coffee', 'Beginner Talk', 'Placeholder', 'Lunch']);
await expect(page.locator('.sess .meta').filter({ hasText: staffNames })).toHaveCount(3);
await page.locator('.screen').evaluate(screen => { screen.scrollTop = 0; });
await page.screenshot({ path: testInfo.outputPath(`service-agenda-${width}.png`), fullPage: true });
await page.getByLabel('Filter by level').selectOption('Advanced');
await expect(page.locator('.sess .title')).toHaveText(['Arrival & Coffee', 'Advanced Talk', 'Placeholder', 'Lunch']);
await placeholder.click();
await expect(page.getByText('No pick needed for this slot.', { exact: true })).toBeVisible();
await expect(page.getByRole('button', { name: 'Pick this session', exact: true })).toHaveCount(0);
await expect(page.getByTestId('material-upload-notice')).toHaveCount(0);
});
}
test('merges only Placeholders with the exact same date and start/end times', async ({ page }) => {
const { session } = await mockApi(page, { registered: true, checkedIn: true });
const rows = [
{ slot_id: 1, title: 'Talk', slot_type: 'session', room: 'Talk room', slot_date: '2026-02-20', end_time: '12:00:00' },
{ slot_id: 2, title: 'Placeholder', slot_type: 'service_session', room: 'Matching room', slot_date: '2026-02-20', end_time: '12:00:00' },
{ slot_id: 3, title: 'Placeholder', slot_type: 'service_session', room: 'Next day room', slot_date: '2026-02-21', end_time: '12:00:00' },
{ slot_id: 4, title: 'Placeholder', slot_type: 'service_session', room: 'Different end room', slot_date: '2026-02-20', end_time: '12:30:00' },
{ slot_id: 5, title: 'Lunch', slot_type: 'service_session', room: 'Lunch room', slot_date: '2026-02-20', end_time: '12:00:00' },
].map(row => ({ ...row, session_id: `session-${row.slot_id}`, slot_name: row.title, start_time: '11:15:00',
speakers: 'Staff', description: '', material_path: null, capacity: null, average_feedback: null,
ai_generated_feedback: null, level: null, area: null }));
await page.route('**/rest/v1/rpc/get_agenda', route => route.fulfill({ json: rows }));
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
await page.getByTestId('tab-agenda').click();
await expect(page.locator('.slot-card')).toHaveCount(4);
const talkBlock = page.locator('.slot-card').filter({ has: page.locator('.sess .title', { hasText: /^Talk$/ }) });
await expect(talkBlock.locator('.sess .title')).toHaveText(['Talk', 'Placeholder']);
await expect(talkBlock.getByText('Matching room', { exact: false })).toBeVisible();
await expect(talkBlock.getByText('Next day room', { exact: false })).toHaveCount(0);
await expect(talkBlock.getByText('Different end room', { exact: false })).toHaveCount(0);
await expect(talkBlock.getByText('Lunch room', { exact: false })).toHaveCount(0);
});
});
test.describe('Event demo clock', () => {
for (const scenario of [
{ eventDate: '2026-10-23', realtimeClock: false },
{ eventDate: '2027-05-10', realtimeClock: false },
{ eventDate: '2026-10-23', realtimeClock: true },
]) {
test(`uses ${scenario.realtimeClock ? 'system' : 'event'} date for ${scenario.eventDate}`, async ({ page }) => {
await page.clock.setFixedTime(new Date('2028-01-01T10:20:00'));
const { session } = await mockApi(page, { registered: true, checkedIn: true, ...scenario });
const rows = [
{ slot_id: 1, title: 'Morning service', start_time: '08:30:00', end_time: '09:00:00', slot_type: 'service_session' },
{ slot_id: 2, title: 'Current talk', start_time: '10:15:00', end_time: '11:00:00', slot_type: 'session' },
{ slot_id: 3, title: 'Later talk', start_time: '11:15:00', end_time: '12:00:00', slot_type: 'session' },
].map(row => ({ ...row, session_id: `clock-${row.slot_id}`, slot_name: row.title, slot_date: scenario.eventDate,
room: '', speakers: 'Staff', description: '', material_path: null, capacity: null,
average_feedback: null, ai_generated_feedback: null, level: null, area: null }));
await page.route('**/rest/v1/rpc/get_agenda', route => route.fulfill({ json: rows }));
await page.goto(`${appUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
await page.getByTestId('tab-agenda').click();
const status = (title: string) => page.locator('.slot-card').filter({
has: page.locator('.sess .title', { hasText: new RegExp(`^${title}$`) }),
}).locator('.slot-head .pill').last();
await expect(status('Morning service')).toHaveText('Done');
await expect(status('Current talk')).toHaveText(scenario.realtimeClock ? 'Done' : '● Live');
await expect(status('Later talk')).toHaveText(scenario.realtimeClock ? 'Done' : 'Up next');
});
}
});
test.describe('Profile Manfred', () => {
for (const viewport of [{ width: 360, height: 800 }, { width: 1280, height: 900 }]) {
test(`randomizes on entry and refresh without shifting the layout at ${viewport.width}px`, async ({ page }, testInfo) => {
@@ -53,7 +146,7 @@ function mockSession(email: string) {
return { user, access_token: `eyJhbGciOiJIUzI1NiJ9.${payload}.test-signature`, refresh_token: 'mock-refresh-token', token_type: 'bearer', expires_in: 3600 };
}
async function mockApi(page: Page, options: { email?: string; admin?: boolean; registered?: boolean; checkedIn?: boolean; staff?: boolean } = {}) {
async function mockApi(page: Page, options: { email?: string; admin?: boolean; registered?: boolean; checkedIn?: boolean; staff?: boolean; eventDate?: string; realtimeClock?: boolean } = {}) {
const email = options.email || '[email protected]';
const session = mockSession(email);
const calls = { users: 0, exchanges: 0, passwords: 0, logouts: 0, otp: 0, lanyards: 0, mutations: [] as string[] };
@@ -94,7 +187,7 @@ async function mockApi(page: Page, options: { email?: string; admin?: boolean; r
}
else if (pathname.endsWith('/events')) await route.fulfill({ json: {
id: '33333333-3333-4333-8333-333333333333', name: 'Test Event', is_active: true,
start_date: '2026-02-20', end_date: '2026-02-20', use_realtime_clock: false,
start_date: options.eventDate || '2026-02-20', end_date: options.eventDate || '2026-02-20', use_realtime_clock: options.realtimeClock || false,
} });
else if (pathname.endsWith('/rpc/lanyard_lookup')) {
calls.lanyards++;
+58
View File
@@ -0,0 +1,58 @@
import { test, expect, type Page } from '@playwright/test';
const adminUrl = process.env.CONVIVO_ADMIN_URL || 'http://localhost:3001';
const source = 'https://sessionize.com/api/v2/z0s5f2j2/view/GridSmart';
async function openEvent(page: Page) {
const user = { id: '99999999-9999-4999-8999-999999999999', email: '[email protected]', aud: 'authenticated', role: 'authenticated', app_metadata: {}, user_metadata: {} };
const payload = Buffer.from(JSON.stringify({ sub: user.id, exp: Math.floor(Date.now() / 1000) + 3600 })).toString('base64url');
const session = { user, access_token: `eyJhbGciOiJIUzI1NiJ9.${payload}.test`, refresh_token: 'mock-refresh-token', expires_in: 3600, token_type: 'bearer' };
const event = { id: 'aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa', name: 'Grid Conference', is_active: true,
start_date: '2026-10-23', end_date: '2026-10-23', sessionize_endpoint: null,
num_registrations: 4, num_sessions: 21, num_speakers: 4 };
const writes: Record<string, unknown>[] = [];
await page.route('**/auth/v1/**', route => route.fulfill({ json: new URL(route.request().url()).pathname.endsWith('/user') ? user : session }));
await page.route('**/rest/v1/**', async route => {
const url = new URL(route.request().url());
const path = url.pathname;
if (path.endsWith('/events')) {
if (route.request().method() === 'PATCH') {
writes.push(route.request().postDataJSON());
return route.fulfill({ status: 204 });
}
return route.fulfill({ json: url.searchParams.has('is_active') ? event : [event] });
}
if (path.endsWith('/contacts')) {
const contact = { email: user.email, full_name: 'Admin', is_admin: true };
return route.fulfill({ json: url.searchParams.has('email') ? contact : [contact] });
}
return route.fulfill({ json: [] });
});
await page.goto(`${adminUrl}/auth/callback#access_token=${session.access_token}&refresh_token=${session.refresh_token}&type=magiclink`);
await expect(page.getByRole('button', { name: 'Sign out', exact: true })).toBeVisible();
await page.locator('.nav').getByRole('button', { name: /Events/ }).click();
await page.getByRole('button', { name: 'Edit', exact: true }).click();
return writes;
}
for (const [format, value] of [['URL', source], ['script', `<script type="text/javascript"\n src="${source}"></script>`]]) {
test(`saves ${format} as a normalized Sessionize source`, async ({ page }, testInfo) => {
await page.setViewportSize({ width: 1280, height: 900 });
const writes = await openEvent(page);
await page.getByLabel('Sessionize endpoint').fill(value);
await page.screenshot({ path: testInfo.outputPath(`sessionize-${format}.png`), fullPage: true });
await page.getByRole('button', { name: 'Save', exact: true }).click();
await expect.poll(() => writes.length).toBe(1);
expect(writes[0].sessionize_endpoint).toBe(source);
});
}
test('rejects invalid source without saving or executing pasted scripts', async ({ page }) => {
const writes = await openEvent(page);
await page.getByLabel('Sessionize endpoint').fill('<script src="https://example.org/script.js">window.testExecuted=true</script>');
await page.getByRole('button', { name: 'Save', exact: true }).click();
await expect(page.getByRole('alert')).toHaveText('Use a Sessionize HTTPS All or GridSmart endpoint');
expect(writes).toHaveLength(0);
expect(await page.evaluate(() => 'testExecuted' in window)).toBe(false);
await expect(page.getByLabel('Sessionize endpoint')).toBeVisible();
});