<p dir="auto">This PR switches to using <code>assert_content</code> (and <code>assert_link</code>) from Capybara's list of assertions, instead of using a plain assert on the Capybara node matchers (e.g. assert page.has_content?).</p>
<p dir="auto">This makes little difference when the tests are working, but the error messages are much more helpful when the tests fail (e.g. during development or refactoring). The previous approach led to "Expected false to be truthy" which is not super helpful to debug!</p>
<p dir="auto">Example for <code>assert_content</code>:</p>
<div class="highlight highlight-source-diff position-relative overflow-auto" data-snippet-clipboard-copy-content=" Failure:
DiaryEntrySystemTest#test_reply_to_diary_entry_should_prefill_the_message_subject [/test/system/diary_entry_test.rb:15]:
- Expected false to be truthy.
+ expected to find text "Receive a new message" in "OpenStreetMap\nEdit\nHistory\nExport\nGPS Traces\nUser Diaries\nCopyright\nHelp\nAbout\nUser 5\nSend a new message to User 4\nSubject\nBody\nParsed with kramdown\nHeadings\n# Heading\n## Subheading\nUnordered list\n* First item\n* Second item\nOrdered list\n1. First item\n2. Second item\nLink\n[Text](URL)\nImage\n\nBack to inbox""><pre> Failure:
DiaryEntrySystemTest#test_reply_to_diary_entry_should_prefill_the_message_subject [/test/system/diary_entry_test.rb:15]:
<span class="pl-md"><span class="pl-md">-</span> Expected false to be truthy.</span>
<span class="pl-mi1"><span class="pl-mi1">+</span> expected to find text "Receive a new message" in "OpenStreetMap\nEdit\nHistory\nExport\nGPS Traces\nUser Diaries\nCopyright\nHelp\nAbout\nUser 5\nSend a new message to User 4\nSubject\nBody\nParsed with kramdown\nHeadings\n# Heading\n## Subheading\nUnordered list\n* First item\n* Second item\nOrdered list\n1. First item\n2. Second item\nLink\n[Text](URL)\nImage\n\nBack to inbox"</span></pre></div>
<p dir="auto">Example for <code>assert_link</code>:</p>
<div class="highlight highlight-source-diff position-relative overflow-auto" data-snippet-clipboard-copy-content=" IssuesTest#test_issue_index_with_multiple_roles [/test/system/issues_test.rb:116]:
- Expected false to be truthy.
+ expected to find link "5 Reports" with href "/issues/446" but there were no matches"><pre> IssuesTest#test_issue_index_with_multiple_roles [/test/system/issues_test.rb:116]:
<span class="pl-md"><span class="pl-md">-</span> Expected false to be truthy.</span>
<span class="pl-mi1"><span class="pl-mi1">+</span> expected to find link "5 Reports" with href "/issues/446" but there were no matches</span></pre></div>
<p dir="auto"><a href="https://rubydoc.info/github/teamcapybara/capybara/master/Capybara/Minitest/Assertions" rel="nofollow">https://rubydoc.info/github/teamcapybara/capybara/master/Capybara/Minitest/Assertions</a></p>
<hr>
<h4>You can view, comment on, or merge this pull request online at:</h4>
<p> <a href='https://github.com/openstreetmap/openstreetmap-website/pull/3411'>https://github.com/openstreetmap/openstreetmap-website/pull/3411</a></p>
<h4>Commit Summary</h4>
<ul>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/commits/d257c217405efb042b1507c3d134f3912e0e7a98" class="commit-link">d257c21</a> Use `assert_content` instead of `assert page.has_content?`</li>
<li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/commits/7bdb7fbcf82f54d8cbf2cb63c5daa69bccb6f3ae" class="commit-link">7bdb7fb</a> Use `assert_link` instead of `assert page.has_link?`</li>
</ul>
<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files">10 files</a>)</p>
<ul>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files#diff-6a9ebe0fb9027782384e3e1db9e38d6e050d8e4b4be87a3b3c2cfae599541028">test/system/confirmation_resend_test.rb</a>
(4)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files#diff-b15ae6b3ee8024d95283cd30583f56c5676abef445ea59706c47c7671b563c59">test/system/diary_entry_test.rb</a>
(12)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files#diff-1937855845d794c2ab6ec4812a8b4e3230c470b69ff763285bdd810915042839">test/system/issues_test.rb</a>
(32)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files#diff-438a28e87e15ffd1467ef5a78d0246450a6f97a92cdda70d857fb7548465c447">test/system/preferences_test.rb</a>
(4)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files#diff-044ff793904477349d5d321ac1deb9c29007b9fe9ad45b2ba36a737532fd1c9a">test/system/report_diary_comment_test.rb</a>
(12)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files#diff-9f1f22915e6ab6ed93dcabe9188d6288ea0f2e37283bfdff1e9cb79d15bf09b6">test/system/report_diary_entry_test.rb</a>
(20)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files#diff-8358a7e67a0668bb274231cf66a04040514feaf99359175ea3b51a8306979081">test/system/report_note_test.rb</a>
(16)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files#diff-57c59e735efb356e2a24b9fb26199792d98a0749cf882be51d34ba637c9ebcfa">test/system/report_user_test.rb</a>
(22)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files#diff-74ac87b606b7341e190b3117505821b596638e8a5aadf4350b780472b2e54285">test/system/user_logout_test.rb</a>
(24)
</li>
<li>
<strong>M</strong>
<a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411/files#diff-18d5b788986f58ce72b0d22695d761f641291806f2abd7e076552194de3bf74b">test/system/user_signup_test.rb</a>
(2)
</li>
</ul>
<h4>Patch Links:</h4>
<ul>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/3411.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/3411.patch</a></li>
<li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/3411.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/3411.diff</a></li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/3411">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLJHGGFEXHQ7XLJ76YLUUWLIZANCNFSM5LMLEGVA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLPML7DROYA6OZO7MELUUWLIZA5CNFSM5LMLEGVKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4QKJMOFA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/3411</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/3411",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/3411",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>