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:
1 parent
f32289f583
commit
84691de6ee
27 files changed
+1215
-60
No files matched your search
@@ -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++;
|
||||
|
||||
Reference in new issue
Block a user