Skip to content

Instantly share code, notes, and snippets.

@SihemBouhenniche
SihemBouhenniche / dummy.feature
Created August 6, 2019 09:37
Behavior driven design (BDD) example on web applications with cucumber and ruby
Feature: Dummy
Scenario: Google search scenario
Given I am on google home page
Then I can type "Usain bolt" in search field
When I click on search button
Then I get "Usain Bolt" in search results
@SihemBouhenniche
SihemBouhenniche / Gemfile
Created August 6, 2019 09:41
Behavior driven design (BDD) example on web applications with cucumber and ruby
source 'https://rubygems.org'
gem 'capybara'
gem 'cucumber'
gem 'selenium-webdriver'
gem 'site_prism'
gem 'rspec'
gem 'webdrivers'
gem 'ffi'
@SihemBouhenniche
SihemBouhenniche / Rakefile
Created August 6, 2019 09:47
Behavior driven design (BDD) example on web applications with cucumber and ruby
require 'rubygems'
require 'cucumber'
require 'cucumber/rake/task'
#@!method init_host_name
#init host name, in dummy feature the host is google.
def init_host_name
if ENV['host'].equal? nil
ENV['host'] = 'https://www.google.com'
end
@SihemBouhenniche
SihemBouhenniche / dummy_steps.rb
Created August 6, 2019 09:49
Behavior driven design (BDD) example on web applications with cucumber and ruby
When(/^I click on search button$/) do
GoogleHomeHelpers.submit
end
Then(/^I can type "(.+)" in search field$/) do |value|
GoogleHomeHelpers.fill_keyword(value)
end
And(/^I click on first suggestion$/) do
GoogleHomeHelpers.click_first_suggestion