@@ -57,19 +57,27 @@ class HeadacheLogsTest < ApplicationSystemTestCase
57
57
click_on "Update Log"
58
58
assert_current_path edit_headache_log_path ( log )
59
59
60
- # Fill in the end time with current time
61
- end_time = Time . current . strftime ( "%Y-%m-%dT%H:%M" )
62
- fill_in "End Time" , with : end_time
63
-
64
- # Submit and wait for the success path
60
+ # Fill in all required fields, not just end_time
61
+ fill_in "Start Time" , with : log . start_time . strftime ( "%Y-%m-%dT%H:%M" )
62
+ fill_in "End Time" , with : Time . current . strftime ( "%Y-%m-%dT%H:%M" )
63
+ fill_in "Intensity" , with : log . intensity
64
+
65
+ # Debug output
66
+ puts "Form values before submission:"
67
+ puts "Start time: #{ find_field ( 'Start Time' ) . value } "
68
+ puts "End time: #{ find_field ( 'End Time' ) . value } "
69
+ puts "Intensity: #{ find_field ( 'Intensity' ) . value } "
70
+
71
+ # Submit form and debug any validation errors
65
72
click_button "Update Headache log"
66
73
67
- # Use Capybara's built-in waiting mechanism
68
- using_wait_time ( 5 ) do # Increase default wait time for this block
69
- assert_current_path headache_log_path ( log )
70
- assert_text "Headache log was successfully updated"
71
- assert_no_text "Ongoing Headache"
74
+ if page . has_css? ( ".alert" )
75
+ puts "Validation errors found:"
76
+ puts page . find ( ".alert" ) . text
72
77
end
78
+
79
+ assert_current_path headache_log_path ( log )
80
+ assert_text "Headache log was successfully updated"
73
81
end
74
82
75
83
test "filtering headache logs" do
0 commit comments