Acceptance test
| Test ID | Action | Expected Result |
|---|---|---|
| 1 | Verify backend health check 1. Follow steps in the backend README to start the FastAPI server 2. Navigate to http://localhost:8000/ in a browser(If port 8000 is in use, adjust to the correct port) | JSON response is displayed: {"status": "ok", "message": "AutoSuggestion Quiz API is running"} |
| 2 | Teacher Login via OTP 1. Have the backend running 2. Clone the frontend repo and install npm packages 3. Run the frontend ( npm start)4. On the Login page, click the "Teacher" toggle in the top-right corner 5. Enter a valid teacher email address 6. Click "Send Code" 7. Enter the 6-digit OTP received in the email 8. Click "Verify" | Teacher is authenticated and redirected to the Teacher Dashboard. JWT token is stored in localStorage. |
| 3 | Teacher session persists on page refresh 1. Log in as a teacher (see Test 2) 2. Refresh the browser page | Teacher is still authenticated and the Teacher Dashboard loads without redirecting to the Login page. |
| 4 | Teacher Logout 1. Log in as a teacher (see Test 2) 2. Click the "Logout" button on the Teacher Dashboard | User is redirected to the Login page. JWT token is removed from localStorage. Returning to the app does not restore the session. |
| 5 | Student login with valid 6-digit access code 1. Have the backend running 2. Log in as a teacher and complete problem creation (see Tests 7–10) 3. Copy the 6-digit access code from the Share modal on the Dashboard 4. Log out and return to the Login page (or open the app in a separate browser/incognito window) 5. Ensure the Student view is active (default) 6. Enter a name in the "Your Name" field 7. Enter the 6-digit access code provided by the teacher in the "Problem Key" field 8. Click "Start Quiz" | Student is routed directly to the Problem Page for the matching problem. No JWT is required — student session is name + problem only. |
| 6 | Student login with invalid access code 1. Launch the frontend 2. Enter any name 3. Enter a 6-digit code that does not match any existing problem 4. Click "Start Quiz" | Error message is displayed: "No problem found with that code. Please check with your teacher and try again." User remains on the Login page. |
| 7 | Teacher creates a problem — Step 1: Details 1. Log in as a teacher 2. On the Dashboard, click "Create Problem" 3. On Step 1 (Details), enter a title and description 4. Click "Next" | Step 2 (Languages) becomes visible. No error messages are shown. |
| 8 | Teacher creates a problem — Step 2: Languages 1. Continue from Test 7 2. On Step 2 (Languages), select one or more supported languages (e.g. Python, JavaScript) 3. Click "Next" | Step 3 (Sections) becomes visible. Selected languages are saved for the problem. |
| 9 | Teacher creates a problem — Step 3: Sections 1. Continue from Test 8 2. On Step 3 (Sections), add at least one section with a label and starter code 3. Add at least one manual suggestion and mark it as correct 4. Click "Next" | Step 4 (Settings) becomes visible. Section and suggestion data are retained. |
| 10 | Teacher creates a problem — Step 4: Settings and submit 1. Continue from Test 9 2. On Step 4 (Settings), optionally set a time limit and max submissions 3. Toggle "Allow Copy/Paste" and "Track Tab Switching" as desired 4. Click "Create Problem" | Problem is saved to the database. Teacher is redirected to the Dashboard. New problem card appears with the correct title and a unique 6-digit access code. |
| 11 | Teacher attempts to create a problem with missing required fields 1. Log in as a teacher 2. Click "Create Problem" 3. Leave the title blank on Step 1 4. Click "Next" | Validation error is displayed indicating the title is required. User cannot advance to Step 2 until the title is filled in. |
| 12 | Teacher Dashboard displays all created problems 1. Log in as a teacher who has created at least two problems 2. Observe the Dashboard problem list | All problems created by the authenticated teacher are listed. Each card shows the problem title, access code, language(s), and submission count. |
| 13 | Teacher views and copies access code via Share modal 1. Log in as a teacher 2. Click the Share button on any problem card | Modal opens displaying the 6-digit student access code. Clicking "Copy" copies the code to the clipboard and briefly shows a "✓ Copied" confirmation. |
| 14 | Teacher edits an existing problem 1. Log in as a teacher 2. Click the Edit button on a problem card 3. Update the title, description, time limit, or settings 4. Click "Save" | Changes are saved to the database and immediately reflected on the Dashboard problem card. |
| 15 | Teacher deletes a problem 1. Log in as a teacher 2. Click the Delete button on a problem card 3. Confirm deletion in the modal | Problem is removed from the database. Problem card no longer appears on the Dashboard. All associated student submissions are also removed. |
| 16 | Teacher cancels deletion 1. Log in as a teacher 2. Click the Delete button on a problem card 3. Click "Cancel" in the Delete confirmation modal | Modal closes without deleting the problem. Problem card remains on the Dashboard. |
| 17 | Teacher views student submission results 1. Log in as a teacher 2. Ensure at least one student has submitted a quiz for a problem 3. Expand the submissions section of the problem card | Each submission displays student name, submission time, score, total, and calculated grade percentage. |
| 18 | Teacher manually grades a student submission 1. Log in as a teacher 2. Locate a student submission on the Dashboard 3. Enter a grade value (0–100) in the grade input 4. Submit the grade | Grade is saved and displayed next to the submission. Backend returns the updated session_id and grade value. |
| 19 | Student accesses a problem and sees the code editor 1. Have the backend running 2. Ensure a teacher has already created a problem and shared the 6-digit access code (see Tests 7–10 and Test 13) 3. Log in as a student using that access code | Problem Page loads with the Monaco editor pre-populated with the problem's starter code. Problem title and description are visible. Language is set to the problem's primary language. |
| 20 | Student receives AI-powered code suggestions (Online mode) 1. Have the backend running with a valid AI API key configured in .env2. Ensure a teacher has already created a problem and shared the 6-digit access code (see Tests 7–10 and Test 13) 3. Log in as a student and open the problem 4. Begin typing in the code editor and pause briefly to trigger the idle timer | Autocomplete suggestions appear in the Monaco editor dropdown. Each suggestion includes an explanation and is contextually relevant to the current code and problem description. |
| 21 | Student runs code using Pyodide (Offline mode — Python) 1. Ensure a teacher has already created a problem that supports Python and shared the access code (see Tests 7–10 and Test 13) 2. Log in as a student and open the problem 3. Write valid Python code in the editor 4. Click the "Run" button | Code executes in-browser via Pyodide with no network call to the backend. The Output tab displays the result. No backend connection is required for this step. |
| 22 | Student views suggestion log 1. Ensure a teacher has already created a problem and shared the access code (see Tests 7–10 and Test 13) 2. Log in as a student and open the problem 3. Trigger at least one AI suggestion by typing in the editor 4. Click the "Suggestions" tab | The Suggestions tab displays a log of all AI suggestions shown during the session, including suggestion text and explanation for each entry. |
| 23 | Student submits a completed quiz 1. Ensure a teacher has already created a problem and shared the access code (see Tests 7–10 and Test 13) 2. Log in as a student and open the problem 3. Complete the quiz questions or code sections 4. Click "Submit" | Quiz attempt is saved via POST /quiz/submit. Score and total are calculated and returned. A confirmation or results screen is displayed to the student. |
| 24 | Correct and incorrect answers are scored accurately 1. Ensure a teacher has already created a problem and shared the access code (see Tests 7–10 and Test 13) 2. Log in as a student 3. Intentionally answer some questions correctly and some incorrectly 4. Submit the quiz | Score reflects only correctly answered questions. Total reflects the full number of questions. Returned score and total match the submitted answers. |
| 25 | Student cannot view another student's quiz attempts 1. Submit a quiz as Student A (see Test 23) 2. Call GET /quiz/attempts/{student_A_id} using Student B's JWT token | API returns 403 Forbidden with detail: "Students can only view their own attempts" |
| 26 | Teacher can view any student's quiz attempts 1. Ensure at least one student has submitted a quiz (see Test 23) 2. Log in as a teacher 3. Call GET /quiz/attempts/{student_id} using the teacher's JWT token | API returns 200 with the full list of that student's quiz attempts including score, total, language, and submission timestamp for each. |
| 27 | View detailed quiz attempt with individual answer breakdown 1. Ensure at least one quiz attempt exists (see Test 23) 2. Log in as a teacher or the owning student 3. Call GET /quiz/attempt/{attempt_id} with a valid JWT | API returns 200 with the attempt record including individual answers — each with question_index, selected_option, and is_correct. |