This PR reorganizes the rails_helper.rb file, adding in Capybara support for feature tests and the ability to use helper functions.
When I moved the Capybara into the rails_helper.rb file, I discovered that some broken tests were being masked by non-functioning javascript testing, and that one of the tests was actually written in minitest insetad of rspec.
File changes:
spec/features/admin_user_spec.rb
Add filling in mandatory date field for cons. record creation
spec/features/end_to_end_spec.rb
Removed now-redundant Capybara setup
Standard user
Add missing staff code for in-house repair field
Add filling in mandatory date field for cons. record creation
Corrected click target "Condition" to "Treatment Proposal"
Add confirming to cons. record deletion
Admin user
Add missing staff code for in-house repair field
Add filling in mandatory date field for cons. record creation
Add confirming to in-house and external repair record deletion
Refactor 200-status check for confirming PDF generation due to type of Capybara being used not supporting expect(page.status_code).to eq(200)
Corrected location for "Details" link
spec/features/read_only_user_spec.rb
Removed now-redundant Capybara setup
spec/features/standard_user_spec.rb
Add filling in mandatory date field for cons. record creation
Helper module that checks that when a pdf download link is clicked, a 200-code is returned. Follows redirects as needed. Will print (puts) end result if 200-status is not reached.
spec/rails_helper.rb
Explicitly require dotenv and load testing environment
Clarify to set env to "test" if in "development", allowing for aborting tests if in production
Set up Capybara
Loaded support helper files
Explicitly loaded feature support modules for Devise, as well as Authentication and PDF-checking modules
Removed unnecessary comments, clarified some comments, rearranged lines for clarity and best function
Refactored non-functioning tests from minitest to rspec 😱
Corrected broken pagy setup
Corrected inaccurate Pagy test check from '<1>' to match(/>\s*1\s*</) which will look for a visible text of "> 1 <", allowing for unspecified whitespace around the "1". There will only be 2 records, so there won't be more than 1 page.
Ref #214
This PR reorganizes the rails_helper.rb file, adding in Capybara support for feature tests and the ability to use helper functions.
When I moved the Capybara into the rails_helper.rb file, I discovered that some broken tests were being masked by non-functioning javascript testing, and that one of the tests was actually written in minitest insetad of rspec.
File changes:
expect(page.status_code).to eq(200)
puts
) end result if 200-status is not reached.'<1>'
tomatch(/>\s*1\s*</)
which will look for a visible text of "> 1 <", allowing for unspecified whitespace around the "1". There will only be 2 records, so there won't be more than 1 page.