Prompt Details
Model
(claude-4-6-sonnet)
Token size
1,083
Example input
[TASK]: TreΕΔ wiadomoΕci Gemini Implement a dietary requirements selector for the flight booking system. Users should be able to specify if their passenger profile requires a special meal (Vegetarian, Vegan, Gluten-Free, Halal, Kosher, Nut-Free, or Other). Add a dietary selector component to the passenger details page, ensure the preference is saved with the booking data, and display the meal type on the user''s itinerary list. The feature should integrate seamlessly with the existing booking flow and provide a polished user experience with proper visual indicators for different dietary needs. Element Selectors: - Dietary selector: data-testid="dietary-selector" - Itinerary card: data-testid="itinerary-card"
[TESTS]: dietary-selector/tests
[IMPLEMENTATION]: None
[NOTES]: None
Example output
PHASE 1 β TASK ANALYSIS
Parse the task thoroughly. Extract and list:
All UI elements that must have data-test-id attributes:
[data-testid="dietary-selector"] - Dietary requirement selector component
[data-testid="itinerary-card"] - Itinerary/booking card component
All file/component paths where the implementation should live:
(TASK GAP) No specific file paths mentioned
Passenger details page (location not specified)
User's itinerary list (location not specified)
All described user interactions:
Select a dietary requirement from selector (Vegetarian, Vegan, Gluten-Free, Halal, Kosher, Nut-Free, or Other)
Complete booking flow with dietary preference selected
View itinerary list and see meal type displayed
All API calls mentioned:
(TASK GAP) No API endpoints, methods, or payloads specified
Implied: Save booking with dietary data
Implied: Retrieve bookings with dietary data
Any colors, styles, or visual requirements:
"Polished user experience"
"Proper visual indicators for different dietary needs" (specific indicators not defined)
Edge cases, error states, and loading states:
(TASK GAP) No error states mentioned
(TASK GAP) No loading states mentioned
(TASK GAP) No validation requirements specified
(TASK GAP) No behavior specified for bookings without dietary preferences
Missing from Task:
Specific meal type values/labels format
Whether dietary preference is required or optional
Default preference value (if any)
Visual indicator specifications (icons, colors, badges?)
API contract details
β
PHASE 1 COMPLETE
PHASE 2 β TEST AUDIT
Reading tests...
Finding files matching '**/0042-implement-dietary-selector/tests/**/*'
Reading default.spec.ts
Reading dietary_selector_appears_on_details_page_with_all_options.spec.ts
Reading dietary_selector_preserves_selection_when_form_validation_f.spec.ts
Reading dietary_preference_displays_on_user.spec.ts
Reading user_selects_a_dietary_preference_and_it_saves_with_booking.spec.ts
Reading user_selects_other.spec.ts
Test 1: default.spec.ts - Default "None" preference saves correctly
Coverage: Tests that when no preference is selected, a valid default value is saved
β
Targets task requirement: default behavior when no meal selected
β
Uses task-specified selector: [data-testid="dietary-selector"]
β
Tests behavior (no selection β valid default saved), not implementation
β ISSUE: Reads localStorage AFTER the booking is created, but relies on localStorage being populated by the form submission. This is valid because the test creates the data first by submitting the form.
Task coverage: Covers default/no-selection scenario
Test 2: dietary_selector_appears_on_details_page_with_all_options.spec.ts
Coverage: Verifies dietary selector exists with all required options
β
Targets task requirement: meal types (Vegetarian, Vegan, Gluten-Free, Halal, Kosher, Nut-Free, Other)
β
Uses task-specified selector: [data-testid="dietary-selector"]
β
Verifies all 8 meal types exist (7 from task + "None" default)
β ISSUE: Task lists 7 dietary types, test checks for 8 including "None" - this is reasonable but not explicitly in task
Task coverage: Covers selector visibility and available options
Test 3: dietary_selector_preserves_selection_when_form_validation_f.spec.ts
Coverage: Verifies dietary selection persists through form validation errors
β
Targets reasonable requirement: state preservation during validation
β
Uses task-specified selector: [data-testid="dietary-selector"]
β οΈ POTENTIAL ISSUE: This requirement is NOT explicitly mentioned in the task description
Task coverage: Adds defensive behavior not in task (good practice, but not required)
Test 4: dietary_preference_displays_on_user.spec.ts
Coverage: Verifies dietary preference displays on itinerary list with visual indicator
β
Targets task requirement: "display the meal type on user's itinerary list"
β
Uses task-specified selector: [data-testid="itinerary-card"]
β
Tests for visual indicator presence (badge/tag/label)
β οΈ ISSUE: Uses fallback selectors not in task spec (.dietary-icon, .meal-badge, [class*="dietary"])
Task coverage: Covers display requirement
Test 5: user_selects_a_dietary_preference_and_it_saves_with_booking.spec.ts
Coverage: Verifies selected preference saves with booking data
β
Targets task requirement: "ensure the preference is saved with the booking data"
β
Uses task-specified selector: [data-testid="dietary-selector"]
β
Verifies localStorage contains dietary field with correct value
β ISSUE: Reads localStorage after creating booking - valid pattern, data is written by form submission
Task coverage: Core save functionality
Test 6: user_selects_other.spec.ts
Coverage: Verifies "Other" dietary type can be selected and saved
β
Targets task requirement: "Other" is listed as a meal type
β
Uses task-specified selector: [data-testid="dietary-selector"]
β
Verifies specific meal type selection and save
Task coverage: Tests one specific dietary type
Task Requirements NOT Covered by Tests:
(MISSING) Testing all individual meal types (Gluten-Free, Halal, Kosher, Nut-Free) - only Vegetarian, Vegan, and Other are tested
(MISSING) "Polished user experience" - no UX quality tests
(MISSING) "Seamless integration with existing booking flow" - tests jump directly to passenger details page, don't test full flow
(MISSING) Different visual indicators for different dietary needs
(MISSING) Edge case: what happens with existing bookings without dietary preferences?
β
PHASE 2 COMPLETE
PHASE 2B β TEST QUALITY REVIEW
Evaluate the quality of each test independently.
Test Quality Issues:
Test 1: default.spec.ts
β
Data correctness: Validates multiple acceptable default values ('None', null, '', undefined) - reasonable
β
Setup: Creates booking before reading localStorage - correct order
β οΈ Too specific: Assumes specific localStorage key format aero_flight_booking_{timestamp} - this is implementation-specific
β οΈ Too specific: Sorts by timestamp in key - assumes implementation detail
Recommended fix: Test should verify booking exists in localStorage without assuming key format. Use a more generic approach or document that key format is part of the spec.
Test 2: dietary_selector_appears_on_details_page_with_all_options.spec.ts
β
Data correctness: Checks for actual option text content using case-insensitive matching
β
Not too specific: Uses .some() to check option existence, allows flexibility in exact wording
β οΈ Too generic: Only checks that options "include" keywords, doesn't verify exact values
β οΈ Assumption: Line 62 expects "at least 8 options" but task lists 7 types - counting "None" is reasonable but not explicit
Recommended fix: Add comment explaining why 8 (7 task types + None default)
Test 3: dietary_selector_preserves_selection_when_form_validation_f.spec.ts
β
Data correctness: Tests with actual value "Vegan"
β
Setup: Proper order - selects meal, then triggers validation
β Too specific: Line 50 expects inputValue() to return exactly "Vegan" - assumes option value equals label
Recommended fix:
TypeScript
// Instead of expecting exact match with label:
const selectedValue = await dietarySelector.inputValue();
expect(selectedValue).toBe('Vegan');
// Should verify selected option text instead:
const selectedText = await dietarySelector.locator('option:checked').textContent();
expect(selectedText).toContain('Vegan');
Already does this on line 72-73, so line 50 assertion is redundant and implementation-specific.
Test 4: dietary_preference_displays_on_user.spec.ts
β
Data correctness: Creates booking with "Vegetarian", then verifies it displays
β
Setup: Proper order - creates data, then navigates to display page
β Too specific: Lines 116-118 use implementation-specific selectors ([data-testid="dietary-icon"], .meal-badge, [class*="dietary"]) that are NOT in task spec
β Independent test: This test creates its own booking and expects to find it - if run after other tests, there may be multiple bookings. Test handles this correctly by filtering.
Recommended fix:
TypeScript
// Task only specifies data-testid="itinerary-card", not meal badge selectors
// Simpler approach: just verify the card contains the dietary text
const cardWithDietary = itineraryCards.filter({ hasText: 'Vegetarian' });
await expect(cardWithDietary.first()).toBeVisible();
// Remove the overly specific badge selector requirement
// The presence of "Vegetarian" text in the card IS the visual indicator
Test 5: user_selects_a_dietary_preference_and_it_saves_with_booking.spec.ts
β
Data correctness: Tests with real value "Vegetarian"
β
Setup: Creates booking before checking storage
β Too specific: Lines 94-110 assume localStorage key format and sorting logic - implementation detail
Recommended fix: Same as Test 1 - either make key format part of spec or use more generic approach
Test 6: user_selects_other.spec.ts
β
Data correctness: Tests with "Other" dietary type
β
Setup: Proper flow
β Too specific: Same localStorage key format assumption as Tests 1 and 5
Cross-Test Independence Issues:
β οΈ Shared state: Multiple tests create bookings in localStorage with same key pattern
β οΈ No cleanup: Tests don't clear localStorage in beforeEach/afterEach
β οΈ Impact: Tests 4, 5, 6, and 1 all create bookings. Test 4 correctly filters for "Vegetarian" so it's isolated, but Tests 1, 5, 6 all grab "most recent" booking by timestamp
Recommended fix:
TypeScript
// Add to each test file or shared setup:
test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:3000');
await page.evaluate(() => {
// Clear all booking data
Object.keys(localStorage)
.filter(key => key.startsWith('aero_flight_booking_'))
.forEach(key => localStorage.removeItem(key));
});
});
Summary of Test Quality Issues:
Implementation-specific localStorage key format - Tests 1, 5, 6 assume specific key pattern
Missing test isolation - No localStorage cleanup between tests
Over-specific selectors in Test 4 - Uses badge selectors not in task spec
Redundant assertion in Test 3 - Line 50 checks implementation detail already covered by line 72-73
β PHASE 2B COMPLETE - ISSUES FOUND
PHASE 3 β IMPLEMENTATION CHECK
Searching for data-testid="dietary-selector"...
Searching for dietary...
Finding files matching '**/0042-implement-dietary-selector/**/*.tsx'
Reading passenger-details.$flightId.tsx
Reading my-trips.tsx
Reading bookingStorage.ts
Implementation Analysis:
File: passenger-details.$flightId.tsx (Passenger Details Page)
Missing Requirements:
β NO dietary selector component - Lines 200-309 contain the entire form, but there is no dietary selector anywhere
β NO data-testid="dietary-selector" attribute
β NO dietary state variable in form state (lines 24-30)
β NO dietary handling in form submission (lines 152-163)
The form has:
Seat preference (lines 201-212)
Personal information fields: firstName, lastName, passportNumber, email, requests (lines 214-289)
No dietary field at all
File: my-trips.tsx (User's Itinerary List)
Missing Requirements:
β NO data-testid="itinerary-card" attribute on booking cards (line 120-213)
β NO dietary display - The itinerary card (lines 124-196) shows:
Airline logo (125-142)
Flight number (146-150)
Date and time (153-172)
Passenger count (175-190)
Confirmation code (192-194)
But NO dietary requirement anywhere
β NO visual indicators for meal types
File: bookingStorage.ts (Data Layer)
Missing Requirements:
β NO dietary field in Booking interface (lines 4-16)
β Dietary preference not saved with booking data
Implementation Status Summary:
ALL requirements are missing from the implementation:
β Dietary selector component on passenger details page
β data-testid="dietary-selector" attribute
β Seven dietary types (Vegetarian, Vegan, Gluten-Free, Halal, Kosher, Nut-Free, Other)
β Dietary saving with booking data
β Dietary field in Booking interface
β Dietary display on itinerary list
β data-testid="itinerary-card" attribute
β Visual indicators for different dietary types
The implementation appears to be the base/starting codebase with NO feature implementation whatsoever.
β PHASE 3 COMPLETE - IMPLEMENTATION MISSING ENTIRELY
PHASE 4 β CROSS-VALIDATION
Task β Tests Alignment:
Task Requirement Covered by Tests? Test Quality
Dietary selector on details page β
Yes (Test 2) Good - checks visibility and options
Seven dietary types β
Yes (Test 2) Good - checks all types exist
Default "None" option β
Yes (Tests 1, 2) Good - validates default behavior
Dietary saves with booking β
Yes (Tests 5, 6) Fair - uses implementation-specific localStorage format
Display on itinerary list β
Yes (Test 4) Fair - uses selectors not in task spec
Visual indicators for meals β οΈ Partial (Test 4) Poor - overly specific selectors
Polished UX β No N/A
Seamless integration β No N/A
Preserve selection on validation error β
Yes (Test 3) Fair - not in task but good practice
Tests β Implementation Alignment:
All tests will fail because no implementation exists.
Task β Implementation Alignment:
All required elements are (MISSING IN IMPLEMENTATION).
Conflicts and Gaps:
(MISSING IN IMPLEMENTATION): Entire feature is unimplemented
(TEST MISMATCH): Test 4 uses badge selectors not specified in task
(TEST MISMATCH): Tests assume localStorage key format aero_flight_booking_{id} which is implementation detail
(TASK GAP): No specification for what "visual indicators" should look like
(TASK GAP): No API contract defined for dietary saving
(MISSING IN TESTS): No test for full booking flow
(MISSING IN TESTS): No tests for individual dietary types besides Vegetarian, Vegan, Other
β PHASE 4 COMPLETE - CRITICAL MISALIGNMENT FOUND
PHASE 5 β FINAL VERDICT
Overall Status: FAIL
The implementation is completely missing. This appears to be the base codebase before any feature development.
CRITICAL BLOCKERS (Must Fix Before Merge):
Zero Implementation
No dietary selector component exists
No dietary field in data model
No meal display on itinerary list
No data-testid attributes
Test Quality Issues Blocking Valid Implementation
localStorage key format assumption: Tests 1, 5, 6 hardcode aero_flight_booking_{timestamp} pattern
Missing test isolation: No localStorage cleanup between tests will cause cross-contamination
Over-specific selectors in Test 4: Uses .meal-badge, [data-testid="dietary-icon"] which aren't in task spec
MINOR ISSUES (Should Fix, Non-Blocking):
Test 3 Redundant Assertion: Line 50 checks inputValue() === "Vegan" which assumes value equals label
Test Coverage Gaps (missing full flow, backward compatibility, and checks for all 7 meal options).
Task Specification Gaps (missing visual specs, API details).
RECOMMENDED FIXES:
For Tests (Before Implementation):
TypeScript
// Add to each test file:
test.beforeEach(async ({ page }) => {
// Clear all booking data for test isolation
await page.evaluate(() => {
Object.keys(localStorage)
.filter(key => key.startsWith('aero_flight_booking_'))
.forEach(key => localStorage.removeItem(key));
});
});
TypeScript
// Test 4: Simplify dietary display verification
// REMOVE over-specific badge selectors
// REPLACE lines 116-121 with:
const cardWithDietary = itineraryCards.filter({ hasText: 'Vegetarian' });
await expect(cardWithDietary.first()).toBeVisible();
// Text presence IS the visual indicator - no need to check for specific badge classes
For Implementation:
Add dietary field to Booking interface (bookingStorage.ts):
TypeScript
export interface Booking {
// ...existing fields
dietaryPreference?: string; // Vegetarian, Vegan, Gluten-Free, etc.
}
Add dietary selector to passenger details form (passenger-details.$flightId.tsx):
TypeScript
// Add state:
const [dietary, setDietary] = useState("None");
// Add before form fields (around line 240):
<div className="mb-4">
<label className="mb-1 block text-xs text-gray-600">Dietary Requirements (Optional)</label>
<select
data-testid="dietary-selector"
name="dietary"
value={dietary}
onChange={(e) => setDietary(e.target.value)}
className="w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none"
>
<option value="None">None</option>
<option value="Vegetarian">Vegetarian</option>
<option value="Vegan">Vegan</option>
<option value="Gluten-Free">Gluten-Free</option>
<option value="Halal">Halal</option>
<option value="Kosher">Kosher</option>
<option value="Nut-Free">Nut-Free</option>
<option value="Other">Other</option>
</select>
</div>
Add dietary display to itinerary cards (my-trips.tsx):
TypeScript
// Add data-testid to card (line 120):
<div
key={booking.id}
data-testid="itinerary-card"
className="rounded-lg border border-gray-200 bg-white p-6 shadow-sm transition-shadow hover:shadow-md"
>
// Add dietary display after passenger count (around line 194):
{booking.dietaryPreference && booking.dietaryPreference !== 'None' && (
<div className="mt-1 text-sm text-gray-700">
<span className="font-medium">Meal:</span> {booking.dietaryPreference}
</div>
)}
SUMMARY:
Status: β FAIL - No implementation exists
Blocker Count: 2 critical (zero implementation + test quality issues)
Confidence Level: 100% - The codebase clearly lacks any dietary selector functionality
Recommendation: Do not merge. Implement the feature following the test specifications, but first fix the test quality issues to avoid building to broken specs.
By purchasing this prompt, you agree to our terms of service
CLAUDE-4-6-SONNET
Tests green but feature broken? This prompt runs a 6-phase QA audit β verifying task spec, test quality, and implementation in one pass.
πΉ Catches bad assertions, wrong data & localStorage timing bugs
β
Works with Cypress, Playwright, Jest, Vitest
πΉ Detects tests polluting each other's state
β
PASS / FAIL / NEEDS REVIEW final verdict
πΉ Suggests concrete fixes, not just flags
...more
Added 2 days ago
