ScrewDriver
This gem will capture screeenshots for your Watir Automation Test Script
Installation
Step 1. Run the command gem install screw_driver
Step 2. Make sure in your Gemfile, you have:
gem 'screw_driver'
Step 3. Make sure in your env file:
require 'screw_driver' include ScrewDriver
Usage
Write your step definition something like:
screw_driver
Given(....) do
# your code
...
push_snapshot('Home Screen',@browser,'Scenario #1' )
...
...
push_snapshot('Information Screen')
...
push_snapshot('Invoice Screen')
...
...
# your code
end
similarily use the method: push_snapshot('Screen Shot Name') for capturing screenshots.
Important Note: push_snapshot('Home Screen',@browser,'Scenario #') is required for the first snapshot of a test script.
where @browser is the watir browser object name. For e.g. if you have used:
client = Selenium::WebDriver::Remote::Http::Default.new
@browser = Watir::Browser.new :firefox, :http_client => client
In the above code, @browser is the watir object name used.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake false
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/screw_driver. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.