Running protractor from rails tests
I'm using RSpec to run uint tests on my Rails application and I would like to implement some Protractor test for the angular side of the application.
Now my questions are:
- How to setup so that RSpec and Protractor test are executed with one command
- Can I run protractor tests from RSpec test and do some server-side assertion after Protractor tests
- If 2) is not easy or trivial, what would be the best way to run the Protractor tests on test db and make sure it get cleaned between each run
The issue I have is that Protractor should be run against the real backend (which is actually good because I don't want to mock things) but I'm not sure how to be sure that create and update calls from my angular code actual create the data.
Questions 1 and 2:
Can't really comment much on the RSpec questions not being a rails developer, but you could try checking out following url for running the cucumber assertion framework with rspec: http://railsapps.github.io/tutorial-rails-devise-rspec-cucumber.html to give you some clues
Here you'll be wanting to make use of the "beforeEach" and/or "afterEach" functions to restore db state between tests. So for example in a simple case you wish your ui widget under test, say a 5 star rating widget, to have a certain state at the start of a test, say 3 stars, you make sure in the afterEach function, triggered at the end of each test, to click the 3 star element.