unittests/javascript_test.rb in firewatir-1.2.1 vs unittests/javascript_test.rb in firewatir-1.6.2
- old
+ new
@@ -1,71 +1,75 @@
-$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
+$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED
require 'unittests/setup'
class TC_JavaScript_Test < Test::Unit::TestCase
- include FireWatir
+
# include FireWatir::Dialog
def setup
- $ff.goto($htmlRoot + 'JavascriptClick.html')
+ goto_page 'JavascriptClick.html'
end
+ tag_method :test_alert, :fails_on_ie
def test_alert
- #$ff.button(:id, "btnAlert").click_no_wait()
+ #browser.button(:id, "btnAlert").click_no_wait()
- #$ff.click_jspopup_button("OK")
- $ff.startClicker("ok", 1, '', "Press OK")
- $ff.button(:id, "btnAlert").click
+ #browser.click_jspopup_button("OK")
+ browser.startClicker("ok", 1, '', "Press OK")
+ browser.button(:id, "btnAlert").click
- assert_equal($ff.text_field(:id, "testResult").value , "You pressed the Alert button!")
- assert_equal("Press OK", $ff.get_popup_text)
+ assert_equal(browser.text_field(:id, "testResult").value , "You pressed the Alert button!")
+ assert_equal("Press OK", browser.get_popup_text)
- $ff.startClicker("ok")
- $ff.button(:id, "btnAlert").click
+ browser.startClicker("ok")
+ browser.button(:id, "btnAlert").click
- assert_equal($ff.text_field(:id, "testResult").value , "You pressed the Alert button!")
- assert_equal("Press OK", $ff.get_popup_text)
+ assert_equal(browser.text_field(:id, "testResult").value , "You pressed the Alert button!")
+ assert_equal("Press OK", browser.get_popup_text)
end
+ tag_method :test_confirm_ok, :fails_on_ie
def test_confirm_ok
- #$ff.button(:id, "btnConfirm").click_no_wait()
+ #browser.button(:id, "btnConfirm").click_no_wait()
- #$ff.click_jspopup_button("OK")
- $ff.startClicker("ok", 1, '', "Press a button")
- $ff.button(:id, "btnConfirm").click
+ #browser.click_jspopup_button("OK")
+ browser.startClicker("ok", 1, '', "Press a button")
+ browser.button(:id, "btnConfirm").click
- assert_equal($ff.text_field(:id, "testResult").value , "You pressed the Confirm and OK button!")
- assert_equal("Press a button", $ff.get_popup_text)
+ assert_equal(browser.text_field(:id, "testResult").value , "You pressed the Confirm and OK button!")
+ assert_equal("Press a button", browser.get_popup_text)
- $ff.startClicker("ok")
- $ff.button(:id, "btnConfirm").click
+ browser.startClicker("ok")
+ browser.button(:id, "btnConfirm").click
- assert_equal($ff.text_field(:id, "testResult").value , "You pressed the Confirm and OK button!")
- assert_equal("Press a button", $ff.get_popup_text)
+ assert_equal(browser.text_field(:id, "testResult").value , "You pressed the Confirm and OK button!")
+ assert_equal("Press a button", browser.get_popup_text)
end
+ tag_method :test_confirm_cancel, :fails_on_ie
def test_confirm_cancel
- #$ff.button(:id, "btnConfirm").click_no_wait()
+ #browser.button(:id, "btnConfirm").click_no_wait()
- #$ff.click_jspopup_button("Cancel")
- $ff.startClicker("cancel", 1, '', "Press a button")
- $ff.button(:id, "btnConfirm").click
+ #browser.click_jspopup_button("Cancel")
+ browser.startClicker("cancel", 1, '', "Press a button")
+ browser.button(:id, "btnConfirm").click
- assert_equal($ff.text_field(:id, "testResult").value, "You pressed the Confirm and Cancel button!")
- assert_equal("Press a button", $ff.get_popup_text)
+ assert_equal(browser.text_field(:id, "testResult").value, "You pressed the Confirm and Cancel button!")
+ assert_equal("Press a button", browser.get_popup_text)
- $ff.startClicker("cancel")
- $ff.button(:id, "btnConfirm").click
+ browser.startClicker("cancel")
+ browser.button(:id, "btnConfirm").click
- assert_equal($ff.text_field(:id, "testResult").value, "You pressed the Confirm and Cancel button!")
- assert_equal("Press a button", $ff.get_popup_text)
+ assert_equal(browser.text_field(:id, "testResult").value, "You pressed the Confirm and Cancel button!")
+ assert_equal("Press a button", browser.get_popup_text)
end
+ tag_method :test_ok_selectbox, :fails_on_ie
def test_ok_selectbox
- $ff.goto($htmlRoot + "selectboxes1.html")
- $ff.startClicker("ok")
- $ff.select_list(:id , "selectbox_5").select_value(/2/)
+ goto_page("selectboxes1.html")
+ browser.startClicker("ok")
+ browser.select_list(:id , "selectbox_5").select_value(/2/)
- assert_equal($ff.text_field(:id, "txtAlert").value , "You pressed OK button")
- assert_equal("Press OK", $ff.get_popup_text)
+ assert_equal(browser.text_field(:id, "txtAlert").value , "You pressed OK button")
+ assert_equal("Press OK", browser.get_popup_text)
end
end