Skip to content

Commit

Permalink
Fixed system tests
Browse files Browse the repository at this point in the history
  • Loading branch information
crmne committed Dec 28, 2024
1 parent d25bd97 commit 143c0bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ PrePush:
required_executable: 'git-lfs'
flags: ['pre-push']

SystemTests:
enabled: true
command: ['bundle', 'exec', 'rails', 'test:system']

PostCheckout:
ALL: # Special hook name that customizes all hooks of this type
quiet: true # Change all post-checkout hooks to only display output on failure
Expand Down
13 changes: 1 addition & 12 deletions test/system/headache_logs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class HeadacheLogsTest < ApplicationSystemTestCase
test "marking ongoing headache as complete" do
# Create an ongoing headache log
log = headache_logs(:one)
end_time = log.end_time
log.update(end_time: nil)

# Visit the headache logs page
Expand All @@ -60,23 +61,11 @@ class HeadacheLogsTest < ApplicationSystemTestCase
assert_current_path edit_headache_log_path(log)

# Fill in the end time with the current time
end_time = headache_logs(:one).end_time
fill_in "End Time", with: end_time

# Debug output
puts "Form values before submission:"
puts "Start time: #{find_field('Start Time').value}"
puts "End time: #{find_field('End Time').value}"
puts "Intensity: #{find_field('Intensity').value}"

# Submit the form and wait for the update
click_button "Update Headache log"

if page.has_css?(".alert")
puts "Validation errors found:"
puts page.find(".alert").text
end

# Verify the success message and that "Ongoing" is no longer present
assert_text "Headache log was successfully updated"
assert_no_text "Ongoing Headache"
Expand Down

0 comments on commit 143c0bf

Please sign in to comment.