Sha256: d6c05e8e0af26d2f256ba9b0fa012ec6b45db63ba8955d622b9bd31686a2f22c

Contents?: true

Size: 1.66 KB

Versions: 3

Compression:

Stored size: 1.66 KB

Contents

# feature tests for JavaScript events
# revision: $Revision: 1177 $

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') if $0 == __FILE__
require 'unittests/setup'

class TC_JSEvents < Test::Unit::TestCase
  include Watir
  
  def setup
    $ie.goto($htmlRoot + "javascriptevents.html")
  end
  
  def test_Button_disabled
    assert(! $ie.button(:caption, "Button 1").enabled?) 
  end
  
  def test_Button_Enabled
    $ie.text_field(:name, "entertext").fire_event("onkeyup")
    assert($ie.button(:caption, "Button 1").enabled?)   
  end
  
  def test_Button_click
    # Firing event to make button enabled
    $ie.text_field(:name, "entertext").fire_event("onKeyUp")
    # Clicking the button
    $ie.button(:caption, "Button 1").click
    assert($ie.text.include?("PASS") )
  end
  
  #onMouseOver tests
  #window status
  
  def test_no_status_bar_exception
    $ie.link(:text, "New Window No Status Bar").click
    status_bar_test_win = nil
    # Note: this test will fail if the Google toolbar popup blocker is turned on
    assert_nothing_raised { status_bar_test_win = Watir::IE.attach(:title, "Pass Page") }
    assert_raises( Watir::NoStatusBarException ) { status_bar_test_win.status }
    status_bar_test_win.close
    status_bar_test_win = nil
  end
  
  def test_page_nostatus
    assert_equal("Done", $ie.status) 
  end
  
  def test_set_page_status
    $ie.link(:text, "Check the Status").fire_event("onMouseOver")
    assert_equal("It worked", $ie.status) 
  end
  
  def test_clear_page_status
    $ie.link(:text, "Clear the Status").fire_event("onMouseOver")
    assert_equal("Done", $ie.status) 
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watir-1.5.3 unittests/windows/js_events_test.rb
watir-1.5.4 unittests/windows/js_events_test.rb
watir-1.5.2 unittests/windows/js_events_test.rb