Sha256: f230f9962c92995d80ac96f03ef4be717ea75c28ff78c0409ca96c13a435127d

Contents?: true

Size: 1.78 KB

Versions: 20

Compression:

Stored size: 1.78 KB

Contents

When /^I open a new browser$/ do
	if @params
	  case @params["browser"]
		  when "FF"; @browser = Watir::Browser.new :firefox
		  when "IE"; @browser = Watir::Browser.new :ie
		  when "C", "GC"; @browser = Watir::Browser.new :chrome	
	  end
	else
		@browser = Watir::Browser.new
	end
end

Given /^I open a firefox browser$/ do
  @browser = Watir::Browser.new :firefox
end

Given /^I open a chrome browser$/ do
  @browser = Watir::Browser.new :chrome	
end

Given /^I open an internet explorer browser$/ do
  @browser = Watir::Browser.new :ie
end

Then /^I navigate to the environment url$/ do
  url = @params['environment']['url']
  @browser.goto url
end

Then /^I go to the url "(.*?)"$/ do |url|
  @browser.goto url
end

Then /^I click "(.*?)"$/ do |element_text|
	sleep 1
  @browser.element(:text, element_text).click
end

Then /^I click the button "(.*?)"$/ do |element_text|
	sleep 1
  @browser.button(:text, element_text).click
end

Then /^I click the element with "(.*?)" "(.*?)"$/ do |arg1, arg2|
  @browser.element(arg1.to_sym, arg2)
end

Then /^I should see "(.*?)"$/ do |text|
	sleep 1
  stm = @browser.text.include? text
  if stm
    true
  else
    fail("Did not find text #{text}")
  end
end

Then /^I should not see "(.*?)"$/ do |text|
  stm = @browser.text.include? text
  if stm
    fail("Found text #{text}")
  else
    true
  end
end

Then /^I fill in "(.*?)" with "(.*?)"$/ do |field, value| #assumes u have label
  associated_label = @browser.label(:text, field).attribute_value("for")
  #associated_label = @browser.element(:xpath, '//label[contains(text(),"#{arg1}")]').attribute_value("for"))
  @browser.text_field(:id, associated_label).set value
end


When /^I wait (\d+) seconds?$/ do |seconds|
  sleep seconds.to_i
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
awetestlib-0.1.29pre3-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.29pre3 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.29pre1 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.28-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.27-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.26-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.25-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.24-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.23-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.22-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.20-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.19-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.17-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.16-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.15-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.14-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.13-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.12-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.11-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb
awetestlib-0.1.10-x86-mingw32 setup_samples/sample_cucumber/features/step_definitions/predefined_steps.rb