jejacks0n / teaspoon

Teaspoon: Javascript test runner for Rails. Use Selenium, BrowserStack, or PhantomJS.
1.43k stars 243 forks source link

Testing frontend with existing views. [QUESTION] #236

Closed bilby91 closed 10 years ago

bilby91 commented 10 years ago

Im currently in the development of a project where we decided to test our front end code. We want to test basic staff, for example, when a button is pressed a label should appear, etc.

Is there a way to reuse the existing views and partials we have (haml) and executing the render in a context where the variables that are used inside can be accessed? Or i need to write all the fixtures with data? Is there a way to actually request pages to the rails app and avoid the usage of fixtures?

We are going to use phantomjs.

Thanks before hand!

jejacks0n commented 10 years ago

So, I see two basic paths for this.. Teaspoon is really intended for unit tests, which involves having a fixture that implements only what's relevant for your specs.

I'd say you should look into some more BDD style tools like cucumber, or rspec-capybara for full integration tests. I find that they're both useful and provide different levels of confidence.