# ๐ŸŽฏ FINAL COMPLETE DATA-TESTID REQUIREMENTS ## Comprehensive Requirements Document for UI Development Team **Document Version:** 2.0 (Final) **Date:** 2025-01-20 **Purpose:** Complete, standalone requirements for all `data-testid` attributes needed for world-class automation testing **Status:** โœ… **READY FOR IMPLEMENTATION** --- ## ๐Ÿ“‹ **EXECUTIVE SUMMARY** This document provides **complete, comprehensive, and accurate** requirements for all `data-testid` attributes needed across the Cognitive Prism Assessment Platform. These attributes are **critical** for: - โœ… **Reliable Automation Testing** - Stable locators that don't break with UI changes - โœ… **Performance Monitoring** - Track element load times and interactions - โœ… **Error Analysis** - Precise error reporting and debugging - โœ… **Regression Testing** - Ensure functionality remains intact across updates - โœ… **World-Class Quality Assurance** - Professional-grade test automation **Total Attributes Required:** ~350+ (including dynamic patterns) **Priority:** ๐Ÿ”ด **CRITICAL** - Required for production-ready automation --- ## ๐Ÿ“ **NAMING CONVENTION (MANDATORY)** ### **Pattern: `{scope}__{element_name}`** - **Double underscore (`__`)** separates scope from element name - **Single underscore (`_`)** within element names for readability - **Scopes** are lowercase snake_case (e.g., `student_login`, `domain_assessment`) - **Element names** are lowercase snake_case (e.g., `first_name_input`, `submit_button`) ### **Dynamic Patterns:** For dynamic collections, identifiers are appended with double underscore: - `{scope}__{baseId}__{dynamicPart}` - Example: `assessment_card__51_action` - Example: `domain_question__123__option_A` - Example: `domain_question__456__rating_3` ### **Critical Rules:** 1. โœ… **Never reuse** the same `data-testid` value for two different DOM nodes 2. โœ… **Always use** double underscore (`__`) to separate scope and dynamic parts 3. โœ… **Always use** lowercase snake_case (no camelCase, no kebab-case) 4. โœ… **Always include** `data-testid` on interactive elements (buttons, inputs, links) 5. โœ… **Always include** `data-testid` on containers that hold dynamic content --- ## ๐ŸŽฏ **SCOPE REFERENCE** | Scope | Description | Route/Page | |-------|-------------|------------| | `student_login` | Sign-in form | `/` | | `mandatory_reset` | First-login password reset modal | Modal overlay | | `profile_incomplete` | Modal that forces profile completion | Modal overlay | | `profile_editor` | Profile builder/editor | `/student/profile-builder` | | `student_nav` | Logged-in student header/navigation | All student pages | | `assessment_card` | Product cards on assessments hub | `/assessments` | | `domains_page` | Domain listing screen | `/assessment/{assignmentId}/domains` | | `domain_card` | Individual domain tiles | `/assessment/{assignmentId}/domains` | | `domain_assessment` | In-progress domain test experience | `/assessment/{assignmentId}/domain/{domainId}` | | `domain_question` | Question renderer + inputs | `/assessment/{assignmentId}/domain/{domainId}` | | `domain_feedback` | Per-domain feedback modal | Modal overlay | | `domains_final_feedback` | Final feedback modal after all domains | Modal overlay | --- ## ๐Ÿ“ฆ **SECTION 1: ASSESSMENTS HUB PAGE** ### **File:** `src/pages/designs/design-1/assessment/AssessmentMainPage.jsx` ### **Component:** `ProductCard.jsx` (used in `AssessmentSection.jsx`) #### **1.1 Assessment Cards** **Status:** โŒ **NOT IMPLEMENTED** **File Location:** `src/pages/designs/design-1/assessment/components/ProductCard.jsx` **Required Attributes:** ```jsx // Assessment Card Container
{/* Assessment Card Action Button */}
``` **Implementation Example:** ```jsx // In ProductCard.jsx const ProductCard = ({ assessment, onStart, onResume, onRetake, onViewResults }) => { const assignmentId = assessment.assignmentId || assessment.id return (
{/* Card header with name, description */}

{assessment.name}

{assessment.description}

{/* Progress indicator */}
{assessment.progress?.overallProgress || 0}%
{/* Action Button */}
) } ``` **Dynamic Values:** - `assignmentId`: Number (e.g., `51`) - Generated: `assessment_card__51`, `assessment_card__51__action`, `assessment_card__51__progress` **Implementation Locations:** - Line ~95: Add `data-testid={`assessment_card__${assignmentId}`}` to `` container - Line ~161: Add `data-testid={`assessment_card__${assignmentId}__progress`}` to progress value span - Line ~184: Add `data-testid={`assessment_card__${assignmentId}__action`}` to action button, `assessment_card__51__progress` --- #### **1.2 Assessment Section Headers** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Section Container
{/* Section Title */}

Ready to Start / Completed / etc.

``` **Section Names:** - `ready_to_start` - `completed` - `retake_available` - `abandoned` - `prerequisites_needed` **Implementation Example:** ```jsx // In AssessmentMainPage.jsx ``` --- ## ๐Ÿ“ฆ **SECTION 2: DOMAINS PAGE** ### **File:** `src/pages/designs/design-1/assessment/domains/ProductDomainsPage.jsx` ### **Component:** `DomainCard.jsx` #### **2.1 Domain Cards** **Status:** โš ๏ธ **PARTIALLY IMPLEMENTED** **Current Implementation:** - โœ… Card container has test-id (line 83 in DomainCard.jsx): `domain_card__${domain.id}` - โŒ Action button missing test-id (line 211-248 in DomainCard.jsx) **Required Attributes:** ```jsx // Domain Card Container (โœ… Already Implemented) {/* Domain Card Action Button (โŒ MISSING) */} onStart(domain)} disabled={isActionDisabled} className="..." > Start Assessment / Continue Assessment / Completed / Locked ``` **Implementation Fix:** ```jsx // In DomainCard.jsx, line ~211 {/* Button content */} ``` **Dynamic Values:** - `domain.id`: Number (e.g., `1`, `2`, `3`) - Generated: `domain_card__1`, `domain_card__1__action` --- #### **2.2 Domains Page Container** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Page Container
{/* Page Header */}

