Closed crmne closed 2 weeks ago
Still trying to get my local env set up to run (Rails 8, nice!)
I'm looking at your test/system/headache_logs_test.rb
file, and at the fill_in
method calls on lines 22 and 55
I think fill_in
is case-sensitive, so it is looking for "Start time" and "End time", when the screen shots have an uppercase T in Time for both fields.
I'll see if I can confirm once my old clunky MacBook has finished updating rbenv and installing Ruby 3.3.5
Yeah, I've got test/system/headache_logs_test.rb
passing now.
I don't think I have permissions to push up a branch though.
I'll call it a day for now, as it's almost 1AM here 😴
diff --git a/test/system/headache_logs_test.rb b/test/system/headache_logs_test.rb
index 4d5febc..dd46230 100644
--- a/test/system/headache_logs_test.rb
+++ b/test/system/headache_logs_test.rb
@@ -10,7 +10,7 @@ class HeadacheLogsTest < ApplicationSystemTestCase
test "visiting the index" do
visit headache_logs_url
- assert_selector "h1", text: "Headache Logs"
+ assert_selector "div.navbar-center", text: "Headache Logs"
assert_selector ".stats", count: 1
assert_selector ".card", minimum: 1
end
@@ -19,7 +19,7 @@ class HeadacheLogsTest < ApplicationSystemTestCase
visit headache_logs_url
click_on "New"
- fill_in "Start time", with: Time.current.strftime("%Y-%m-%dT%H:%M")
+ fill_in "Start Time", with: Time.current.strftime("%Y-%m-%dT%H:%M")
fill_in "Intensity", with: 7
fill_in "Medication", with: "Sumatriptan + Oxygen"
fill_in "Triggers", with: "Lack of sleep, Stress"
@@ -52,7 +52,7 @@ class HeadacheLogsTest < ApplicationSystemTestCase
assert_text "Ongoing"
click_on "Update Log"
- fill_in "End time", with: Time.current.strftime("%Y-%m-%dT%H:%M")
+ fill_in "End Time", with: Time.current.strftime("%Y-%m-%dT%H:%M")
click_on "Update Headache log"
assert_text "Headache log was successfully updated"
@@ -61,8 +61,8 @@ class HeadacheLogsTest < ApplicationSystemTestCase
test "filtering headache logs" do
visit headache_logs_url
- click_on "Filters"
-
+ open_accordion("filters")
+
fill_in "Start Date", with: Date.yesterday
fill_in "End Date", with: Date.tomorrow
fill_in "Triggers", with: "Sleeping"
@@ -74,8 +74,8 @@ class HeadacheLogsTest < ApplicationSystemTestCase
test "generating and copying share link" do
visit headache_logs_url
- click_on "Share with Healthcare Provider"
- click_on "Generate Share Link"
+ open_accordion("share")
+ click_on "Generate New Link"
assert_text "Share link generated successfully"
@@ -92,4 +92,12 @@ class HeadacheLogsTest < ApplicationSystemTestCase
assert_text "Successfully imported"
end
+
+ def open_accordion(data_attribute)
+ # Locate the accordion using the data attribute selector
+ accordion = find("details[data-accordion=\"#{data_attribute}\"]")
+ accordion.click
+
+ assert_selector "details[open][data-accordion=\"#{data_attribute}\"]"
+ end
end
Hi @PhilTee thank you so much for the fix!
In order to push a fix you need to make a Pull Request, which will enable you to get credit for your work since your name will be associated with the commit, and will enable me to do a code review. Here's the step by step guide:
Haha! Sorry, I forgot to fork the repo first! The dangers of playing at silly o'clock! I'll get this done later today. Have a good one! 🙌🏻
PR submitted for this issue here: https://github.com/crmne/cluster-headache-tracker/pull/69
All tests passing within the PR, including the system tests.
fill_in
issue resolved
added helper method to ApplicationSystemTestCase
allowing Capybara to open accordions
Logic of one test has had to be changed in the generating and copying share link
test.
The user already had a share link, so when the modal is opened the Generate New Link button is displayed instead of the Generate Share Link button. Hope that's ok.
Great work @PhilTee !
Great work @PhilTee !
Thanks! Anything else I can take a look at?
Thanks! Anything else I can take a look at?
Thank you! There's this issue about a new feature that would introduce separate medication tracking from headache tracking. The concept is not fully fleshed out, and the UI would need to be thought about more in depth, but happy to have discussions on the other issue about it!
Describe the bug When running
rails test test:system
tests pass successfully, but not when usinggit push
, which fires up the tests viaovercommit
, or in GitHub CI.To Reproduce Steps to reproduce the behavior:
git push
Expected behavior Tests passing.
Screenshots
Desktop (please complete the following information):
Additional context GitHub CI logs: https://github.com/crmne/cluster-headache-tracker/actions/runs/11583716798/job/32249432330
These are the git push logs: