-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to use System Tests #1473
Conversation
bd22b2b
to
8287a28
Compare
b22e821
to
1dc9643
Compare
Migrate from the `rspec-rails`-provided Feature Tests, to the Rails-provided [System Tests]. The most beneficial outcome of this migration is the ability to rely on [`use_transactional_fixtures = true`][transactional-fixtures] in browser-driven (JavaScript-enabled). In order to be System Test compatible, this commit replaces test block declarations made with `feature` with `RSpec.describe`, along with calls to `scenario` with `it`. In order to continue to support `rails@4.2` and `rails@5.0`, the test harness must elect to run `type: :feature` tests when [`ActionDispatch::SystemTestCase`][system-test-care] is not declared. In those cases, to preserve compatibility: * pass `type: :feature` instead of `type: :system` to tests declared in `spec/system` * require `database_cleaner` gem, along with Feature-test compatible configuration To achieve this, this commit introduces the `SYSTEM_TEST` constant, which refers to the correct `type:` option: `:feature` for older versions of Rails, `:system` for newer versions. Once support for `rails@4.2` and `rails@5.0` is dropped, these declarations can be removed, and `type: SYSTEM_TEST` options can be search-and-replaced with `type: :system`. [System Tests]: https://guides.rubyonrails.org/v5.1/testing.html#system-testing [transactional-fixtures]:https://relishapp.com/rspec/rspec-rails/v/3-6/docs/transactions [system-test-case]: https://api.rubyonrails.org/v5.1/classes/ActionDispatch/SystemTestCase.html
949a3e1
to
a2f3ff5
Compare
@seanpdoyle, is this something you'd like to continue with? I realise it's been a while and there's a few conflicts but I'm not adverse to switching to use the new system tests. |
@nickcharlton wow, I've forgotten about this. I don't have enough context on the codebase to estimate the effort involved in resolving these conflicts. If you don't see a direct path toward resolution, we could close this. That being said, I do think that adopting System Tests and Chromedriver would be valuable. |
Hah, no worries! I'm going to close this for now, as I'm not really sure either how much more work there would be. Since, we have switched to Chromedriver, so that's been a big improvement anyway. Thanks for opening this way back when! |
Migrate from the
rspec-rails
-provided Feature Tests, to theRails-provided System Tests.
The most beneficial outcome of this migration is the ability to rely on
use_transactional_fixtures = true
inbrowser-driven (JavaScript-enabled).
In order to be System Test compatible, this commit replaces test block
declarations made with
feature
withRSpec.describe
, along with callsto
scenario
withit
.In order to continue to support
rails@4.2
andrails@5.0
, the testharness must elect to run
type: :feature
tests when[
ActionDispatch::SystemTestCase
][system-test-care] is not declared.In those cases, to preserve compatibility:
type: :feature
instead oftype: :system
to tests declared inspec/system
database_cleaner
gem, along with Feature-test compatibleconfiguration
To achieve this, this commit introduces the
SYSTEM_TEST
constant,which refers to the correct
type:
option::feature
for olderversions of Rails,
:system
for newer versions.Once support for
rails@4.2
andrails@5.0
is dropped, thesedeclarations can be removed, and
type: SYSTEM_TEST
options can besearch-and-replaced with
type: :system
.