aboutsummaryrefslogtreecommitdiffstats
path: root/actionsystemtest
Commit message (Collapse)AuthorAgeFilesLines
* Rewrite API for ActionSystemTesteileencodes2017-02-2020-486/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a major rewrite of what existed previously. After discussing this feature with DHH I realized that I was looking at the setup all wrong. I had originally mentally broken it into "what Rails wants" and "what Capybara already has". What happened after looking at it from DHH's angle was that I saw there was no reason to group settings by Driver but instead the following groups: - There will always be a `Driver` - This can selenium, poltergeist, or capybara webkit. Capybara already provides all of these and there's no reason to break them into a category of Rails' usese Selenium like this and Capybara uses it like that. - Only Selenium drivers care about `Browser` - Because of this it was weird to set it only in the Rails end. - Therefore only `Browser`, and not `Driver` cares about `screen_size`. - Puma is the default `Server` in Rails - Therefore there's no reason to explictly support Webkit Once I looked at it from this angle I was able to abstract all the settings away from grouping the drivers with their options. Now all the driver, server, and browser settings are abstracted away and not part of the public facing API. This means there's no requirement to initialize new classes to change the default settings and the public options API is much smaller. All of Rails preferred defaults are still there (selenium with port 21800 using the chrome browser with a screen size of 1400x1400) but changing these no longer requires initializing a new class or understanding which driver you're using underneath (rails defaults or capybaras defaults respectively). Rails opinions are now simple defaults instead of doing a them versus us setup with Drivers and explicit options. Changing the defaults is simple. Call `driven_by` with different settings to change the defaults which will on their own initialize new classes and change the default settings. Use poltergeist with port 3000 for Puma ``` driven_by :poltergeist, on: 3000 ``` Use selenium with the Chrome browser and a screen size of 800x800 ``` driven_by :selenium, using: :firefox, screen_size: [ 800, 800 ] ``` The entire setup of how browser and drivers interact with each other are abstracted away and the only required argument is the driver name.
* Cleanup Rails provided helperseileencodes2017-02-206-109/+71
| | | | | | | | | | | | | | | | | 1. Clean up screenshot helper Updates documentation to be clearer and separates the concerns of saving the image, setting the image path, and displaying the image. 2. Remove Rails provided assertions for selectors This was moved upstream to Capybara and is no longer necessary to be included in Rails 3. Remove form helper The form helper is pretty specific to Basecamp's needs and may not be helpful outside of Rails.
* Remove teardown codeeileencodes2017-02-201-5/+0
| | | | | | | | | | | Since I've moved the teardown code that contains the screenshot handling to be generated when the application is generated this code was interfering with the screenshot taking. Because this runs before any app teardown code we would be resetting sessions before taking the screenshot, resulting in a blank browser window. The code to reset the sessions must come AFTER a screenshot has been taken.
* Use 1 thread instead of 4 with Puma server for system testseileencodes2017-02-201-1/+1
|
* Set Webrick logger for system testingeileencodes2017-02-201-1/+1
| | | | | | If this is not set Webrick will log **everything** to STDOUT and distract from the running tests. This will instead log to the log file. This example was extracted from the Capybara source code.
* Rename call to runeileencodes2017-02-203-3/+3
| | | | | Call doesn't make as much sense here, we're really starting to run the driver.
* Amend documentationeileencodes2017-02-205-34/+46
| | | | | Many changes have been made since the beginning so documentation needed a refresher.
* Refactor config settings to use generated fileeileencodes2017-02-204-28/+33
| | | | | | | | | | | | | | | | | | | Originally I had set up system testing to have one configuration option to be set in the test environment. After thinking it over I think a generated class on app creation would be best. The reason for this is Capybara has a ton of configuration options that I'm sure some folks want to use. Thinking about how we handle screenshots, database transactions, and a whole bunch of other settings it would be better for users to be able to turn all of that on and off. When an app or scaffold is generated a `test/system_test_helper.rb` test helper will be generated as well. This will contain the class for tests to inherit from `ActionSystemTestCase` which will inherit from `ActionSystemTest::Base`. Here is where users can change the test driver, remove the screenshot helper, and add their additional Capybara configuration.
* Don't load ActionSystemTest in productioneileencodes2017-02-202-19/+0
| | | | | | | | | | By moving to the TestUnit Railtie, and doing the file requirement inside the onload call we can avoid loading ActionSystemTest in production and load it in the test env. This is important for performance reasons - loading up unnecessary files and object is expensive, especially when they should never be used in production.
* Turn system testing into it's own gem and renameeileencodes2017-02-2024-0/+862
Renames `Rails::SystemTestCase` to `ActionSystemTest` and moves it to a gem under the Rails name. We need to name the class `ActionSystemTestCase` because the gem expects a module but tests themselves expect a class. Adds MIT-LICENSE, CHANGELOG, and README for the future.