Skip to content

Instantly share code, notes, and snippets.

View cheezy's full-sized avatar

Jeff Morgan cheezy

  • Industrial Logic Canada
  • Toronto, ON Canada
  • X @chzy
View GitHub Profile
@cheezy
cheezy / gist:1302205
Created October 20, 2011 20:12
top of stack
org.jruby.Ruby.getCacheMap()Lorg/jruby/runtime/CacheMap; (Java::JavaLang::NoSuchMethodError)
MixologyService.clearCache(MixologyService.java:116)
MixologyService.add_module(MixologyService.java:84)
@cheezy
cheezy / gist:1265379
Created October 5, 2011 19:18
Example of required field
Scenario: Last name is required
Given I am on the page to be tested
When I leave the last name blank
Then I should see an error message with "Last name is required"
@cheezy
cheezy / gist:1265132
Created October 5, 2011 17:48
Modal dialog example that crashes ruby after close
require 'rubygems'
require 'watir-webdriver'
require 'selenium-webdriver'
def wait_for_new_handle(original_handles, driver)
handles = nil
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until do
handles = driver.wd.window_handles
handles.size == original_handles.size + 1
@cheezy
cheezy / gist:1262808
Created October 4, 2011 21:05
Example to demonstrate inability to attach to window after modal dialog
require 'rubygems'
require 'watir-webdriver'
require 'selenium-webdriver'
def wait_for_new_handle(original_handles, driver)
handles = nil
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until do
handles = driver.wd.window_handles
handles.size == original_handles.size + 1
module PageHeader
include PageObject
text_field(:header_search, :id => 'header_search')
h1(:page_title, :index => 0)
end
module ErrorMessages
include PageObject
@cheezy
cheezy / gist:1206401
Created September 9, 2011 14:39
modal dialog issue
require 'rubygems'
require 'selenium-webdriver'
require 'pp'
dir = Dir.mktmpdir("modal-dialog")
htmls = DATA.read.scan(/--- (.+?) ---\n(.+?)(?=---|\z)/m)
htmls.each do |name, content|
File.open(File.join(dir, name), "w") { |io| io << content}
end
@cheezy
cheezy / gist:1204812
Created September 8, 2011 21:31
Error when running gem command on Windows. Unable to install gems
Invalid gemspec in [C:/Ruby187/lib/ruby/gems/1.8/specifications/json_pure-1.5.4.gemspec]: invalid date format in specifi
cation: "2011-08-31 00:00:00.000000000Z"
Invalid gemspec in [C:/Ruby187/lib/ruby/gems/1.8/specifications/spruz-0.2.13.gemspec]: invalid date format in specificat
ion: "2011-08-17 00:00:00.000000000Z"
Invalid gemspec in [C:/Ruby187/lib/ruby/gems/1.8/specifications/watir-webdriver-0.3.2.gemspec]: invalid date format in s
pecification: "2011-08-18 00:00:00.000000000Z"
@cheezy
cheezy / gist:1153827
Created August 18, 2011 10:55
nested frames example
--- frame_example.rb ---
require 'watir-webdriver'
browser = Watir::Browser.new :firefox
html = File.expand_path("#{File.dirname(__FILE__)}/nested_frames.html")
browser.goto "file://#{html}"
frame = browser.frame(:id => 'two').frame(:id => 'three').frame(:id => 'four').frame(:id => 'five')
frame.text_field(:id => 'text_field_id1').set('value1')
frame.text_field(:id => 'text_field_id2').set('value2')
Fetching: iCuke-0.6.5.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing iCuke:
ERROR: Failed to build gem native extension.
"/Users/cheezy/.rvm/rubies/ruby-1.9.2-p290/bin/ruby" -rubygems /Users/cheezy/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/bin/rake RUBYARCHDIR=/Users/cheezy/.rvm/gems/ruby-1.9.2-p290@page-object/gems/iCuke-0.6.5/lib RUBYLIBDIR=/Users/cheezy/.rvm/gems/ruby-1.9.2-p290@page-object/gems/iCuke-0.6.5/lib
cd .. && git submodule init
(in /Users/cheezy/.rvm/gems/ruby-1.9.2-p290@page-object/gems/iCuke-0.6.5/ext)
fatal: Not a git repository (or any of the parent directories): .git
rake aborted!
# fails if the following block doesn't run
page.browser.windows.each do |win|
puts “title is #{win.title}”
end
page.browser.window(:url => /mripage\.asp/).use do
page.save_preferences
end