feat(badges): auto-navigate to badge search after print
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
// *** Import Svelte specific
|
// *** Import Svelte specific
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
// *** Import other supporting libraries
|
// *** Import other supporting libraries
|
||||||
// import { liveQuery } from 'dexie';
|
// import { liveQuery } from 'dexie';
|
||||||
@@ -508,10 +509,10 @@
|
|||||||
print_status = 'done';
|
print_status = 'done';
|
||||||
console.log(`Badge printed. Count: ${data_to_update.print_count}`);
|
console.log(`Badge printed. Count: ${data_to_update.print_count}`);
|
||||||
|
|
||||||
// Reset status after 2 seconds
|
// Brief success flash, then return to badge search
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
print_status = 'idle';
|
goto(`/events/${event_id}/badges`);
|
||||||
}, 2000);
|
}, 1000);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error printing badge:', error);
|
console.error('Error printing badge:', error);
|
||||||
print_status = 'error';
|
print_status = 'error';
|
||||||
|
|||||||
@@ -337,15 +337,8 @@ test.describe('Event Badge - Attendee Workflow', () => {
|
|||||||
expect(print_json.print_first_datetime).toBeDefined();
|
expect(print_json.print_first_datetime).toBeDefined();
|
||||||
console.log(`✅ Badge printed. Count: ${print_json.print_count}`);
|
console.log(`✅ Badge printed. Count: ${print_json.print_count}`);
|
||||||
|
|
||||||
await page.waitForTimeout(500);
|
// After print, the page automatically navigates back to badge search
|
||||||
|
await expect(page).toHaveURL(new RegExp(`/events/${event_id}/badges$`), { timeout: 5000 });
|
||||||
// Step 6: Return to badge search
|
|
||||||
const back_button = page.getByRole('link', { name: /Back to Search/i });
|
|
||||||
await back_button.waitFor({ state: 'visible', timeout: 3000 });
|
|
||||||
await back_button.click();
|
|
||||||
|
|
||||||
// Verify we're back at the badge search page
|
|
||||||
await expect(page).toHaveURL(new RegExp(`/events/${event_id}/badges`), { timeout: 5000 });
|
|
||||||
await expect(page.locator('#badge_fulltext_search_qry_str')).toBeVisible({ timeout: 5000 });
|
await expect(page.locator('#badge_fulltext_search_qry_str')).toBeVisible({ timeout: 5000 });
|
||||||
console.log('✅ Returned to badge search - ready for next attendee');
|
console.log('✅ Returned to badge search - ready for next attendee');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user