firewatir dones work with cygwin because it can locate firefox executable
-------------------------------------------------------------------------

                 Key: WTR-453
                 URL: http://jira.openqa.org/browse/WTR-453
             Project: Watir
          Issue Type: Bug
          Components: Documentation
    Affects Versions: 1.6.5
         Environment: $ gem search watir

*** LOCAL GEMS ***

commonwatir (1.6.5)
firewatir (1.6.5)
watir (1.6.5)

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby.exe
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-cygwin
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.8
     - /home/Alexis/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

$

            Reporter: fourchette


if you try to run the example provided on watir example page using firefox and 
cygwin it just does not work 

#!/usr/bin/ruby
# Here we see a very simple WATIR script to drive to google and validate a page
require 'rubygems'
require 'watir'                         # use watir gem
test_site = 'http://www.google.com'     # set a variable

Watir::Browser.default = 'firefox'
b = Watir::Browser.new                  # open the IE browser
b.goto(test_site)                       # load url, go to site
b.text_field(:name, "q").set("pickaxe") # load text "pickaxe" into search field 
named "q"
b.button(:name, "btnG").click           # "btnG" is the name of the Search 
button, click it

if b.text.include?("Programming Ruby")  
  puts "Test Passed. Found the test string: 'Programming Ruby'."
else
  puts "Test Failed! Could not find: 'Programming Ruby'" 
end

____________


$ ruby watir_test.rb
/usr/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/firefox.rb:1010:in 
`current_os': undefined local variable or method `plateform' for 
#<FireWatir::Firefox:0x7fc9ce60> (NameError)
        from 
/usr/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/firefox.rb:124:in 
`initialize'
        from 
/usr/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/lib/watir/browser.rb:65:in `new'
        from 
/usr/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/lib/watir/browser.rb:65:in `new'
        from watir_test.rb:8

$


the reason for that is because around line 1000 in 
/usr/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/firefox.rb

the variable platform == 'i386-cygwin', so it can't get caught by select/case 
right below.

all you need to change is

at firefox.rb:1000
from 
  when /mingw32|mswin|windows/i
to 

  when /mingw32|mswin|windows|cygwin/i


and that's it. nothing else.


$ ruby watir_test.rb
sh: C:Program: command not found
Test Failed! Could not find: 'Programming Ruby'

$

(actually the example fails because i have google in french, but it does work

i dont know what the
sh: C:Program: command not found
is doing in the output (and no the -w is not active, it vomits ugly things 
otherwise :))

it would be great to push this change in the next firewatir release so that it 
actually supports cywin

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to