5.5 KiB
5.5 KiB
🚀 QUICK REFERENCE: Data-TestID Implementation Guide
📋 Summary
Total Missing Attributes: ~200+
File: src/pages/StudentProfileEditor.jsx
Status: ❌ ALL attributes missing
⚡ Quick Implementation Steps
1. Add formatTestId Helper (Line ~23)
const formatTestId = (value = '') => {
return value.toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_|_$/g, '')
}
2. Update Tab Buttons (Line 1703)
<button
key={idx}
onClick={() => setActiveTab(idx)}
data-testid={`profile_editor__tab_${formatTestId(section.title)}`} // ADD
className={...}
>
3. Update MultiSelectPicker Component (Line 174)
Add testIdPrefix prop and use it:
const MultiSelectPicker = ({ options, selectedItems, onToggle, maxItems, icon: Icon, testIdPrefix }) => {
// ...
<input
type="checkbox"
data-testid={testIdPrefix ? `${testIdPrefix}__${formatTestId(option)}` : undefined} // ADD
// ...
/>
}
4. Add data-testid to All Inputs/Selects/Textareas
For EVERY input element, add:
data-testid="profile_editor__{field_name}_{type}"
📊 Critical Attributes Checklist
Page Level (4)
profile_editor__pageprofile_editor__progress_valueprofile_editor__missing_fields_toggleprofile_editor__back_button
Tabs (9)
profile_editor__tab_personal_informationprofile_editor__tab_contact_informationprofile_editor__tab_parent_guardianprofile_editor__tab_education_detailsprofile_editor__tab_focus_areasprofile_editor__tab_self_assessmentprofile_editor__tab_hobbies_clubsprofile_editor__tab_achievementsprofile_editor__tab_expectations
Navigation Buttons (4)
profile_editor__prev_buttonprofile_editor__next_buttonprofile_editor__cancel_buttonprofile_editor__save_button
Tab Scroll Buttons (2)
profile_editor__tabs_scroll_left_buttonprofile_editor__tabs_scroll_right_button
Personal Information (10)
profile_editor__first_name_inputprofile_editor__last_name_inputprofile_editor__gender_selectprofile_editor__dob_inputprofile_editor__nationality_inputprofile_editor__language_inputprofile_editor__student_id_inputprofile_editor__student_cpid_inputprofile_editor__specially_abled_checkboxprofile_editor__specially_abled_details_textarea
Contact Information (7)
profile_editor__email_inputprofile_editor__phone_inputprofile_editor__address_inputprofile_editor__city_inputprofile_editor__state_inputprofile_editor__zip_code_inputprofile_editor__native_state_input
Parent/Guardian (14)
profile_editor__father_full_name_inputprofile_editor__father_age_range_selectprofile_editor__father_occupation_inputprofile_editor__father_email_inputprofile_editor__mother_full_name_inputprofile_editor__mother_age_range_selectprofile_editor__mother_occupation_inputprofile_editor__mother_email_inputprofile_editor__guardian_different_checkboxprofile_editor__guardian_full_name_inputprofile_editor__guardian_relationship_inputprofile_editor__guardian_phone_inputprofile_editor__guardian_email_inputprofile_editor__guardian_address_input
Education Details (4)
profile_editor__full_name_inputprofile_editor__current_grade_inputprofile_editor__section_inputprofile_editor__board_stream_select
Focus Areas (~40+ checkboxes)
- All short-term focus checkboxes:
profile_editor__short_term_focus__{formatted} - All long-term focus checkboxes:
profile_editor__long_term_focus__{formatted} profile_editor__short_term_focus_others_textprofile_editor__long_term_focus_others_text
Self-Assessment (~40+ checkboxes)
- All strength checkboxes:
profile_editor__strength__{formatted} - All improvement checkboxes:
profile_editor__improvement__{formatted} profile_editor__strength_others_textprofile_editor__improvement_others_text
Hobbies & Clubs (~30+ checkboxes)
- All hobby checkboxes:
profile_editor__hobby__{formatted} - All club checkboxes:
profile_editor__club_{formatted} profile_editor__hobby_other_textprofile_editor__club_other_text
Achievements (5)
profile_editor__achievement_academics_textareaprofile_editor__achievement_sports_textareaprofile_editor__achievement_cultural_textareaprofile_editor__achievement_trained_textareaprofile_editor__achievement_others_textarea
Expectations (~10+ checkboxes)
- All expectation checkboxes:
profile_editor__expectation__{formatted} profile_editor__expectation_others_text
🔍 Verification Script
After implementation, run this in browser console:
const testIds = Array.from(document.querySelectorAll('[data-testid^="profile_editor__"]'))
.map(el => el.getAttribute('data-testid'))
.sort()
console.log(`✅ Found ${testIds.length} data-testid attributes`)
console.log('Missing critical:', [
'profile_editor__page',
'profile_editor__save_button',
'profile_editor__tab_personal_information',
'profile_editor__first_name_input'
].filter(id => !testIds.includes(id)))
See full documentation: UI_TEAM_DATA_TESTID_REQUIREMENTS.md