[openstreetmap/openstreetmap-website] WIP: Reduce use of Selenium in favour of rack-test (PR #6497)
Andy Allan
notifications at github.com
Wed Dec 3 19:18:44 UTC 2025
gravitystorm left a comment (openstreetmap/openstreetmap-website#6497)
> I don't know if there's a way to do similar tagging with minitest
* https://github.com/ordinaryzelig/minispec-metadata - but this only works if we're already using the [spec syntax](https://github.com/minitest/minitest?tab=readme-ov-file#label-Specs) which would be a *ton* of work - almost at the "might as well use rspec" level of effort, perhaps.
* https://github.com/bernardoamc/minitag - 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. `before` blocks can use to switch drivers. I could be wrong on this. I'm not keen on the syntax.
So I think the only approach is to be more explicit with choosing the driver in each class or in specific tests. Something like:
```ruby
class MixedDriverTest < ApplicationSystemTestCase
driven_by :rack_test # default
test "simple non-JS test" do
visit "/status"
assert_text "OK"
end
test "switch to selenium just for this test" do
using_driver(:selenium, using: :chrome) do
visit "/dashboard"
# JS interactions here
assert_selector ".map"
end
end
end
```
I would probably default to `:rack_test` at the `ApplicationSystemTestCase` level, and then provide a custom method in place of the `using_driver` stuff, for ease of refactoring and being more explicit as to why we're doing it e.g.
```ruby
test "switch to selenium just for this test" do
using_javascript do
visit "/dashboard"
# JS interactions here
assert_selector ".map"
end
end
```
I'd be interested in a comparison of test suite runtimes, to see if it's worthwhile.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6497#issuecomment-3608451593
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/6497/c3608451593 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251203/a5b87606/attachment.htm>
More information about the rails-dev
mailing list