Docker container for automatize your cucumber test in browser Chrome and FireFox with screenshots.
- cucumber
- gherkin
- capybara
- pry
- rspec
- selenium-webdriver
- selenium-cucumber
- cucumber-api
- cucumber-screenshot
- ./test/
- features/
- mytest.feature
- screenshot/
- step_definitions/
- support/
- env.rb
- cucumber-screenshot.rb
Chrome example:
require 'selenium-webdriver'
require 'selenium-cucumber'
caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => [ "--disable-web-security", "--no-sandbox" ]})
$driver = Selenium::WebDriver.for :remote, desired_capabilities: caps
FireFox example:
require 'selenium-webdriver'
require 'selenium-cucumber'
$driver = Selenium::WebDriver.for :remote, desired_capabilities: :firefox
$driver.manage().window().maximize()
begin
require 'cucumber_screenshot'
World(CucumberScreenshot::World)
After do |scenario|
if scenario.failed?
screenshot
end
end
AfterStep('@screenshot') do |scenario|
if screenshot_due?
screenshot
end
end
rescue Exception => e
puts "Snapshots not available for this environment.\n"
end
By using predefined steps you can automate your test cases more quickly, more efficiently and without much coding.
The predefined steps are located here
docker run --volume ./test:/opt/cucumber sergioortegagomez/docker-ubuntu-cucumber
services:
test:
image: sergioortegagomez/docker-ubuntu-cucumber
volumes:
- ./test:/opt/cucumber