#-------------------------------------------------------------------------------------------------------------# # test with the WATIR controller # # Simple test based on Google/watir demo # #------------------------------------------------------------------------------------------------------------ # #includes require '../watir' # the controller #test::unit includes require 'test/unit' require 'test/unit/ui/console/testrunner' require '../unittests/testUnitAddons' #code to set your current path in Windows $myDir = File.dirname(__FILE__) $LOAD_PATH << $myDir class TC_rwdtinker_suite < Test::Unit::TestCase def test_a_Open1 #-------------------------------------------------------- # test case that shows basic WATIR functionality: # * enter text in a field # * click a button # #variables testSite = 'http://localhost:7705' #open the IE browser $ie = IE.new puts '## Beginning of test: rwdtinker' puts ' ' $ie.goto(testSite) puts ' Action: entered ' + testSite + 'in the address bar.' sleep 1 $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="rwd_help";document.bodyform.submit();').click $ie.button(:caption, 'Click for Version').click $ie.button(:caption, 'Cancel').click sleep 1 $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="rwd_tab_selectiontab";document.bodyform.submit();').click $ie.button(:caption, 'RwdTinker Help Window').click puts ' Action: clicked the Help Window link' end def test_b_Buttons1 sleep 1 $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="rwd_tab_nexttab";document.bodyform.submit();').click puts ' Action: clicked the nexttab link' $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="rwd_tab_main";document.bodyform.submit();').click puts ' Action: clicked the main tab link' $ie.button(:caption, "Cancel").click puts ' Action: clicked the cancel button' end def test_c_tabs $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="rwd_tab_one";document.bodyform.submit();').click puts ' Action: clicked tab one' end def test_d_tabs $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="rwd_tab_selectiontab";document.bodyform.submit();').click puts ' Action: clicked the selectiontab' $ie.button(:caption, 'RwdTinker Back Window').click puts ' Action: clicked the Help Window link' $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="rwd_tab_backone";document.bodyform.submit();').click puts ' Action: clicked the backone tab' assert($ie.pageContainsText("previous window") ) $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="rwd_tab_diagnostictab";document.bodyform.submit();').click puts ' Action: clicked the diagnostictab top link' $ie.button(:caption, "View Ruby Version").click puts ' Action: clicked Ruby Version button.' assert($ie.pageContainsText("Version") ) $ie.button(:caption, "view platform").click puts ' Action: clicked platform button.' assert($ie.pageContainsText("Platform is") ) $ie.button(:caption, "View rwdtinker Version").click puts ' Action: clicked rwdtinker version button.' assert($ie.pageContainsText("rwdtinker version") ) end # end of test_d def test_e_tabs $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="rwd_tab_filelister";document.bodyform.submit();').click assert($ie.pageContainsText("View the list") ) $ie.button(:caption, "List Files").click puts ' Action: clicked the list files button.' $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="fillappletname/rwdviewlogo-0.4.inf";document.bodyform.submit();').click $ie.button(:caption, "View Install Text").click puts ' Action: clicked the View Install Text button.' assert($ie.pageContainsText("rwdviewlogo") ) end def test_f_tabs $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="rwd_tab_zipslister";document.bodyform.submit();').click assert($ie.pageContainsText("File Name") ) assert($ie.pageContainsText("view the list of zip files") ) $ie.button(:caption, "List applets available for installing").click puts ' Action: clicked the List applets available for installing button.' $ie.link(:url, 'javascript:document.bodyform.rwd_action.value="fillziptoinstallname/rwdhelloworld-0.3.zip";document.bodyform.submit();').click end end #end of class TC_google_suite