Skip to content

Docker Ubuntu 18.10 with Mate Desktop. Cucumber Web Test for Firefox and Chrome Broswers

License

Notifications You must be signed in to change notification settings

kairops/docker-ubuntu-cucumber

 
 

Repository files navigation

Docker Ubuntu 18.10 Mate Desktop with Cucumber

Docker container for automatize your cucumber test in browser Chrome and FireFox with screenshots.

Libraries preload.

Generate a test skeleton

- ./test/
  - features/
    - mytest.feature
    - screenshot/
    - step_definitions/
    - support/
      - env.rb
      - cucumber-screenshot.rb

env.rb file

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()

cucumber-screenshot.rb file

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

Your features test

By using predefined steps you can automate your test cases more quickly, more efficiently and without much coding.

The predefined steps are located here

Run in docker

docker run --volume ./test:/opt/cucumber sergioortegagomez/docker-ubuntu-cucumber

Run in docker-compose

services:
  test:
    image: sergioortegagomez/docker-ubuntu-cucumber
    volumes:
      - ./test:/opt/cucumber

Examples

About

Docker Ubuntu 18.10 with Mate Desktop. Cucumber Web Test for Firefox and Chrome Broswers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dockerfile 90.0%
  • Shell 10.0%