-
Notifications
You must be signed in to change notification settings - Fork 54
Testing FromthePage
From the Page has a testing philosophy that involves using features tests to simulate user interaction with the product. We utilize rspec and capybara/capybara-webkit to run these tests.
To run the tests, first clone the From The Page repository.
Create a database called testing on your local mysql server. In config/database.yml, make sure the test database is called testing, and your username and password are correct.
Check the Gemfile and confirm that the following gems are included: In group :test do gem ‘database_cleaner’ gem ‘capybara’ gem ‘shoulda’
In group :development, :test do
gem ‘rspec-rails’
gem ‘launchy’
gem ‘capybara-webkit’
Note: capybara-webkit depends on Qt version 5 or above, see: https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit for installation instructions.
Run bundle-install.
Run the following commands to set up the test database with data: RAILS_ENV=test rake db:drop db:create db:migrate RAILS_ENV=test rake db:fixtures:load FIXTURES_PATH=’spec/fixtures’
Important note: Because of the way we have structured our tests, you will need to run these commands and reset the database prior to running the tests each time.
To run the tests, run the following command: rspec ‘./spec/features’
Please note: there is a 60 second sleep in one of the tests, to make sure the document upload background process has completed, so make sure to give the tests some time to run.