Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

214 - merge into feature branch - Update rails_helper.rb and fix broken tests #470

Conversation

Janell-Huyck
Copy link
Contributor

@Janell-Huyck Janell-Huyck commented Apr 19, 2024

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:

  • 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
  • spec/features/support/helpers/authentication_helpers.rb
    • Created skeleton so that it could be imported in rails_helper.rb
  • spec/features/support/helpers/pdf_download_helpers.rb
    • 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
  • spec/views/conservation_records/index.html.erb_spec.rb
    • 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.

@Janell-Huyck Janell-Huyck changed the title Update rails_helper.rb and fix broken tests 214 - merge into feature branch - Update rails_helper.rb and fix broken tests Apr 19, 2024
@crowesn crowesn self-assigned this Apr 19, 2024
@Janell-Huyck Janell-Huyck force-pushed the 214-refactor-end-to-end-with-shared-examples branch from 253fa91 to fb23352 Compare April 19, 2024 17:50
@Janell-Huyck Janell-Huyck deleted the branch 214-refactor-end-to-end-with-shared-examples April 19, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants