Skip to content

Commit 391e5f8

Browse files
committed
Debug headache logs test
1 parent 6947b30 commit 391e5f8

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

test/system/headache_logs_test.rb

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,27 @@ class HeadacheLogsTest < ApplicationSystemTestCase
5757
click_on "Update Log"
5858
assert_current_path edit_headache_log_path(log)
5959

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
6572
click_button "Update Headache log"
6673

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
7277
end
78+
79+
assert_current_path headache_log_path(log)
80+
assert_text "Headache log was successfully updated"
7381
end
7482

7583
test "filtering headache logs" do

0 commit comments

Comments
 (0)