Fix Flaky Tests / Optimize Checking of `plan.title` Within `spec/features/plans/exports_spec.rb` by aaronskiba · Pull Request #3451 · DMPRoadmap/roadmap
Navigation Menu
- Notifications You must be signed in to change notification settings
- Fork 118
Conversation
Fixes #3450
Changes proposed in this PR:
- Fixes the flaky tests within
spec/features/plans/exports_spec.rb(see Some Selenium/Features Tests Breaking (Independent of Code Changes) #3450)- While inspecting these sometimes failing tests, it was found that
expect(page.source).to have_text(plan.title)sometimes failed because sometimespage.source == "". - Rather than
page.source, which returns the entire HTML content of the page, this PR usespage.title, which only returns the contents inside of the<title>tags.page.titledoes not seem to encounter the unwanted behaviour of returning a blank string. Maybe because it is faster (only returning the title should be faster than returning the entire HTML content viapage.source)?- Also, the
<title>title tags and their contents are part of the entire HTML content. So despitepage.sourcereturning a blank string, becausepage.titleis not blank, it follows that the DOM is not blank.
- While inspecting these sometimes failing tests, it was found that
This commit replaces `page.source` with (the hopefully more efficient) `page.title` for verifying the page title. Checking the entire page source was potentially causing slowdowns and leading to the intermittent failing of tests within this file.
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