A helper to take shots on BrowserStack
Shoot is a helper library to take screenshots using BrowserStack. If you don't need a full integration test coupled with screenshots, it's a simpler choice.
Add this line to your application's Gemfile:
group :test do
gem 'shoot'
endAnd then execute:
$ bundle
Also add the following environment variables: BROWSERSTACK_USER and BROWSERSTACK_KEY. The way you do it is up to you (we recommend either dotenv or an export in your personal files).
Shoot installs a binary. To inspect it, just run:
$ shoot
The first thing you should do is:
$ shoot list
ID OS # Browser # Device
0 OS X Snow Leopard safari 5.1
1 OS X Snow Leopard chrome 14.0
2 OS X Snow Leopard chrome 16.0
...
537 ios 7.0 ipad iPad mini Retina
538 ios 7.0 iphone iPhone 5S
539 ios 7.0 iphone iPhone 5C
The list command basically fetches all browsers available on BrowserStack and caches them locally on .screenshots/.browsers.json. You can choose to add this folder on your .gitignore, since shoot will save all images there as well.
Then, you can choose to activate the browsers you wanna use, based on id. Example:
$ shoot activate 2
This will activate (given your output is the same as above) chrome 16 on OS X Snow Leopard.
Now, create a scenario. Here's an example:
class MyScenario < Shoot::Scenario
def login
visit "http://url.to.login"
end
endAs you can see, it follows capybara's syntax, so you can visit pages, fill forms, click links and so on...
Now run:
$ shoot scenario my_scenario.rb
This will run all the methods of MyScenario and generate screenshots for all active browsers.
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)