Hi,
I am trying to automate web management console of our appliance.
I am trying to write a class library using watir which will kind of provide
all functionality which a user can perform using this GUI.
Going step forward I am wrapping this library in unit test to build my 
regression tests.

Problem I am facing is, where do I store ie handle returned by 
Watir::IE.new.
Currently I am creating this instance in my test routine and passing it 
to IGuard.new
call.

If I create this object in the IGuard class itself, I dont know how do I get
access to this ie object in my test class for executing various asserts.

I am facing hard time designing this library in OO way.

Any pointers or samples will really help.
Thanks and Regards,
Manish

------------------
class IGaurd
    include Search
    include Policy
    
    def initialize (ie, machine="", domain="lab.reconnex.net")
        @ie = ie
        @searchList=[]
        @userList=[]
        @machine=machine
        @domain=domain
        @igurl = "https://"+machine+"."+domain+"/analyst";
        if @machine != "" then
            gotoIGuard(@igurl)
        end
    end

    def gotoIGuard(url)
        t = Thread.new {
            #sleep 1
            clicker = GUIHelper.new
            clicker.push_security_alert_yes()
        }
        @ie.goto(url)
        #sleep 1
        #sleep 1
        t.join
    end
    
    def setIG(machine, domain="lab.reconnex.net")
        @machine = machine
        @domain = domain
        @igurl = "https://"[EMAIL PROTECTED]"."+domain+"/analyst"
        gotoIGuard(@igurl)
    end
 
    def adminLogin(passwd="analyst")
        #$ie.text_field(:name, "domain").set(ldapdomain)
        @ie.text_field(:name, "name").set("admin")    
        @ie.text_field(:name, "value").set(passwd)
        @ie.button(:value, "Login").click
    end
 
    def userLogin(user, passwd="analyst", ldapdomain="")
        if ldapdomain != "" then
            @ie.text_field(:name, "domain").set(ldapdomain)
        end
        @ie.text_field(:name, "name").set(user)    
        @ie.text_field(:name, "value").set(passwd)
        @ie.button(:value, "Login").click
    end
    
    def logout
        @ie.frame("topbarFrame").link(:href, /logout/i).click
    end
    
 
    def exit
        self.logout
        @ie.close
        sleep 1
    end

end
------------------
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to