Sha256: f0bd2b44d5ed5845bc9b7f6eee3cedd8017ada44a71a18b088fa8ad8fcc6d80e

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 Bytes

Contents

require 'spec'

case PLATFORM
when /darwin/
  require 'safariwatir'
  Browser = Watir::Safari
when /win32|mingw/
  require 'watir'
  Browser = Watir::IE
when /java/
  require 'celerity'
  Browser = Celerity::Browser
else
  raise "This platform is not supported (#{PLATFORM})"
end

class GoogleSearch
  def initialize(b)
    @b = b
  end
  
  def goto
    @b.goto 'http://www.google.com/'
  end
  
  def search(text)
    @b.text_field(:name, 'q').set(text)
    @b.button(:name, 'btnG').click
  end
end

Before do
  @b = Browser.new
end

After do
  @b.close
end

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

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

Then /I should see a link to "(.*)":(.*)/ do |text, url|
  @b.link(:url, url).text.should == text
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aslakhellesoy-cucumber-0.1.1 examples/web/features/steps/stories_steps.rb
aslakhellesoy-cucumber-0.1.2 examples/web/features/steps/stories_steps.rb