212 lines
8.8 KiB
Markdown
212 lines
8.8 KiB
Markdown
# Data-TestID Attributes Documentation Index
|
|
|
|
## 📋 Overview
|
|
|
|
This documentation folder contains **complete, world-class reference materials** for implementing `data-testid` attributes for Selenium automation testing in the Cognitive Prism Assessment UI.
|
|
|
|
**Purpose**: These documents serve as the **single source of truth** for all automation locator requirements, patterns, and implementation guidelines. They are designed to survive code changes and provide clear guidance for any future UI implementations.
|
|
|
|
---
|
|
|
|
## 📚 Documentation Structure
|
|
|
|
### 1. **[CODE_EVIDENCE_STATUS.md](./01_CODE_EVIDENCE_STATUS.md)** ⭐ PRIMARY
|
|
- **Purpose**: **Code-verified** current state (grep-based, no assumptions)
|
|
- **Contents**:
|
|
- What **actually exists** in code (verified by grep)
|
|
- What's **required** (based on automation tests)
|
|
- Missing attributes inventory
|
|
- Verification commands
|
|
- **Use When**: Need **real-time** status based on actual code
|
|
- **Updated**: Run grep commands to verify anytime
|
|
|
|
### 2. **[PATTERN_RULES.md](./02_PATTERN_RULES.md)** ⭐ ESSENTIAL
|
|
- **Purpose**: Universal pattern rules that survive code changes
|
|
- **Contents**:
|
|
- Naming convention rules (double underscore pattern)
|
|
- Dynamic attribute patterns
|
|
- Scope definitions
|
|
- Pattern verification regex
|
|
- **Use When**: Implementing new attributes or verifying existing ones
|
|
- **Note**: These rules are **universal** and apply to ALL implementations
|
|
|
|
### 3. **[VERIFICATION_SCRIPT.md](./03_VERIFICATION_SCRIPT.md)** ⭐ VERIFICATION
|
|
- **Purpose**: Automated verification methods (code-based, not DOM-based)
|
|
- **Contents**:
|
|
- Grep commands for verification
|
|
- Python verification script
|
|
- CI/CD integration
|
|
- Expected results
|
|
- **Use When**: Verifying implementation status or setting up automation
|
|
- **Note**: All verification is **code-based**, not DOM-based
|
|
|
|
### 4. **[ATTRIBUTE_VERIFICATION_REPORT.md](./04_ATTRIBUTE_VERIFICATION_REPORT.md)** ⭐ COMPLETE VERIFICATION
|
|
- **Purpose**: **Line-by-line manual verification** of all attributes in StudentProfileEditor.jsx
|
|
- **Contents**:
|
|
- Complete list of all 61 static attributes with exact line numbers
|
|
- Verification status for each attribute (✅ PRESENT / ❌ MISSING)
|
|
- Dynamic attribute generation verification
|
|
- Summary statistics
|
|
- Missing attributes analysis (with reasons)
|
|
- **Use When**: Need **detailed confirmation** of what attributes exist and where
|
|
- **Verification Method**: Manual line-by-line code analysis (not grep)
|
|
- **Status**: ✅ Complete - All required attributes verified present
|
|
|
|
### 5. **[CODE_EVIDENCE_ATTRIBUTE_COUNT.md](./05_CODE_EVIDENCE_ATTRIBUTE_COUNT.md)** ⭐ COUNT VERIFICATION
|
|
- **Purpose**: Code-evidence based count of all required attributes
|
|
- **Contents**:
|
|
- Actual count from source code (no documentation dependencies)
|
|
- Breakdown by component
|
|
- Static vs dynamic attribute counts
|
|
- **Use When**: Need accurate count verification
|
|
- **Status**: ✅ Complete
|
|
|
|
### 6. **[MANDATORY_RESET_VERIFICATION.md](./06_MANDATORY_RESET_VERIFICATION.md)** ⭐ COMPONENT VERIFICATION
|
|
- **Purpose**: Verification report for MandatoryPasswordResetModal.jsx
|
|
- **Contents**:
|
|
- All 15 attributes with line numbers
|
|
- Required vs optional breakdown
|
|
- Verification status
|
|
- **Use When**: Need verification for password reset modal
|
|
- **Status**: ✅ Complete
|
|
|
|
### 7. **[IMPLEMENTATION_SUMMARY_FOR_AUTOMATION_TEAM.md](./07_IMPLEMENTATION_SUMMARY_FOR_AUTOMATION_TEAM.md)** ⭐ **SEND TO AUTOMATION TEAM**
|
|
- **Purpose**: **Complete implementation summary for Automation Team**
|
|
- **Contents**:
|
|
- Executive summary of both components
|
|
- Complete attribute lists with line numbers
|
|
- Verification statistics
|
|
- Pattern compliance confirmation
|
|
- Ready-for-testing confirmation
|
|
- **Use When**: **Sending to Automation Team** - This is the document to share
|
|
- **Status**: ✅ Complete - Ready to send
|
|
|
|
### 8. **[HONEST_STATUS_REPORT.md](./08_HONEST_STATUS_REPORT.md)** ⚠️ **ROOT CAUSE ANALYSIS**
|
|
- **Purpose**: **Honest assessment of the mistake and corrective action**
|
|
- **Contents**:
|
|
- Root cause: Wrong component was modified initially
|
|
- Corrective action plan
|
|
- Code evidence verification
|
|
- **Use When**: Understanding what went wrong and how it was fixed
|
|
- **Status**: ✅ Complete
|
|
|
|
### 9. **[BROWSER_VERIFICATION_SCRIPT.md](./09_BROWSER_VERIFICATION_SCRIPT.md)** 🔍 **BROWSER TESTING**
|
|
- **Purpose**: **Complete browser DevTools verification script**
|
|
- **Contents**:
|
|
- JavaScript script for console verification
|
|
- Testing instructions for dynamic attributes
|
|
- Expected results and checklist
|
|
- **Use When**: **Verifying attributes in browser DevTools**
|
|
- **Status**: ✅ Complete - Ready to use
|
|
|
|
### 10. **[FINAL_IMPLEMENTATION_STATUS.md](./10_FINAL_IMPLEMENTATION_STATUS.md)** ✅ **FINAL STATUS**
|
|
- **Purpose**: **Complete implementation status report**
|
|
- **Contents**:
|
|
- All 62 static attributes with line numbers
|
|
- Dynamic attribute patterns
|
|
- Requirements compliance
|
|
- Verification status
|
|
- **Use When**: **Final status confirmation**
|
|
- **Status**: ✅ Complete
|
|
|
|
### 11. **[AUTOMATION_TEAM_CLAIMS_VERIFICATION.md](./11_AUTOMATION_TEAM_CLAIMS_VERIFICATION.md)** 🔍 **CLAIMS VERIFICATION**
|
|
- **Purpose**: **Verify Automation Team's claims against source code**
|
|
- **Contents**:
|
|
- Line-by-line code verification
|
|
- Explanation of conditional rendering
|
|
- Why attributes weren't seen in DOM
|
|
- Recommendations for proper testing
|
|
- **Use When**: **Responding to Automation Team's verification report**
|
|
- **Status**: ✅ Complete - All claims verified
|
|
|
|
---
|
|
|
|
## 🎯 Quick Reference
|
|
|
|
### Pattern Format
|
|
```
|
|
{scope}__{element_name}
|
|
```
|
|
|
|
**Examples:**
|
|
- `student_login__form`
|
|
- `profile_editor__first_name_input`
|
|
- `assessment_card__{assignmentId}__action`
|
|
|
|
### Key Rules
|
|
1. **Double underscore (`__`)** separates scope from element name
|
|
2. **Single underscore (`_`)** within element names for readability
|
|
3. **Lowercase snake_case** for all identifiers
|
|
4. **Dynamic parts** use `{variable}` notation in documentation
|
|
|
|
---
|
|
|
|
## 📊 Status Summary
|
|
|
|
| Document | Status | Verification Method |
|
|
|----------|--------|---------------------|
|
|
| Code Evidence Status | ✅ Complete | `grep -r "data-testid" src/` |
|
|
| Pattern Rules | ✅ Complete | Pattern-based (universal) |
|
|
| Verification Script | ✅ Complete | Code-based verification |
|
|
| Attribute Verification Report | ✅ Complete | Line-by-line manual analysis |
|
|
| Code Evidence Attribute Count | ✅ Complete | Code-based count |
|
|
| Mandatory Reset Verification | ✅ Complete | Component verification |
|
|
| Implementation Summary | ✅ Complete | Send to Automation Team |
|
|
| Honest Status Report | ✅ Complete | Root cause analysis |
|
|
| Browser Verification Script | ✅ Complete | DevTools testing |
|
|
| Final Implementation Status | ✅ Complete | Final status report |
|
|
| **Automation Team Claims Verification** | ✅ **Complete** | **Claims verification** |
|
|
|
|
**Total Documents**: 11
|
|
|
|
---
|
|
|
|
## 🔄 How to Use This Documentation
|
|
|
|
### ⚠️ CRITICAL: Code-Evidence First Approach
|
|
|
|
**ALWAYS verify against actual code, not documentation.**
|
|
|
|
### For New Implementations
|
|
1. **Verify current state**: Run `grep -r "data-testid" src/` (see [CODE_EVIDENCE_STATUS.md](./01_CODE_EVIDENCE_STATUS.md))
|
|
2. **Follow patterns**: Use [PATTERN_RULES.md](./02_PATTERN_RULES.md) for naming rules
|
|
3. **Verify after changes**: Run verification commands from [VERIFICATION_SCRIPT.md](./03_VERIFICATION_SCRIPT.md)
|
|
|
|
### For Code Updates/Refactoring
|
|
1. **Check current code**: `grep -rn "data-testid" src/path/to/file.jsx`
|
|
2. **Follow patterns**: Ensure compliance with [PATTERN_RULES.md](./02_PATTERN_RULES.md)
|
|
3. **Re-verify**: Run verification script after changes
|
|
|
|
### For Verification/Auditing
|
|
1. **Get real-time status**: `grep -r "data-testid" src/ | wc -l`
|
|
2. **Check specific scope**: `grep -r "scope_name__" src/ | wc -l`
|
|
3. **Verify patterns**: Use regex from [PATTERN_RULES.md](./02_PATTERN_RULES.md)
|
|
|
|
---
|
|
|
|
## ⚠️ Important Notes
|
|
|
|
1. **Code-Evidence Only**: Documentation is based on actual code verification (grep), not assumptions
|
|
2. **Zero Tolerance Policy**: All attributes must follow exact patterns documented here
|
|
3. **Real-Time Verification**: Always verify against code, not documentation
|
|
4. **Future-Proof Patterns**: Rules are universal and survive code changes
|
|
5. **Automation-First**: All patterns prioritize automation test reliability
|
|
|
|
## 🎯 Quick Verification
|
|
|
|
```bash
|
|
# Get current status (run this anytime)
|
|
grep -r "data-testid" cognitive-prism-assesment-ui/src/ | wc -l
|
|
|
|
# See all existing attributes
|
|
grep -rn "data-testid" cognitive-prism-assesment-ui/src/
|
|
```
|
|
|
|
---
|
|
|
|
**Document Version**: 1.0
|
|
**Created**: 2025-01-15
|
|
**Maintained By**: Automation Team
|
|
**Last Review**: 2025-01-15
|
|
|