-
Notifications
You must be signed in to change notification settings - Fork 1
Proctoring‐Engine
Veerendra Kumar edited this page Jun 5, 2026
·
1 revision
The proctoring system monitors client behavior during mock test assessments to ensure exam integrity.
The client-side proctoring engine monitors page visibility using HTML5 event listeners:
useEffect(() => {
const handleBlur = async () => {
if (!mockTest || mockTest.status !== 'active') return;
try {
const res = await mockTestService.recordMockTestViolation(mockTest._id);
setWarningCount(res.tabSwitchesCount);
if (res.autoSubmitted) {
alert('Test auto-submitted. Focus proctor constraint violation limit reached (3 shifts).');
navigate(`/mocktest/result/${mockTest._id}`);
} else {
setShowWarningModal(true); // Show warning modal block overlay
}
} catch (err) {
console.error(err);
}
};
window.addEventListener('blur', handleBlur);
return () => window.removeEventListener('blur', handleBlur);
}, [mockTest]);