Skip to content
nadezdaalexandrovna edited this page Oct 3, 2017 · 11 revisions

Welcome to the Transc&Anno wiki!

Testing Transc&Anno

2 types of tests can be run to test Transc&Anno:

  1. capybara webkit tests
  2. selenium tests

Capybara webkit tests

capybara webkit tests simulate user interaction with the product. We utilize rspec and capybara/capybara-webkit to run these tests.

To run the tests, first clone the Transc&Anno 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:

    **group :test do**
                **gem ‘database_cleaner’**
                **gem ‘capybara’**
                **gem ‘shoulda’**

    **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.

Selenium tests

Selenium tests run in the browser and let you watch the user interaction with the tool.

To run the tests, first follow the project installation instructions from the Readme. Then install the firefox browser.

Once the project is set up, update the project URL in the selenium_tests_when_app_is_running/config.yaml

Then run the following command:

ruby selenium_tests_when_app_is_running/seleniumtestfirefox.rb

The test in chrome can't be run, because the chromedriver cannot work with input elements used in this project. It is a deficiency of the chromedriver.

The opera driver is not yet supported in selenium.

Clone this wiki locally