Sha256: 2feeae9dbef4b210e66b5fb9ff3ceb9c1cd58ab3e935b87077683c2e84feff8a

Contents?: true

Size: 768 Bytes

Versions: 35

Compression:

Stored size: 768 Bytes

Contents

require 'spec/expectations'
require 'selenium'

class GoogleSearch
  def initialize(browser)
    @browser = browser
  end
  
  def goto
    @browser.open 'http://www.google.com/'
  end
  
  def search(text)
    @browser.type('q',text)   
    @browser.click 'btnG'
    @browser.wait_for_page_to_load
  end
end

Before do
  @browser = Selenium::SeleniumDriver.new("localhost", 4444, "*chrome", "http://localhost", 15000)
  @browser.start
end

After do
  @browser.stop
end

Given 'I am on the Google search page' do
  @page = GoogleSearch.new(@browser)
  @page.goto
end

When /I search for "(.*)"/ do |query|
  @page.search(query)
end

Then /I should see a link to (.*)/ do |expected_url|
  @browser.is_element_present("css=a[href='#{expected_url}']").should be_true
end

Version data entries

35 entries across 35 versions & 3 rubygems

Version Path
aslakhellesoy-cucumber-0.1.14.1 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.14.2 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.15 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.16.1 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.16.2 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.16.3 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.16.4 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.16.5 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.16 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.1 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.10 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.11 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.12 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.13 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.14 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.15 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.17 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.18 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.19 examples/selenium/features/step_definitons/stories_steps.rb
aslakhellesoy-cucumber-0.1.99.2 examples/selenium/features/step_definitons/stories_steps.rb