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/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to