***********************************************************
Copyright © 2006 - 2009 Zhimin Zhan.
Distributed open-source, see full license in MIT-LICENSE
***********************************************************
useful hekoer methods for testing
example
should link_by_text(text, options).size > 0
require 'watir/screen_capture' if RUBY_PLATFORM.downcase.include?(“mswin”) or RUBY_PLATFORM.downcase.include?(“mingw”)
***********************************************************
Copyright © 2006, Zhimin Zhan.
Distributed open-source, see full license in MIT-LICENSE
***********************************************************
# File lib/rwebspec.rb, line 49 def framework @_framework ||= begin ENV["RWEBSPEC_FRAMEWORK"] # ||= (RUBY_PLATFORM =~ /mingw/ ? "Watir" : "Selenium-WebDriver") end @_framework end
# File lib/rwebspec.rb, line 57 def framework=(framework) old_framework = @_framework @_framework = ActiveSupport::StringInquirer.new(framework) if (old_framework != @_framework) then puts "[INFO] Switching framework to #{@_framework}" load_framework end end
# File lib/rwebspec.rb, line 88 def load_framework if @_framework.nil? framework end if RWebSpec.framework =~ /watir/ load_watir return end if RWebSpec.framework =~ /selenium/ load_selenium return end puts "[WARN] not framework loaded yet" end
# File lib/rwebspec.rb, line 80 def load_selenium require 'selenium-webdriver' # puts "Loading Selenium" load(File.dirname(__FILE__) + "/rwebspec-webdriver/web_browser.rb") load(File.dirname(__FILE__) + "/rwebspec-webdriver/driver.rb") require File.dirname(__FILE__) + "/extensions/webdriver_extensions" end
# File lib/rwebspec.rb, line 66 def load_watir # puts "Loading Watir" require 'watir' if RUBY_PLATFORM =~ /mingw/ require 'watir-classic' end load(File.dirname(__FILE__) + "/rwebspec-watir/web_browser.rb") load(File.dirname(__FILE__) + "/rwebspec-watir/driver.rb") require File.dirname(__FILE__) + "/extensions/watir_extensions" require File.dirname(__FILE__) + "/extensions/window_script_extensions" end
# File lib/rwebspec.rb, line 45 def version RWEBSPEC_VERSION end