TestProduct

0%
{/* Back Button */}
``` **Implementation Example:** ```jsx // In ProductDomainsPage.jsx

{productInfo?.name}

{overallProgress}%
``` --- ## ๐Ÿ“ฆ **SECTION 3: DOMAIN ASSESSMENT PAGE** ### **File:** `src/pages/designs/design-1/assessment/domains/DomainAssessmentPage.jsx` ### **Component:** `AssessmentHeader.jsx` #### **3.1 Domain Assessment Page Container** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Page Container
{/* Assessment Header */}
``` **Implementation Example:** ```jsx // In DomainAssessmentPage.jsx, main return statement
``` --- #### **3.2 Assessment Header Components** **File:** `src/pages/designs/design-1/assessment/domains/components/AssessmentHeader.jsx` **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Header Container
{/* Back Button */} {/* Domain Title */}

{domain?.name}

{/* Progress Value */}
{progressPercent}%
{/* Timer Value (if present) */} {timeLeft && (
{formatTime(timeLeft)}
)}
``` **Implementation Example:** ```jsx // In AssessmentHeader.jsx

{domain?.name || 'Domain Assessment'}

{progressPercent}%
{timeLeft && (
{formatTime(timeLeft)}
)}
``` --- #### **3.3 Instructions Modal** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Instructions Modal Container
{/* Modal Content */}
{/* Continue Button */}
``` **Implementation Example:** ```jsx // In DomainAssessmentPage.jsx, instructions modal section {showInstructions && (
{/* Instructions content */}
)} ``` --- #### **3.4 Sticky Action Bar** **File:** `src/pages/designs/design-1/assessment/domains/components/StickyActionBar.jsx` **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Action Bar Container
{/* Previous Button */} {/* Next Button */} {/* Submit Button */}
``` **Implementation Example:** ```jsx // In StickyActionBar.jsx
``` --- #### **3.5 Question Navigator** **File:** `src/pages/designs/design-1/assessment/domains/components/QuestionNavigator.jsx` **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Navigator Container
{/* Individual Question Buttons */} {questionsOrder.map((questionId, idx) => ( ))}
``` **Implementation Example:** ```jsx // In QuestionNavigator.jsx
{questionsOrder.map((questionId, idx) => ( ))}
``` --- #### **3.6 Submit Confirmation Modal** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Submit Modal Container
{/* Modal Content */}
{/* Review Button */} {/* Confirm Button */} {/* Cancel Button */}
``` --- #### **3.7 Guidance Modal** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Guidance Modal Container
{/* Modal Content */}
{/* Dismiss Button */}
``` --- #### **3.8 Success Modal** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Success Modal Container
{/* Modal Content */}
{/* Success Message */}

Domain assessment submitted successfully!

``` --- ## ๐Ÿ“ฆ **SECTION 4: QUESTION COMPONENTS** ### **File:** `src/pages/designs/design-1/assessment/domains/components/QuestionRenderer.jsx` ### **Component:** `QuestionShell.jsx` #### **4.1 Question Shell Container** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Question Shell Container
{/* Question Header */}
{currentIndex + 1}

{question.text}

{/* Question Content (rendered by QuestionRenderer) */} {children}
``` **Implementation Example:** ```jsx // In QuestionShell.jsx
{currentIndex + 1}

{question.text}

{children}
``` --- ### **Component:** `MultipleChoiceQuestion.jsx` #### **4.2 Multiple Choice Questions** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Multiple Choice Container
{options.map((option, idx) => ( ))}
``` **Implementation Example:** ```jsx // In MultipleChoiceQuestion.jsx
{options.map((option, idx) => { const optionLabel = String.fromCharCode(65 + idx) // A, B, C, D, E return ( ) })}
``` **Dynamic Values:** - `question.id`: Number (e.g., `123`) - `optionLabel`: Letter (A, B, C, D, E) - Generated: `domain_question__123__option_A`, `domain_question__123__option_B` --- ### **Component:** `TrueFalseQuestion.jsx` #### **4.3 True/False Questions** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // True/False Container
``` **Implementation Example:** ```jsx // In TrueFalseQuestion.jsx
``` **Dynamic Values:** - `question.id`: Number (e.g., `456`) - Generated: `domain_question__456__truefalse_True`, `domain_question__456__truefalse_False` --- ### **Component:** `RatingScaleQuestion.jsx` #### **4.4 Rating Scale Questions** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Rating Scale Container
{scaleOptions.map((option) => ( ))}
``` **Implementation Example:** ```jsx // In RatingScaleQuestion.jsx
{scaleOptions.map((option) => ( ))}
``` **Dynamic Values:** - `question.id`: Number (e.g., `789`) - `option.value`: String (e.g., `"1"`, `"2"`, `"3"`, `"4"`, `"5"`) - Generated: `domain_question__789__rating_1`, `domain_question__789__rating_2` --- ### **Component:** `OpenEndedQuestion.jsx` #### **4.5 Open-Ended Questions** **Status:** โŒ **NOT IMPLEMENTED** **Required Attributes:** ```jsx // Open-Ended Container