Sha256: b49b0596beaf33b3b367e6924e162acd7b8a31debc467aa89211a4cb0534c2ce
Contents?: true
Size: 1.74 KB
Versions: 3
Compression:
Stored size: 1.74 KB
Contents
# feature tests for element and the elements collection # revision: $Revision$ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') unless $SETUP_LOADED require 'unittests/setup' class TC_Elements < Test::Unit::TestCase include Watir::Exception def setup uses_page "div.html" end def test_element assert_raises(UnknownObjectException) { browser.element(:id, "div77").click } assert_raises(UnknownObjectException) { browser.element(:title, "div77").click } assert_equal 'div2', browser.element(:class, 'blueText').id assert_equal 'blueText', browser.element(:id, /div2/).class_name assert_equal Watir::HTMLElement, browser.element(:id, 'div2').class end def test_element_iterator assert_equal 3, browser.elements(:class, 'blueText').length assert_equal 3, browser.elements(:class, 'blueText').size assert_equal("span2", browser.elements(:class, 'blueText')[2].id) index = 1 browser.elements(:id, /div/).each do |s| assert_equal(browser.div(:index,index).name, s.name) assert_equal(browser.div(:index,index).id, s.id) assert_equal(browser.div(:index,index).class_name , s.class_name) index += 1 end assert_equal(index - 1, browser.elements(:id, /div/).length) # -1 as we add 1 at the end of the loop end def test_element_enumerable match = browser.elements(:class, 'blueText').detect {|d| d.html =~ /SPAN/} assert_equal('span2', match.id) end def test_objects_in_element assert browser.element(:id, 'buttons1').button(:index,1).exists? assert !browser.element(:id, 'buttons1').button(:index,3).exists? assert browser.element(:id, 'buttons1').button(:name,'b1').exists? end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
watir-1.6.6 | unittests/element_test.rb |
watir-1.6.6.rc2 | unittests/element_test.rb |
watir-1.6.6.rc1 | unittests/element_test.rb |