diff --git a/cucumber_watir_101/features/google_search.feature b/cucumber_watir_101/features/google_search.feature new file mode 100644 index 0000000..506f8f3 --- /dev/null +++ b/cucumber_watir_101/features/google_search.feature @@ -0,0 +1,8 @@ +Feature: Google Search + In order to find out more infomration about AWTA + I need to be able to search Google + + Scenario: Google Search for AWTA + Given that we are on the Google Homepage + When I search for AWTA + Then I should see "Austin Workshop on Test Automation" \ No newline at end of file diff --git a/cucumber_watir_101/features/step_definitions/google_search.rb b/cucumber_watir_101/features/step_definitions/google_search.rb new file mode 100644 index 0000000..6ca6b58 --- /dev/null +++ b/cucumber_watir_101/features/step_definitions/google_search.rb @@ -0,0 +1,20 @@ +require "spec" +require "safariwatir" + +BROWSER = Watir::Safari.new +PAGES = { + "Google Homepage" => "http://google.com" +} + +Given /^that we are on the (.*)$/ do |page| + BROWSER.goto(PAGES[page]) +end + +When /^I search for (.*)$/ do |query| + BROWSER.text_field(:name, "q").set(query) + BROWSER.button(:name, "btnG").click +end + +Then /^I should see "(.*)"$/ do |text| + BROWSER.html.include?(text).should == true +end