aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/system_testing/system_test_case_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Permit running jobs in system testsGeorge Claghorn2019-05-161-37/+0
| | | | | Inherit from ActiveSupport::TestCase instead of ActionDispatch::IntegrationTest. Active Job automatically mixes its test helper into the latter, forcibly setting the test queue adapter before Capybara starts its app server. As a bonus, we no longer need to remove the parts of the ActionDispatch::IntegrationTest API we don’t want to expose.
* Add `require "selenium/webdriver"` to all using `DrivenBySeleniumWith*` classesRyuta Kamizono2019-01-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | https://travis-ci.org/rails/rails/jobs/486285170#L1349-L1366 ``` % git grep -n DrivenBySeleniumWith test/abstract_unit.rb:374:class DrivenBySeleniumWithChrome < ActionDispatch::SystemTestCase test/abstract_unit.rb:378:class DrivenBySeleniumWithHeadlessChrome < ActionDispatch::SystemTestCase test/abstract_unit.rb:382:class DrivenBySeleniumWithHeadlessFirefox < ActionDispatch::SystemTestCase test/dispatch/system_testing/screenshot_helper_test.rb:10: new_test = DrivenBySeleniumWithChrome.new("x") test/dispatch/system_testing/screenshot_helper_test.rb:18: new_test = DrivenBySeleniumWithChrome.new("x") test/dispatch/system_testing/screenshot_helper_test.rb:28: new_test = DrivenBySeleniumWithChrome.new("x") test/dispatch/system_testing/screenshot_helper_test.rb:40: new_test = DrivenBySeleniumWithChrome.new("x") test/dispatch/system_testing/screenshot_helper_test.rb:48: new_test = DrivenBySeleniumWithChrome.new("x") test/dispatch/system_testing/screenshot_helper_test.rb:62: new_test = DrivenBySeleniumWithChrome.new("x") test/dispatch/system_testing/screenshot_helper_test.rb:76:class SeleniumScreenshotsTest < DrivenBySeleniumWithChrome test/dispatch/system_testing/system_test_case_test.rb:11:class OverrideSeleniumSubclassToRackTestTest < DrivenBySeleniumWithChrome test/dispatch/system_testing/system_test_case_test.rb:19:class SetDriverToSeleniumTest < DrivenBySeleniumWithChrome test/dispatch/system_testing/system_test_case_test.rb:25:class SetDriverToSeleniumHeadlessChromeTest < DrivenBySeleniumWithHeadlessChrome test/dispatch/system_testing/system_test_case_test.rb:31:class SetDriverToSeleniumHeadlessFirefoxTest < DrivenBySeleniumWithHeadlessFirefox test/dispatch/system_testing/system_test_case_test.rb:49:class UndefMethodsTest < DrivenBySeleniumWithChrome ```
* Add headless firefox driver to System Testsbogdanvlviv2017-12-071-0/+6
|
* Add headless chrome driver to System Testsyuuji.yaginuma2017-10-171-0/+6
|
* Exception message for SystemTestCase#get etc..yalab2017-10-081-5/+10
|
* Use frozen string literal in actionpack/Kir Shatrov2017-07-291-0/+2
|
* SystemTestCase undef some IntegrationTest methods because it's confused to use.yalab2017-07-011-0/+32
|
* Set `Capybara.app_host` through `host!`Fumiaki MATSUSHIMA2017-04-021-0/+12
| | | | | | | | | | | | | | | | | | | | | `visit "/"` will visit always "http://127.0.0.1" even when we call `host!`: ```ruby class SomeTest < ApplicationSystemTest def setup host! "http://example.com" end def test_visit visit root_url # => visit "http://example.com/" visit "/" # => visit "http://127.0.0.1/" end end ``` Because Capybara assumes that host is same as the server if we don't set `Capybara.app_host`: https://github.com/teamcapybara/capybara/blob/866c975076f92b5d064ee8998be638dd213f0724/lib/capybara/session.rb#L239
* Make `driven_by` overridableFumiaki MATSUSHIMA2017-03-291-0/+8
| | | | | | | | | | | | | | | | | | | | | | Sometimes we want to use rack_test partially instead of selenium for test speed: ```ruby class ApplicationSystemTestCase < ActionDispatch::SystemTestCase driven_by :selenium, using: :chrome, screen_size: [1400, 1400], options: {url: "http://chrome:4444/wd/hub"} end class WithJavaScriptTest < ApplicationSystemTestCase end class WithoutJavaScriptTest < ApplicationSystemTestCase driven_by :rack_test end ``` In the abobe case, `WithoutJavaScriptTest` uses selenium because `SystemTestCase` calls superclass' driver on `#initialize` (`self.class.superclass.driver.use`). Using `class_attribute` can handle inherited `driven_by`.
* Call system test driver per-instance rather than globallyeileencodes2017-03-091-7/+3
| | | | | | | | | | | | | | | | | | | | | | Previously the system test subclasses would call `driven_by` when the app booted and not again when the test was initialized which resulted in the driver from whichever class was called last to be used in tests. In rails/rails#28144 the `driven_by` method was changed to run `use` on setup and `reset` on teardown. While this was a viable fix this really pointed to the problem that system test `driven_by` was a global setting, rather than a per-class setting. To alieviate this problem calling the driver should be done on an instance level, rather than on the global level. I added an `initialize` method to `SystemTestCase` which will call `use` on the superclass driver. Running the server has been moved to `start_application` so that it only needs to be called once on boot and no options from `driven_by` were being passed to it. This required a largish rewrite of the tests. Each test needs to utilize the subclass so that it can properly test the drivers. `ActionDispatch::SystemTestCase` shouldn't be called directly anymore.
* Refactor system test driver/browsereileencodes2017-03-091-6/+0
| | | | | | | Since using a browser is only for selenium it doesn't really make sense to have a separate class for handling it there. This brings a lot of the if/else out of the main SystemTestCase class and into the Driver class so we can abstract away all that extra work.
* Change `SystemTestCase.driven_by` to use `setup`/`teardown` hooksLucas Mazza2017-02-241-12/+14
| | | | | | Previously, `driven_by` would change the Capybara configuration when the test case is loaded, and having multiple test classes with different `driven_by` configs would fail as the last loaded would be effective.
* Move and rename system testseileencodes2017-02-201-0/+21
* Move system tests back into Action Pack * Rename `ActionSystemTest` to `ActionDispatch::SystemTestCase` * Remove private base module and only make file for public `SystemTestCase` class, name private module `SystemTesting` * Rename `ActionSystemTestCase` to `ApplicationSystemTestCase` * Update corresponding documentation and guides * Delete old `ActionSystemTest` files