Checking parts of content in webpages using cucumber

I’ve updated my tests of external webpages using cucumber. If you like to test the amount of results of the google search we tested last time you can get the content of a special tag on the result of the query using the following step

Then /^I should get more than (d+) results$/ do |arg1|
  page.find('#resultStats').text.sub('.', '').scan(/d+/)[0].to_i.should be > arg1.to_i
end

See the files on github

I also prepared the cucumber steps for using the ruby debugger if something goes wrong.

Here you have use the ruby gem ruby-debug19 and start the debugger in the step with the debugger command. First you have to require the gem in env.rb

require 'ruby-debug'

See the files on github

 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *