Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

drop support for FireWatir

  • Loading branch information...
commit 61100ca34f6ee4f67307ce44b724608c3edc16aa 1 parent 4ff04b8
Zhimin Zhan authored
View
4 CHANGELOG
@@ -1,5 +1,9 @@
CHANGELOG
=========
+
+ 2.2.0
+ [Change] Drop support for firewatir
+
2.1.1
[Change] use Global variable for retry settings (instead of class variables)
View
2  Rakefile
@@ -71,7 +71,7 @@ end
spec = Gem::Specification.new do |s|
s.platform= Gem::Platform::RUBY
s.name = "rwebspec"
- s.version = "2.1.1"
+ s.version = "2.2.0"
s.summary = "Web application functional specification in Ruby"
s.description = "Executable functional specification for web applications in RSpec syntax and Watir"
View
74 lib/extensions/firewatir_extensions.rb
@@ -1,74 +0,0 @@
-module FireWatir
- class Firefox
-
- @@firefox_started = false
-
- def initialize(options = {})
- if(options.kind_of?(Integer))
- options = {:waitTime => options}
- end
-
- if(options[:profile])
- profile_opt = "-no-remote -P #{options[:profile]}"
- else
- profile_opt = ""
- end
-
- waitTime = options[:waitTime] || 2
-
- os = RUBY_PLATFORM
- if RUBY_PLATFORM =~ /java/ then
- require 'rbconfig'
- os = Config::CONFIG['host_os']
- end
-
- case os
- when /mswin/ || /mingw/
- begin
- # Get the path to Firefox.exe using Registry.
- require 'win32/registry.rb'
- path_to_bin = ""
- Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Mozilla\Mozilla Firefox') do |reg|
- keys = reg.keys
- reg1 = Win32::Registry::HKEY_LOCAL_MACHINE.open("SOFTWARE\\Mozilla\\Mozilla Firefox\\#{keys[0]}\\Main")
- reg1.each do |subkey, type, data|
- if(subkey =~ /pathtoexe/i)
- path_to_bin = data
- end
- end
- end
- rescue LoadError => e
- path_to_bin = '"C:\Program Files\Mozilla Firefox\firefox.exe"'
- end
-
- when /linux/i
- path_to_bin = `which firefox`.strip
- when /darwin/i
- path_to_bin = '/Applications/Firefox.app/Contents/MacOS/firefox'
- when /java/
- raise "Error, should have set using rbconfig: #{os}"
- end
-
- @t = Thread.new { system("#{path_to_bin} -jssh #{profile_opt}")} unless @@firefox_started
-
- sleep waitTime
- begin
- set_defaults()
- rescue Watir::Exception::UnableToStartJSShException
- if !@t # no new thread starting browser, try again
- puts "Firefox with JSSH not detected after you indicated @@firefox_started"
- @t = Thread.new { system("#{path_to_bin} -jssh #{profile_opt}")}
- sleep waitTime
- set_defaults
- end
- end
- get_window_number()
- set_browser_document()
- end
-
- def self.firefox_started=(value)
- @@firefox_started = value
- end
-
- end
-end
View
17 lib/rwebspec.rb
@@ -4,20 +4,6 @@
#***********************************************************
require "rubygems"
-# From 2.0, no default support for FireWatir.
-#
-if $ENABLE_FIREFOX
- # Try load firewatir first, which depends on ActiveSupport
- puts "Deprecated: Please use watir-webdriver or selenium-webdriver to run tests in Firefox"
- begin
- require "firewatir";
- $firewatir_loaded = true
- rescue LoadError => e
- puts e
- $firewatir_loaded = false
- end
-end
-
# Load active_support, so that we can use 1.days.ago
begin
require 'active_support/basic_object'
@@ -30,7 +16,7 @@
require 'spec'
unless defined? RWEBSPEC_VERSION
- RWEBSPEC_VERSION = RWEBUNIT_VERSION = "2.1.1"
+ RWEBSPEC_VERSION = RWEBUNIT_VERSION = "2.2.0"
end
$testwise_polling_interval = 1 # seconds
@@ -63,7 +49,6 @@
require File.dirname(__FILE__) + "/rwebspec/matchers/contains_text"
require File.dirname(__FILE__) + "/extensions/rspec_extensions"
-require File.dirname(__FILE__) + "/extensions/firewatir_extensions" if $ENABLE_FIREFOX
if RUBY_PLATFORM =~ /mswin/ or RUBY_PLATFORM =~ /mingw/
require File.dirname(__FILE__) + "/extensions/watir_extensions"
require File.dirname(__FILE__) + "/extensions/window_script_extensions.rb"
View
6 lib/rwebspec/driver.rb
@@ -102,11 +102,7 @@ def close_browser
#
def close_all_browsers
if @web_browser
- if is_firefox?
- FireWatir::Firefox.close_all
- else
- Watir::IE.close_all
- end
+ Watir::IE.close_all
else
browser_type = $ITEST2_BROWSER ? $ITEST2_BROWSER.downcase.to_sym : :ie
WebBrowser.close_all_browsers(browser_type)
View
83 lib/rwebspec/web_browser.rb
@@ -17,14 +17,6 @@
$watir_loaded = false
end
-begin
- require "rubygems";
- require "firewatir";
- $firewatir_loaded = true
-rescue LoadError => e
- puts e
- $firewatir_loaded = false
-end
begin
require "rubygems";
@@ -34,7 +26,7 @@
$celerity_loaded = false
end
-raise "You have must at least Watir or Firewatir installed" unless $watir_loaded || $firewatir_loaded || $celerity_loaded
+raise "You have must at least Watir installed" unless $watir_loaded || $celerity_loaded
module RWebSpec
@@ -56,52 +48,19 @@ def initialize(base_url = nil, existing_browser = nil, options = {})
case RUBY_PLATFORM
when /java/i
- # Java, maybe firewatir or celerity
+ # Java, maybe celerity
puts "Ruby java platform"
- raise "Not supported, no FireWatir or Celerity detected" unless $firewatir_loaded || $celerity_loaded
- if $firewatir_loaded && $celerity_loaded then
- # choose one out of two, :default to celerity
- if options[:firefox] then
- initialize_firefox_browser(existing_browser, base_url, options)
- else
- initialize_celerity_browser(base_url, options)
- end
- elsif $firewatir_loaded
- initialize_firefox_browser(existing_browser, base_url, options)
- else
+ raise "Not supported unless Celerity detected" unless $celerity_loaded
+ if $$celerity_loaded then
initialize_celerity_browser(base_url, options)
end
when /mswin|windows|mingw/i
- raise "Not supported, no Watir or FireWatir detected" unless $watir_loaded || $firewatir_loaded
- if $firewatir_loaded && options[:firefox] then
- initialize_firefox_browser(existing_browser, base_url, options)
- else
- initialize_ie_browser(existing_browser, options)
- end
- else
- raise "Not supported, no FireWatirdetected" unless $firewatir_loaded
- initialize_firefox_browser(existing_browser, base_url, options)
+ raise "Not supported, no Watir detected" unless $watir_loaded
+ initialize_ie_browser(existing_browser, options)
end
end
- def initialize_firefox_browser(existing_browser, base_url, options)
- if existing_browser then
- @browser = existing_browser
- return
- end
- # JSSH is running, 9997
- begin
- require 'net/telnet'
- firefox_jssh = Net::Telnet::new("Host" => "127.0.0.1", "Port" => 9997)
- FireWatir::Firefox.firefox_started = true
- rescue => e
- puts "The firefox brower with JSSH is not available, #{e}"
- sleep 1
- end
- @browser = FireWatir::Firefox.start(base_url)
- end
-
def initialize_celerity_browser(base_url, options)
default_celerity_options = { :proxy => nil, :browser => :firefox, :resynchronize => true, :log_level => :off }
options = default_celerity_options.merge options
@@ -167,15 +126,8 @@ def self.new_from_existing(underlying_browser, web_context = nil)
alias a link
alias img image
- # Wrapp of Watir's area to support Firefox and Watir
- #
- # Note: FireWatir does not support area directly, treat it as text_field
def area(*args)
- if is_firefox?
- text_field(*args)
- else
- @browser.send("area", *args)
- end
+ @browser.send("area", *args)
end
def modal_dialog(how=nil, what=nil)
@@ -270,8 +222,6 @@ def text
def page_title
case @browser.class.to_s
- when "FireWatir::Firefox"
- @browser.title
when "Watir::IE"
@browser.document.title
else
@@ -303,20 +253,13 @@ def base_url=(new_base_url)
end
def is_firefox?
- return false unless $firewatir_loaded
- begin
- @browser.class == FireWatir::Firefox
- rescue => e
- return false
- end
+ return false
end
# Close the browser window. Useful for automated test suites to reduce
# test interaction.
def close_browser
case @browser.class.to_s
- when "FireWatir::Firefox"
- @browser.close
when "Watir::IE"
@browser.getIE.quit
else
@@ -329,9 +272,6 @@ def close_browser
def self.close_all_browsers(browser_type = :ie)
if browser_type == :ie
Watir::IE.close_all
- elsif browser_type == :firefox
- # raise "not supported in FireFox yet."
- FireWatir::Firefox.new.close_all
end
end
@@ -615,12 +555,7 @@ def self.attach_browser(how, what, options={})
default_options = {:browser => "IE"}
options = default_options.merge(options)
site_context = Context.new(options[:base_url]) if options[:base_url]
- if (options[:browser] == "Firefox")
- ff = FireWatir::Firefox.attach(how, what)
- return WebBrowser.new_from_existing(ff, site_context)
- else
- return WebBrowser.new_from_existing(Watir::IE.attach(how, what), site_context)
- end
+ return WebBrowser.new_from_existing(Watir::IE.attach(how, what), site_context)
end
# Attach a Watir::IE instance to a popup window.
View
5 samples/HelloTestWorld/assertion_spec.rb
@@ -1,10 +1,5 @@
require 'rwebspec'
-begin
- FireWatir::Firefox.firefox_started = true
-rescue => e
-end
-
##
# This test suite demos the assertion you can do with rWebUnit or Watir
#
View
2  samples/HelloTestWorld/google_rwebspec.rb
@@ -1,7 +1,7 @@
# This is a comment (ignored), line starting with #
# Simple Spec shows using RWebSpec write easy-to-read automated test scripts (or specification)
require 'rubygems'
-require 'firewatir'
+require 'watir'
require 'rwebspec'
include RWebSpec::RSpecHelper
View
4 samples/HelloTestWorld/google_rwebspec_spec.rb
@@ -1,14 +1,14 @@
# This is a comment (ignored), line starting with #
# Simple Spec shows using RWebSpec write easy-to-read automated test scripts (or specification)
require 'rubygems'
-require 'firewatir'
+require 'watir'
require 'rwebspec'
specification "google search" do
include RWebSpec::RSpecHelper
before(:all) do
- open_browser "http://www.google.com", :firefox => true
+ open_browser "http://www.google.com"
end
before(:each) do
View
27 samples/HelloTestWorld/real_life_examples/brisbane_library_spec.rb
@@ -1,27 +0,0 @@
-require 'rwebspec'
-
-specification "Brisbane Library User Authentications" do
- include RWebSpec::RSpecHelper
-
- scenario "[001] Deny access if user name is not correct" do
- open_browser_with("http://elibcat.library.brisbane.qld.gov.au/uhtbin/webcat/")
- click_link("My Account")
- link(:text, "Review My Account").click
- enter_text("user_id", "24000010626")
- enter_text("password", "1234")
- click_button_with_text "View My Account"
- page_source.should include("Access denied")
- close_browser
- end
-
- scenario "[002] Deny access if password does not match username" do
- open_browser_with("http://elibcat.library.brisbane.qld.gov.au/uhtbin/webcat/")
- click_link("My Account")
- link(:text, "Review My Account").click
- enter_text("user_id", "240000106264343") # valid account
- enter_text("password", "1234")
- click_button_with_text "View My Account"
- page_source.should include("Access denied")
- close_browser
- end
-end
View
36 samples/HelloTestWorld/real_life_examples/suncorp_branch_spec.rb
@@ -1,36 +0,0 @@
-require 'rwebspec'
-
-specification "Locate a Suncorp Branch" do
- include RWebSpec::RSpecHelper
-
- before(:all) do
- open_browser_with("http://suncorp.com.au/")
- end
-
- before(:each) do
- goto_page("/locator")
- end
-
- after(:all) do
- close_browser
- end
-
- scenario "Find by postcode" do
- enter_text("Postcode_Locator__Postcode", "4061")
- click_button_with_image("search_button.gif")
- page_source.should include("The Gap")
- end
-
- scenario "Find by suburb" do
- enter_text("Text_Locator__Suburb", "Alderley")
- click_button_with_image("search_button.gif")
- page_source.should include("Ashgrove")
- end
-
- scenario "Find by extended trading hours" do
- checkbox(:id, "OpenExtendedTradingHoursSerivceId").click
- enter_text("Postcode_Locator__Postcode", "4061")
- click_button_with_image("search_button.gif")
- page_source.should include("Queen St Mall")
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.