module RWebSpec
***********************************************************
-
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
***********************************************************
Public Class Methods
framework()
click to toggle source
# File lib/rwebspec.rb, line 66 def framework @_framework ||= begin ENV["RWEBSPEC_FRAMEWORK"] # ||= (RUBY_PLATFORM =~ /mingw/ ? "Watir" : "Selenium-WebDriver") end @_framework end
framework=(framework)
click to toggle source
# File lib/rwebspec.rb, line 74 def framework=(framework) old_framework = @_framework @_framework = ActiveSupport::StringInquirer.new(framework) if (old_framework != @_framework) then load_framework end end
load_framework()
click to toggle source
# File lib/rwebspec.rb, line 104 def load_framework if @_framework.nil? framework end if RWebSpec.framework =~ /watir/i load_watir return end if RWebSpec.framework =~ /selenium/i load_selenium return end puts "[WARN] not framework loaded yet" end
load_selenium()
click to toggle source
# File lib/rwebspec.rb, line 96 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
load_watir()
click to toggle source
# File lib/rwebspec.rb, line 82 def load_watir # puts "Loading Watir" require 'watir' if RUBY_PLATFORM =~ /mingw/i 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
version()
click to toggle source
# File lib/rwebspec.rb, line 62 def version RWEBSPEC_VERSION end