From 6947b30cc14c918d445493bede98a1142f6021ff Mon Sep 17 00:00:00 2001 From: Carmine Paolino Date: Sat, 28 Dec 2024 11:49:49 +0100 Subject: [PATCH] Increment wait time for test --- test/system/headache_logs_test.rb | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/test/system/headache_logs_test.rb b/test/system/headache_logs_test.rb index 861bb23..68cb616 100644 --- a/test/system/headache_logs_test.rb +++ b/test/system/headache_logs_test.rb @@ -51,8 +51,6 @@ class HeadacheLogsTest < ApplicationSystemTestCase # Visit the headache logs page visit headache_logs_url - - # Verify we see the "Ongoing" status assert_text "Ongoing" # Click through to edit the log @@ -60,18 +58,18 @@ class HeadacheLogsTest < ApplicationSystemTestCase assert_current_path edit_headache_log_path(log) # Fill in the end time with current time - end_time = Time.current + 12.hours - fill_in "End Time", with: end_time.strftime("%Y-%m-%dT%H:%M") + end_time = Time.current.strftime("%Y-%m-%dT%H:%M") + fill_in "End Time", with: end_time - # Ensure we click the right button and wait for the update + # Submit and wait for the success path click_button "Update Headache log" - # Add explicit assertion for successful navigation - assert_current_path headache_log_path(log) - - # Now check for success message and status change - assert_text "Headache log was successfully updated" - assert_no_text "Ongoing Headache" + # Use Capybara's built-in waiting mechanism + using_wait_time(5) do # Increase default wait time for this block + assert_current_path headache_log_path(log) + assert_text "Headache log was successfully updated" + assert_no_text "Ongoing Headache" + end end test "filtering headache logs" do