# Search Enhancements - Testing Checklist

## 🎯 Quick Start

### Prerequisites
- [ ] MAMP running on local machine
- [ ] Database: `kaam_ats` accessible
- [ ] URL: `https://ats:8890/ats/` working

## 📋 Testing Sequence

### Phase 1: Database Setup (5 minutes)

#### Step 1.1: Create Tables
- [ ] Visit: `https://ats:8890/ats/public/create_search_tables.php`
- [ ] See success message: "✓ Created search_history table"
- [ ] See success message: "✓ Created candidate_resume_content table"
- [ ] Delete the file after successful run (security)

**Expected Output:**
```
✓ Created search_history table
✓ Created candidate_resume_content table

✅ All tables created successfully!
```

### Phase 2: Boolean Search (Already Complete)

#### Step 2.1: Test Boolean Parser
- [ ] Visit: `https://ats:8890/ats/public/test_boolean_search.php`
- [ ] All test queries show "✓ Parsed successfully"
- [ ] No red error messages
- [ ] SQL looks reasonable

#### Step 2.2: Test Advanced Search
- [ ] Visit: `https://ats:8890/ats/public/advanced_search.php`
- [ ] Page loads without errors
- [ ] "Search Help" button visible (blue/indigo)
- [ ] Click button - modal opens
- [ ] Press ESC - modal closes

#### Step 2.3: Test Boolean Queries
Test these queries in advanced search:

Simple:
- [ ] `python` - works as before
- [ ] `developer bangalore` - returns results

Boolean AND:
- [ ] `python AND django` - Blue "Boolean search active" appears
- [ ] Results have both terms
- [ ] Fewer results than simple search

Boolean OR:
- [ ] `java OR python` - Boolean indicator shows
- [ ] More results (either term)

Boolean NOT:
- [ ] `developer NOT recruiter` - Boolean indicator shows
- [ ] No recruiters in results

Exact Phrases:
- [ ] `"senior developer"` - Boolean indicator shows
- [ ] Exact phrase matches only

Complex:
- [ ] `(python OR java) AND senior` - Works correctly
- [ ] `"product manager" AND (bangalore OR mumbai) NOT intern` - Complex logic works

### Phase 3: Autocomplete (New Feature)

#### Step 3.1: Visual Check
- [ ] Search box has proper styling
- [ ] No layout issues
- [ ] Mobile responsive (if applicable)

#### Step 3.2: Focus Behavior
- [ ] Click in empty search box
- [ ] Dropdown appears (or "no recent searches" if new user)
- [ ] Click outside - dropdown closes

#### Step 3.3: Typing Suggestions
Type slowly and check after each:

- [ ] Type "p" - nothing (too short)
- [ ] Type "py" - suggestions appear
- [ ] Type "pyt" - suggestions update
- [ ] Type "python" - refined suggestions

Expected suggestion types:
- [ ] Skills (green icon)
- [ ] Job titles (blue icon)
- [ ] Companies (orange icon)
- [ ] Candidates (purple icon)

#### Step 3.4: Keyboard Navigation
- [ ] Arrow Down - highlight moves down
- [ ] Arrow Up - highlight moves up
- [ ] Enter - selected suggestion fills search box
- [ ] ESC - closes dropdown

#### Step 3.5: Mouse Interaction
- [ ] Hover over suggestion - highlights
- [ ] Click suggestion - fills search box
- [ ] Dropdown closes after selection

#### Step 3.6: Recent Searches
- [ ] Perform a search: "javascript developer"
- [ ] Clear search box
- [ ] Click in box again
- [ ] See "javascript developer" with clock icon
- [ ] Click it - fills search box

### Phase 4: Resume Search (New Feature)

#### Step 4.1: Process Resumes
- [ ] Visit: `https://ats:8890/ats/public/process_resumes.php`
- [ ] See current status (candidates with resumes, processed, remaining)
- [ ] Click "Start Processing"
- [ ] Progress bar appears
- [ ] Success count increases
- [ ] "Processing Complete" message shows

**If you have resumes in your database:**
- [ ] At least some resumes processed successfully
- [ ] Error count is reasonable (some files may fail)
- [ ] Can click "Process Next Batch" if needed

**If no resumes in database:**
- [ ] Shows "0 Total Candidates with Resumes"
- [ ] Can skip this test

#### Step 4.2: Test Resume Content Search
**Only if resumes were processed:**

Search for terms you know are in resumes:
- [ ] Search: "bachelor" (degree)
- [ ] Search: "university" (education)
- [ ] Search: "certified" (certifications)
- [ ] Search: "project" (job descriptions)

Expected:
- [ ] Returns candidates with those terms in resumes
- [ ] Even if terms not in candidate profile fields

Boolean with resume content:
- [ ] Search: `"bachelor's degree" AND python`
- [ ] Returns candidates with degree AND Python skill
- [ ] Works across resume + profile fields

