dofile("../lib/selenium.lua")
dofile("../lib/luaunit.lua")

TestGoogle = {} --Test class

function TestGoogle:setUp()
	 self.sele = selenium.new ('*iehta','http://www.google.com','127.0.0.1','4444','3000')
	 self.sele:start()
end

function TestGoogle:test_Search()
	 self.sele:open('/')
	 self.sele:waitForPageToLoad('3000')
	 self.sele:type('q','Lua Programming')
	 self.sele:click("btnG")
	 self.sele:waitForPageToLoad('3000')
	 res = self.sele:isTextPresent('The Programming Language Lua')
	 assertEquals(res,true)
end

function TestGoogle:tearDown()
	self.sele:stop()
end

-- will execute only one test
LuaUnit:run('TestGoogle:test_Search')