Refactor Conditional Questions Tests by aaronskiba · Pull Request #3522 · DMPRoadmap/roadmap
added 9 commits
May 6, 2025 13:32- The `expect(page).to have_text('Answered just now')` was could not be relied upon to perform the desired check for the saved answer. This is because 'Answered just now' is rendered for many answers on the page, rather than just the newly answered one.
- This change also removes all `click_button 'Save'` executions. This code already appears to be absent from some saved answers. In addition, all of the saves seem to be auto-executed so this change makes the tests more consistent and removes redundancy.
- Some refactoring has also been performed.
Removed the overall number of questions and answers in the two changed files. This change should improve test completion speed without affecting test quality.
Previously, `spec/features/questions/conditions_questions_spec.rb` tested `remove_data` and `add_webhook` functionality separately for each question type: checkbox, radiobutton, and dropdown. While thorough, this approach added a lot of overhead to test execution time. This change reduces that overhead by randomly choosing only one of checkbox, radiobutton, or dropdown for each of the tests. Over time, repeated executions via the GitHub Actions should ensure that all types continue to be exercised, maintaining coverage while also improving overall test time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters