Skip to content

Instantly share code, notes, and snippets.

View richdownie's full-sized avatar

Rich Downie richdownie

View GitHub Profile
@richdownie
richdownie / gist:993572
Created May 26, 2011 17:28
(selenium-webdriver + cucumber + rspec) equivalence to watir contains_text?
FEATURE:
Scenario: Google Landing Page
* I am on the google page
* I should see "About Google"
* I should NOT see "Fidel Castro"
STEPS:
RichDownie@ls ~/projects/wholebytes (git::master) $ rake saucelabs:run_iphone
"rdownie\n"
unexpected response, code=402, content-type="text/plain"
Uh oh, you've run out of minutes! Please visit your account page to purchase a subscription. (Selenium::WebDriver::Error::WebDriverError)
/Users/RichDownie/.rvm/gems/ruby-1.9.3-p194@wholebytes/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/remote/http/common.rb:66:in `create_response'
/Users/RichDownie/.rvm/gems/ruby-1.9.3-p194@wholebytes/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
/Users/RichDownie/.rvm/gems/ruby-1.9.3-p194@wholebytes/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
/Users/RichDownie/.rvm/gems/ruby-1.9.3-p194@wholebytes/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/remote/bridge.rb:615:in `raw_execute'
/Users/RichDownie/.rvm/gems/ruby-1.9.3-p194@wholebytes/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/remote/bridge.rb:92:in `create_sessi
2013-02-17T11:40:30+00:00 heroku[router]: at=info method=GET path=/results.json host=blackboxd.com fwd="66.66.92.167" dyno=web.1 queue=0 wait=0ms connect=1ms service=7ms status=404 bytes=728
2013-02-17T11:40:31+00:00 app[web.1]: Started GET "/results.json" for 66.66.92.167 at 2013-02-17 11:40:31 +0000
2013-02-17T11:40:31+00:00 app[web.1]:
2013-02-17T11:40:31+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/results.json"):
2013-02-17T11:40:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2013-02-17T11:40:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2013-02-17T11:40:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:32:in `call_app'
2013-02-17T11:40:31+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:16:in `block in call'
2013-02
Started POST "/jet_friends/" for 127.0.0.1 at 2013-02-20 10:23:41 -0500
Processing by JetFriendsController#create as HTML
Parameters: {"signed_request"=>"mmLozOQuZKVk_IgiMXwJiTSHIfqXivzVu7aKficPuj4.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTM2MTM3MzgyMSwidXNlciI6eyJjb3VudHJ5IjoidXMiLCJsb2NhbGUiOiJlbl9VUyIsImFnZSI6eyJtaW4iOjIxfX19"}
Redirected to http://localhost:3000/jet_friends
Completed 302 Found in 1ms (ActiveRecord: 0.0ms)
Started GET "/jet_friends" for 127.0.0.1 at 2013-02-20 10:23:41 -0500
Processing by JetFriendsController#index as HTML
Redirected to https://graph.facebook.com/oauth/authorize?client_id=129345460555561&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fjet_friends%2Fcallback%2F&scope=email%2C+offline_access
Scenario: Verify activities and user_activities are created under the hood
* I register a new user in "(GMT-05:00) Eastern Time (US & Canada)"
* I verify activity count equals "0"
* I wait until "brand" "class" renders
* I verify user completed activities count equals "0"
* I wait until "brand" "class" renders
* I maximize browser
* I submit "new_link" "id"
* I fill in "activity_name" with "Outside Exercise"
* I submit "submit_form" "class"
RichDownie@ls ~ $ crontab -l
15 8-23/4 * * * /bin/bash -l -c 'cd /Users/RichDownie/projects/bb && bundle exec rake doolli:all'
RichDownie@ls ~ $
def email_errors(terminal_output)
@console = terminal_output
mail to: "[email protected]", subject: "Doolli Automated Test Errors"
end
Given /I xpath "(.*)" "(.*)"/ do |what, how|
@browser.find_element(:xpath, ".//" + how + "[text()='" + what + "']").click
end
Scenario:
as Individual # features/doolli_profile.feature:128\n
\ * I am on the signup page # features/step_definitions/selenium_webdriver.rb:13\n
\ * I fill out signup form with \"Rich\" # features/step_definitions/credential_steps.rb:5\n
\ * I submit \"home-signup-button\" \"class\" # features/step_definitions/selenium_webdriver.rb:6\n
\ 0 seconds to render \"home-signup-button\":class\n * I should see \"You
successfully registered! Enjoy Doolli.\" # features/step_definitions/selenium_webdriver.rb:153\n
\ expected: >= 1\n got: 0 (RSpec::Expectations::ExpectationNotMetError)\n
\ ./features/step_definitions/selenium_webdriver.rb:160:in `/I should (NOT )?see
\"(.*)\"/'\n features/doolli_profile.feature:132:in `* I should see \"You successfully
RichDownie@ls ~ $ sudo gem install watir-webdriver
Password:
Successfully installed watir-webdriver-0.6.2
1 gem installed
Installing ri documentation for watir-webdriver-0.6.2...
Installing RDoc documentation for watir-webdriver-0.6.2...
RichDownie@ls ~ $ irb
>> require 'watir-webdriver'
=> true
>>