JezK
Edit File: test_instructions.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Test Instructions Page</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <style> body { padding: 2rem; background-color: #f8f9fa; } .test-section { background: white; border-radius: 10px; padding: 2rem; margin-bottom: 2rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); } </style> </head> <body> <div class="container"> <h1 class="mb-4">Test Instructions Page</h1> <div class="test-section"> <h3>Test Instructions Page Access</h3> <p>This test will help you verify that the instructions page works correctly.</p> <div class="mb-3"> <label for="quizId" class="form-label">Quiz ID:</label> <input type="number" class="form-control" id="quizId" value="1" style="width: 200px;"> </div> <a href="#" class="btn btn-primary" onclick="testInstructions()">Test Instructions Page</a> </div> <div class="test-section"> <h3>Test Dashboard Flow</h3> <p>Test the complete flow from dashboard to instructions to exam.</p> <a href="student/dashboard.php" class="btn btn-secondary" target="_blank">Open Dashboard</a> </div> <div class="test-section"> <h3>Test Direct Instructions Access</h3> <p>Test accessing instructions page directly with different quiz IDs.</p> <div class="mb-3"> <label for="directQuizId" class="form-label">Quiz ID for Direct Access:</label> <input type="number" class="form-control" id="directQuizId" value="1" style="width: 200px;"> </div> <a href="#" class="btn btn-info" onclick="testDirectAccess()">Test Direct Access</a> </div> <div class="test-section"> <h3>API Endpoints</h3> <p>Test the API endpoints used by the instructions page.</p> <button class="btn btn-warning" onclick="testAssignQuiz()">Test Assign Quiz API</button> <button class="btn btn-success" onclick="testMarkInstructionsSeen()">Test Mark Instructions Seen API</button> </div> </div> <script> function testInstructions() { const quizId = document.getElementById('quizId').value; window.open(`student/exam_instructions.php?id=${quizId}`, '_blank'); } function testDirectAccess() { const quizId = document.getElementById('directQuizId').value; window.open(`student/exam_instructions.php?id=${quizId}`, '_blank'); } function testAssignQuiz() { const quizId = document.getElementById('quizId').value; fetch('api/assign_quiz.php', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ quiz_id: parseInt(quizId) }) }) .then(response => response.json()) .then(data => { alert('Assign Quiz API Response: ' + JSON.stringify(data, null, 2)); }) .catch(error => { alert('Error: ' + error.message); }); } function testMarkInstructionsSeen() { const quizId = document.getElementById('quizId').value; fetch('api/mark_instructions_seen.php', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ quiz_id: parseInt(quizId) }) }) .then(response => response.json()) .then(data => { alert('Mark Instructions Seen API Response: ' + JSON.stringify(data, null, 2)); }) .catch(error => { alert('Error: ' + error.message); }); } </script> </body> </html>