# Job Verification Frontend Flow Tests

This document contains comprehensive end-to-end tests for the job verification system, covering all major flows and functionality.

## Table of Contents

1. [Authentication Tests](#authentication-tests)
2. [Job Creation Tests](#job-creation-tests)
3. [Candidate Job List Tests](#candidate-job-list-tests)
4. [Job Verification Tests](#job-verification-tests)
   - [OTP Verification Tests](#otp-verification-tests)
   - [QR Code Verification Tests](#qr-code-verification-tests)
   - [Face ID Verification Tests](#face-id-verification-tests)
5. [Partner Verification Tests](#partner-verification-tests)
6. [Security Tests](#security-tests)

## Authentication Tests

### Test: Candidate Standard Login

**Given** a candidate with valid credentials
**When** they navigate to "testing.reco-logocloud.com/login"
**And** enter their email and password
**And** click the login button
**Then** they should be successfully authenticated
**And** redirected to the candidate dashboard

### Test: Candidate Invalid Login

**Given** a candidate with invalid credentials
**When** they navigate to "testing.reco-logocloud.com/login"
**And** enter incorrect email or password
**And** click the login button
**Then** they should see an error message
**And** remain on the login page

### Test: Candidate Face Recognition Login

**Given** a candidate with enrolled face data
**When** they navigate to "testing.reco-logocloud.com/login"
**And** click "Login with Face Recognition"
**And** allow camera access
**And** position their face for scanning
**Then** they should be successfully authenticated
**And** redirected to the candidate dashboard

### Test: Face Recognition Login Failure

**Given** a candidate without enrolled face data or with unrecognizable face
**When** they navigate to "testing.reco-logocloud.com/login"
**And** click "Login with Face Recognition"
**And** allow camera access
**And** position their face for scanning
**Then** they should see an error message
**And** be offered the option to login with credentials

## Job Creation Tests

### Test: Partner Creates New Job

**Given** a partner is logged into their dashboard
**When** they navigate to the "Create Job" section
**And** fill in all required job details:
  - Job title
  - Description
  - Location
  - Date and time slots
  - Required skills
  - Compensation
**And** click "Publish Job"
**Then** the job should be created successfully
**And** appear in the partner's job listings
**And** be available for candidates to view

### Test: Partner Creates Job with Missing Fields

**Given** a partner is logged into their dashboard
**When** they navigate to the "Create Job" section
**And** omit required fields
**And** click "Publish Job"
**Then** they should see validation errors
**And** the job should not be created

## Candidate Job List Tests

### Test: Candidate Views Job List

**Given** a candidate is logged into their dashboard
**When** they navigate to the job list page
**Then** they should see a list of available jobs
**And** each job should display relevant details (title, location, date, time)

### Test: Candidate Filters Jobs by Date

**Given** a candidate is on the job list page
**When** they select a start date and end date
**And** click the "Apply" filter button
**Then** the job list should update
**And** only show jobs within the selected date range

### Test: Candidate Switches Between Grid and List View

**Given** a candidate is on the job list page
**When** they click the grid view button
**Then** jobs should display in grid format
**When** they click the list view button
**Then** jobs should display in list format with more details

### Test: Candidate Pagination

**Given** a candidate has more than one page of jobs
**When** they navigate to the job list page
**Then** they should see pagination controls
**When** they click on page 2
**Then** they should see the second page of job listings

## Job Verification Tests

### OTP Verification Tests

### Test: Candidate Requests Entry OTP

**Given** a candidate is logged in
**And** has an approved job within the valid time window
**When** they navigate to the job list
**And** click the "Entry OTP" button for a specific job
**Then** an OTP should be generated
**And** displayed to the candidate
**And** stored in the database

### Test: Candidate Requests Exit OTP

**Given** a candidate is logged in
**And** has already clocked in for a job
**And** is within the valid exit time window
**When** they navigate to the job list
**And** click the "Exit OTP" button for a specific job
**Then** an OTP should be generated
**And** displayed to the candidate
**And** stored in the database

### Test: Candidate Requests OTP Outside Time Window

**Given** a candidate is logged in
**And** has an approved job outside the valid time window
**When** they navigate to the job list
**Then** the "Entry OTP" button should be disabled or not visible

### QR Code Verification Tests

### Test: Candidate Generates Entry QR Code

**Given** a candidate is logged in
**And** has an approved job within the valid time window
**When** they navigate to the job list
**And** click the "Entry QR" button for a specific job
**Then** a QR code should be generated
**And** displayed in a modal
**And** contain encrypted job verification data

### Test: Candidate Generates Exit QR Code

**Given** a candidate is logged in
**And** has already clocked in for a job
**And** is within the valid exit time window
**When** they navigate to the job list
**And** click the "Exit QR" button for a specific job
**Then** a QR code should be generated
**And** displayed in a modal
**And** contain encrypted job verification data

### Test: Candidate Generates QR Code Outside Time Window

**Given** a candidate is logged in
**And** has an approved job outside the valid time window
**When** they navigate to the job list
**Then** the "Entry QR" button should be disabled or not visible

### Face ID Verification Tests

### Test: Candidate Face Enrollment

**Given** a candidate is logged in
**And** has not enrolled their face
**When** they navigate to the face enrollment page
**And** allow camera access
**And** follow the prompts to capture 5 face images
**And** submit the enrollment
**Then** their face data should be processed and stored
**And** they should see a success message

### Test: Candidate Face Verification for Entry

**Given** a candidate is logged in
**And** has enrolled their face
**And** has an approved job within the valid time window
**When** they navigate to the job list
**And** click the "Entry Face" button for a specific job
**And** allow camera access
**And** position their face for scanning
**Then** their identity should be verified
**And** their entry should be recorded
**And** they should see a success message

### Test: Candidate Face Verification for Exit

**Given** a candidate is logged in
**And** has enrolled their face
**And** has already clocked in for a job
**And** is within the valid exit time window
**When** they navigate to the job list
**And** click the "Exit Face" button for a specific job
**And** allow camera access
**And** position their face for scanning
**Then** their identity should be verified
**And** their exit should be recorded
**And** they should see a success message

### Test: Candidate Face Verification with Wrong Face

**Given** a candidate is logged in
**And** has enrolled their face
**And** has an approved job within the valid time window
**When** they navigate to the job list
**And** click the "Entry Face" button for a specific job
**And** allow camera access
**And** a different person positions their face for scanning
**Then** the verification should fail
**And** they should see an error message

## Partner Verification Tests

### Test: Partner Verifies Job Entry with Job ID

**Given** a partner is logged in
**And** a candidate has a job ID for entry verification
**When** the partner navigates to the job verification page
**And** enters the job ID
**And** clicks "Verify"
**Then** the candidate and job details should be displayed
**When** the partner clicks "Confirm"
**Then** the entry should be recorded
**And** the partner should see a success message

### Test: Partner Verifies Job Exit with Job ID

**Given** a partner is logged in
**And** a candidate has already clocked in
**And** has a job ID for exit verification
**When** the partner navigates to the job verification page
**And** enters the job ID
**And** clicks "Verify"
**Then** the candidate and job details should be displayed
**When** the partner clicks "Confirm"
**Then** the exit should be recorded
**And** the partner should see a success message

### Test: Partner Verifies Job Entry with OTP

**Given** a partner is logged in
**And** a candidate has generated an OTP for entry verification
**When** the partner navigates to the job verification page
**And** enters the OTP
**And** clicks "Verify"
**Then** the candidate and job details should be displayed
**When** the partner clicks "Confirm"
**Then** the entry should be recorded
**And** the partner should see a success message

### Test: Partner Verifies Job Exit with OTP

**Given** a partner is logged in
**And** a candidate has already clocked in
**And** has generated an OTP for exit verification
**When** the partner navigates to the job verification page
**And** enters the OTP
**And** clicks "Verify"
**Then** the candidate and job details should be displayed
**When** the partner clicks "Confirm"
**Then** the exit should be recorded
**And** the partner should see a success message

### Test: Partner Scans QR Code for Entry Verification

**Given** a partner is logged in
**And** a candidate has generated a QR code for entry verification
**When** the partner navigates to the job verification page
**And** scans the QR code
**Then** the candidate and job details should be displayed
**When** the partner clicks "Confirm"
**Then** the entry should be recorded
**And** the partner should see a success message

### Test: Partner Scans QR Code for Exit Verification

**Given** a partner is logged in
**And** a candidate has already clocked in
**And** has generated a QR code for exit verification
**When** the partner navigates to the job verification page
**And** scans the QR code
**Then** the candidate and job details should be displayed
**When** the partner clicks "Confirm"
**Then** the exit should be recorded
**And** the partner should see a success message

### Test: Partner Rejects Verification

**Given** a partner is logged in
**And** a candidate has requested verification
**When** the partner navigates to the job verification page
**And** enters the job ID or OTP or scans the QR code
**Then** the candidate and job details should be displayed
**When** the partner clicks "Reject"
**Then** the verification should be rejected
**And** the partner should see a confirmation message

## Security Tests

### Test: Time Window Validation for Entry

**Given** a candidate is logged in
**And** has an approved job
**When** they attempt to verify entry before the allowed time window
**Then** the verification should be rejected
**And** they should see an error message

### Test: Time Window Validation for Exit

**Given** a candidate is logged in
**And** has already clocked in for a job
**When** they attempt to verify exit before the allowed time window
**Then** the verification should be rejected
**And** they should see an error message

### Test: Sequential Verification Enforcement

**Given** a candidate is logged in
**And** has an approved job
**When** they attempt to verify exit without first verifying entry
**Then** the verification should be rejected
**And** they should see an error message

### Test: Location Tracking

**Given** a candidate is logged in
**And** has an approved job
**When** they verify entry or exit
**Then** their location coordinates should be recorded
**And** stored with the verification record

### Test: Face Verification User Match

**Given** a candidate is logged in
**And** has enrolled their face
**When** they attempt face verification
**Then** the system should verify that the recognized face matches the logged-in user
**And** reject verification if there's a mismatch