<div style="display: flex; flex-wrap: wrap; white-space: pre-wrap; align-items: center; "><img height="20" width="20" style="border-radius:50%; margin-right: 4px;" decoding="async" src="https://avatars.githubusercontent.com/u/360803?s=20&v=4" /><strong>gravitystorm</strong> left a comment <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6497#issuecomment-3608451593">(openstreetmap/openstreetmap-website#6497)</a></div>
<blockquote>
<p dir="auto">I don't know if there's a way to do similar tagging with minitest</p>
</blockquote>
<ul dir="auto">
<li><a href="https://github.com/ordinaryzelig/minispec-metadata">https://github.com/ordinaryzelig/minispec-metadata</a> - but this only works if we're already using the <a href="https://github.com/minitest/minitest?tab=readme-ov-file#label-Specs">spec syntax</a> which would be a <em>ton</em> of work - almost at the "might as well use rspec" level of effort, perhaps.</li>
<li><a href="https://github.com/bernardoamc/minitag">https://github.com/bernardoamc/minitag</a> - as far as I can tell, this is only useful for choosing which tests to run, rather than being a source of metadata that e.g. <code class="notranslate">before</code> blocks can use to switch drivers. I could be wrong on this. I'm not keen on the syntax.</li>
</ul>
<p dir="auto">So I think the only approach is to be more explicit with choosing the driver in each class or in specific tests. Something like:</p>
<div class="highlight highlight-source-ruby" dir="auto"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">MixedDriverTest</span> < <span class="pl-v">ApplicationSystemTestCase</span>
<span class="pl-en">driven_by</span> <span class="pl-pds">:rack_test</span> <span class="pl-c"># default</span>
<span class="pl-en">test</span> <span class="pl-s">"simple non-JS test"</span> <span class="pl-k">do</span>
<span class="pl-en">visit</span> <span class="pl-s">"/status"</span>
<span class="pl-en">assert_text</span> <span class="pl-s">"OK"</span>
<span class="pl-k">end</span>
<span class="pl-en">test</span> <span class="pl-s">"switch to selenium just for this test"</span> <span class="pl-k">do</span>
<span class="pl-en">using_driver</span><span class="pl-kos">(</span><span class="pl-pds">:selenium</span><span class="pl-kos">,</span> <span class="pl-pds">using</span>: <span class="pl-pds">:chrome</span><span class="pl-kos">)</span> <span class="pl-k">do</span>
<span class="pl-en">visit</span> <span class="pl-s">"/dashboard"</span>
<span class="pl-c"># JS interactions here</span>
<span class="pl-en">assert_selector</span> <span class="pl-s">".map"</span>
<span class="pl-k">end</span>
<span class="pl-k">end</span>
<span class="pl-k">end</span></pre></div>
<p dir="auto">I would probably default to <code class="notranslate">:rack_test</code> at the <code class="notranslate">ApplicationSystemTestCase</code> level, and then provide a custom method in place of the <code class="notranslate">using_driver</code> stuff, for ease of refactoring and being more explicit as to why we're doing it e.g.</p>
<div class="highlight highlight-source-ruby" dir="auto"><pre class="notranslate"> <span class="pl-en">test</span> <span class="pl-s">"switch to selenium just for this test"</span> <span class="pl-k">do</span>
<span class="pl-en">using_javascript</span> <span class="pl-k">do</span>
<span class="pl-en">visit</span> <span class="pl-s">"/dashboard"</span>
<span class="pl-c"># JS interactions here</span>
<span class="pl-en">assert_selector</span> <span class="pl-s">".map"</span>
<span class="pl-k">end</span>
<span class="pl-k">end</span></pre></div>
<p dir="auto">I'd be interested in a comparison of test suite runtimes, to see if it's worthwhile.</p>
<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/6497#issuecomment-3608451593">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLIVWFYJQOHSWJIIOCL374ZRJAVCNFSM6AAAAACLAA4NUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMBYGQ2TCNJZGM">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLPO3PYYNLVV5YGIPGD374ZRJA5CNFSM6AAAAACLAA4NUKWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTWXCSNAS.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/6497/c3608451593</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/6497#issuecomment-3608451593",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/6497#issuecomment-3608451593",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>