;Implement the Page Object pattern. The Page Object pattern represents the screens of your web app as a series of objects
;Author: henrytejera@gmail.com
#include <../../lib/sda.core.au3>
#include <altaVistaPage.au3>

;Execute Test
PagePatternTest()

Func PagePatternTest()
	Local $oTest = NewTest("Page Pattern Test")
	Local $oAltaVistaPage = AltaVistaPage()
	Local $oPageRepo

	;Start Test
	$oTest.Setup()

	;Test Report create
	$oTest.Report.Create

	;New Browser
	$oTest.NewBrowser('iehta','http://es.altavista.com/')
	$oTest.Browser.start

	$oAltaVistaPage.Open()
	$oTest.AddStepResult("Open Alta Vista Page",$oAltaVistaPage.ResultDescription ,$oAltaVistaPage.Result)

	$oPageRepo = $oAltaVistaPage.Search("BlueDuck SDA")

	If $oPageRepo.oRepo.WaitForText("Try Blueduck SDA") = 1 Then
		$oTest.AddStepResult("Search in ALta Vista","Search OK",1)
	Else
		$oTest.AddStepResult("Search in ALta Vista","Search Failed",0)
	EndIf

	$oTest.Report.Close
	$oTest.Browser.stop
EndFunc