examples/cucumber/step_definitions/example_steps.rb in grid-0.3.7 vs examples/cucumber/step_definitions/example_steps.rb in grid-0.4.0

- old
+ new

@@ -1,29 +1,39 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')) -require 'grid' require 'rspec/expectations'; +require 'watir-webdriver-performance' +require 'grid' -Grid.control(:controller_uri=>"druby://ec2-50-16-63-81.compute-1.amazonaws.com:11235", :browser=>"chrome") do |browser, id| +Given /^(\d+) users open "([^"]*)"$/ do |quantity, browser| + params={} + params[:controller_uri] = "druby://ec2-50-16-63-81.compute-1.amazonaws.com:11235" + params[:browser] = browser # type of webdriver browser to spawn + params[:quantity] = quantity.to_i # max number of browsers to use + params[:rampup] = 10 # seconds + @grid = Grid.new(params) + @grid.setup +end - Given /^(\d+) users open "([^"]*)"$/ do |arg1, arg2| - pending # express the regexp above with the code you wish you had - end +Given /^navigate to the portal$/ do + @grid.iterate {|browser| browser.goto "http://gridinit.com/examples/logon.html" } +end - Given /^navigate to the portal$/ do - pending # express the regexp above with the code you wish you had +When /^they enter their credentials$/ do + @grid.iterate do |browser| + browser.text_field(:name => "email").set "tim@mahenterprize.com" + browser.text_field(:name => "password").set "mahsecretz" + browser.button(:type => "submit").click end +end - When /^they enter their credentials$/ do - pending # express the regexp above with the code you wish you had +Then /^they should see their account settings$/ do + @grid.iterate do |browser| + browser.text.should =~ /Maybe I should get a real Gridinit account/ end +end - Then /^they should see their account settings$/ do - pending # express the regexp above with the code you wish you had +Then /^the response time should be less than (\d+) seconds$/ do |response_time| + @grid.iterate do |browser| + browser.performance.summary[:response_time].should < response_time.to_i * 1000 end - - Then /^the response time should be less than (\d+) seconds$/ do |arg1| - pending # express the regexp above with the code you wish you had - end - end -