### Phase 5: Integration Testing

#### Step 5.1: Combined Features
- [ ] Type "py" in search box
- [ ] Pick "Python" from autocomplete
- [ ] Add " AND "
- [ ] Type "dj"
- [ ] Pick "Django" from suggestions
- [ ] Search executes
- [ ] Boolean indicator shows
- [ ] Search saved to history
- [ ] Results include resume content matches

#### Step 5.2: Filters + Search
- [ ] Search: `python AND django`
- [ ] Select Location: "Bangalore"
- [ ] Select Status: "Shortlisted"
- [ ] Click Search
- [ ] Results match all criteria (search + filters)

#### Step 5.3: Search History Accumulation
Perform these searches in sequence:
1. [ ] "java developer"
2. [ ] "python engineer"
3. [ ] "react developer"
4. [ ] "senior manager"
5. [ ] Clear search box
6. [ ] Click in box
7. [ ] See all 4-5 recent searches with clock icons

### Phase 6: Error Handling

#### Step 6.1: Network Errors
- [ ] Open browser dev tools (F12)
- [ ] Go to Network tab
- [ ] Type in search box
- [ ] See AJAX requests to `get_search_suggestions.php`
- [ ] Check for errors (should be none)

#### Step 6.2: Empty States
- [ ] Search for: `xyzqwertyzxcvbnm123` (gibberish)
- [ ] Gets 0 results gracefully
- [ ] No JavaScript errors
- [ ] Can search again

#### Step 6.3: Special Characters
- [ ] Search: `C++ developer`
- [ ] Search: `@gmail.com`
- [ ] Search: `$100,000 salary`
- [ ] No errors, handles gracefully

### Phase 7: Performance Check

#### Step 7.1: Autocomplete Speed
- [ ] Type quickly: "python"
- [ ] Suggestions appear within 1 second
- [ ] No lag or stuttering
- [ ] Smooth dropdown animation

#### Step 7.2: Search Speed
- [ ] Boolean search: `(python OR java) AND senior`
- [ ] Results load in < 2 seconds
- [ ] No timeout errors

#### Step 7.3: Resume Processing Speed
**If you processed resumes:**
- [ ] 100 resumes in < 60 seconds (if available)
- [ ] Progress updates smoothly
- [ ] No PHP timeouts

## ✅ Success Criteria

### Must Pass (Critical)
- [x] ~~Boolean search (already working)~~
- [ ] Tables created successfully
- [ ] Autocomplete shows suggestions
- [ ] Keyboard navigation works
- [ ] Search history saves and displays
- [ ] No JavaScript console errors
- [ ] No PHP fatal errors

### Should Pass (Important)
- [ ] Resume processing completes
- [ ] Resume content searchable
- [ ] Recent searches clickable
- [ ] Suggestions are relevant
- [ ] Mobile responsive (if applicable)

### Nice to Have (Optional)
- [ ] All resumes process without errors
- [ ] Autocomplete shows all types (skills, titles, companies)
- [ ] Performance under 2 seconds
- [ ] Zero validation errors

## 🐛 Bug Report Template

If you find issues, note:

```
**Bug Description:**
What happened?

**Steps to Reproduce:**
1.
2.
3.

**Expected Behavior:**
What should happen?

**Actual Behavior:**
What actually happened?

**Browser/Environment:**
- Browser:
- URL:
- Error message (if any):

**Screenshot/Console Errors:**
(paste or attach)
```

## 📊 Test Results Summary

After testing, fill this out:

```
Date Tested: _______________
Tester: _______________

Phase 1 - Database Setup: ✅ / ⚠️ / ❌
Phase 2 - Boolean Search: ✅ / ⚠️ / ❌
Phase 3 - Autocomplete: ✅ / ⚠️ / ❌
Phase 4 - Resume Search: ✅ / ⚠️ / ❌
Phase 5 - Integration: ✅ / ⚠️ / ❌
Phase 6 - Error Handling: ✅ / ⚠️ / ❌
Phase 7 - Performance: ✅ / ⚠️ / ❌

Overall Status: PASS / FAIL / NEEDS WORK

Notes:
_________________________________
_________________________________
_________________________________
```

## 🚀 Next Steps After Testing

### If All Tests Pass:
1. Review this checklist results
2. Test on a few more edge cases
3. Ready for production upload planning

### If Some Tests Fail:
1. Note which phase failed
2. Check error logs: `/ats/logs/error.log`
3. Review browser console
4. Try the troubleshooting section in `SEARCH_ENHANCEMENTS_GUIDE.md`

### Production Preparation:
1. Document any local-only paths
2. Plan production file upload
3. Prepare database migration for production
4. Schedule low-traffic time for deployment

---

**Testing Time Estimate:** 30-45 minutes for complete testing
**Required Access:** Local ATS, browser with dev tools, terminal (optional)
