[Webtest] Cannot make verifyNoDialogs work for simple submit button+alert box

java@herr-der-mails.de java@herr-der-mails.de
Mon, 04 Dec 2006 17:27:51 +0100


Hi,

it's actually a prettry simple test, but I cannot make it work. I've tried both canoo 2.1 and the latest snapshot.

The below given test should fail in my opinion, but it does not. The HTML page simply has a button which will call a function onClick(). This function always opens an alert dialog. Thus, verifyNoDialogs should fail, but it doesn't.

Any help is greatly appreciated.

<html>
  <head>
    <script LANGUAGE="JAVASCRIPT">
	    function buttonClick() {
	    	alert ("buttonClick called");
	    	return false;
    	}
    </script>
  </head>

  <body>
    <form name="TestForm" action="TestResult.html" method="post">
      <input name="TestButton" type="submit" value="TestButton" onClick="return buttonClick();">
    </form>
  </body>
</html>

----

<project name="InstallationCheck" basedir="." default="all">

    <property name="webtest.home" value="/temp/canoo-2.1"/>
    <import file="${webtest.home}/lib/taskdef.xml"/>

    <target name="all" depends="mayPrintANTError, checkWebTest"/>

    <target name="checkWebTest">
        <echo message="webtest.home is ${webtest.home}"/>
        <webtest name="Test">
            <config
                host=""
                port="0"
                basepath=""
                summary="false"
                saveresponse="false"
                haltonfailure="true"
                protocol="file"/>
            <steps>
                <enableJavaScript enable="true"/>

                <invoke url="${basedir}/localTest.html"/>
                <verifyText text="Test"/>

                <selectForm name="TestForm"/>

		<verifyNoDialogs description="Check alert dialog was used" />
                <clickButton name="TestButton"/>
                <verifyNoDialogs description="Check alert dialog was used" />
            </steps>
        </webtest>
    </target>

    <target name="checkANT">
        <available classname="org.apache.tools.ant.ProjectComponent"
            property="ant.version.ok"/>
    </target>

    <target name="mayPrintANTError" unless="ant.version.ok" depends="checkANT">
        <echo message="You have a non-compliant version of ANT"/>
        <echo message="Consider moving WEBTESTHOME/lib/ant.jar"/>
        <echo message="to ANT_HOME/lib."/>
    </target>

</project>

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer