unittests/css_test.rb in watir-1.5.6 vs unittests/css_test.rb in watir-1.6.2

- old
+ new

@@ -1,55 +1,35 @@ # feature tests for css -# revision: $Revision: 1348 $ +# revision: $Revision: 1505 $ -$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_CSS < Test::Unit::TestCase - def divTester( message ) - - divs = $ie.getIE.document.getElementsByTagName("DIV") - puts "Found #{divs.length} div tags" - divs.each do |d| - puts "Checking div #{d.id}" - puts "div #{d.invoke("id") } class is #{d.invoke("className") }" - end - end - def isMessageDisplayed(message) - s = false - divs = $ie.getIE.document.getElementsByTagName("DIV") - #puts "Found #{divs.length} div tags" + divs = browser.divs divs.each do |d| - #puts "----Checking div #{d.id} innertext is ( #{d.innerText} )" - - if d.innerText.to_s.downcase.match( /#{message}/i ) - - #puts "div #{d.invoke("id") } class is #{d.invoke("className") }" - if d.invoke("className").to_s.downcase.match(/show/i) - #puts "message is shown!!!" + if d.text.downcase.match( /#{message}/i ) + if d.class_name.downcase.match(/show/i) s = true end - end end - #puts "Not Shown " if s== false return s end - def test_SuccessMessage + def setup goto_page "cssTest.html" - $ie.button( :caption , "Success").click - - #isMessageDisplayed( "Success" ) - #divTester( "Success" ) + end + + def test_SuccessMessage + browser.button( :caption , "Success").click assert( isMessageDisplayed("Success") ) - $ie.button( :caption , "Failure").click - - assert(!isMessageDisplayed("Success") ) + browser.button(:caption, "Failure").click + assert_false(isMessageDisplayed("Success") ) end end