<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "../Config/WebTest.dtd"[
  <!ENTITY config     SYSTEM "../Config/config.xml">
]>

<project name="radioButtonTest" basedir="." default="GenerateReport">
  <property name="webtest.home" location="c:/projects/java/canoo" />
  <property name="apptest.home" location="c:/Projects/PhpWebProjects/emco/UnitTests/canoo" />
  <property name="webtest.config.resultpath" value="${apptest.home}/webtest-results"/>
  <property name="webtest.config.resultfile.html" value="${apptest.home}\webtest-results\results.html"/>
  <property name="resources.dir" value="${webtest.home}/resources"/>

  <property file="${apptest.home}/properties/users.properties"/>
  <import file="${webtest.home}/lib/taskdef.xml"/>

  <target name="GenerateReport" depends="radioButtonTest">
		<!-- copy resources needed by the html page to the same dir: the report must be ok too when opened from filesystem (without webserver) -->
		<copy todir="${webtest.config.resultpath}">
			<fileset dir="${resources.dir}">
				<include name="report.css"/>
				<include name="showHide.js"/>
        <include name="images/*.*"/>
			</fileset>
		</copy>

    <echo message="Report Translation"/>
    <xslt
      in="${webtest.config.resultpath}\results.xml"
      out="${webtest.config.resultpath}\results.html"
      style="${resources.dir}\WebTestReport.xsl"
    />
		<echo message="Webtest result overview available in ${webtest.config.resultfile.html}"/>
  </target>

  <target name="radioButtonTest" >
    <webtest name="radioButtonTest">
      &config;
      <steps>
        <invoke description="Go to test page" url="unittests/canoo/radioButtons.html" />
        <setRadioButton description="Click the existing_user radio button" name="new_type" value="existing_user" saveResponse="true"/>
        <clickButton description="Click the submit button" htmlid="Update" />
        <verifyXPath xpath="count(//form/input[@name='new_type']/@checked)" text="1" />
      </steps>
    </webtest>
  </target>
</project>
