This is my code. However, this strange error happens even for the simplest 
scenario. 

------------------------------------

require 'rubygems'
require 'watir'
require 'test/unit' 

include Watir

class TC_NTMS_LOGIN < Test::Unit::TestCase 

        def setup()
                @ie = Watir::IE.start("localhost/NTMS/index.aspx")
                if (@ie.contains_text(/Welcome! You are currently signed in 
as/))
                        @ie.link(:id, 'ctl00_MainContent_lbtnLogOut').click
                end     
        end

        def teardown()
                @ie.close
        end
        
        def test_thud1_login()
                @ie.text_field(:id, 
'ctl00_MainContent_txtUserName').set('thud1')
                @ie.text_field(:id, 
'ctl00_MainContent_txtPassword').set('PASSWORD')
                @ie.button(:id, 'ctl00_MainContent_btnLogin').click
                
                assert(@ie.contains_text('Report Page'))

        end
        
        def test_thud2_login()
                @ie.text_field(:id, 
'ctl00_MainContent_txtUserName').set('thud2')
                @ie.text_field(:id, 
'ctl00_MainContent_txtPassword').set('PASSWORD')
                @ie.button(:id, 'ctl00_MainContent_btnLogin').click
                
                assert(@ie.title =~ /NTMS - Welcome/, 'thud2 should be 
redirected to Welcome page')

        end
        
        def test_thud1_login_and_logout()
                @ie.text_field(:id, 
'ctl00_MainContent_txtUserName').set('thud1')
                @ie.text_field(:id, 
'ctl00_MainContent_txtPassword').set('PASSWORD')
                @ie.button(:id, 'ctl00_MainContent_btnLogin').click
                @ie.link(:id, 'ctl00_hplHome').click
                assert(@ie.contains_text(/Welcome! You are currently signed in 
as thud1/), 'should contains welcome info')
                @ie.link(:id, 'ctl00_MainContent_lbtnLogOut').click
                assert([EMAIL PROTECTED](/Welcome! You are currently signed in 
as thud1/), 'should not contains welcome info')

        end
        
        def test_links()
                @ie.link(:id, 'ctl00_hplHome').click
                assert(@ie.title =~ /NTMS - Welcome to/, 'title should be NTMS 
- Welcome ...')
                @ie.link(:url, 
'http://localhost/NTMS/register/forgot.aspx').click
                assert(@ie.title =~ /Request Account Information/, 'title 
should be NTMS - Request Account Information ...')
                @ie.link(:id, 'ctl00_hplHome').click
                @ie.link(:url, 
'http://localhost/NTMS/register/index.aspx').click
                assert(@ie.title =~ /Register/, 'title should be NTMS - 
Register ...')
        end 

        def test_quick_search()
        
                @ie.text_field(:id, 'ctl00_MainContent_txtTickNumber').set('4')
                @ie.select_list(:id, 
'ctl00_MainContent_ddlStatesQuick').select('DE')
                @ie.button(:id, 'ctl00_MainContent_btnQuickSearch').click

                assert(@ie.title =~ /Search/, 'title should be NTMS - Search 
...')
        end 

end
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6466&messageID=18357#18357
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to