verifyNoDialogs should be used in conjunction with expectDialog or
expectDialogs.
I couldn't see one in your test after a quick scan. Because the test is
automated,
you provide ahead of time an expected user response so that for complicated
dialogs
you can test out various behaviours, e.g. hitting the OK vs the Cancel button.
For your simple dialog, there isn't a wide range of behaviours available but
you still need to provide the expectation. For more details, check out:
http://webtest.canoo.com/webtest/manual/expectDialog.html
The expectation is simply placed before the action which will fire off
the JavaScript that triggers the dialog. (If you are into Agile development
this technique is very similar to a concept called mocking).
Cheers, Paul.
[EMAIL PROTECTED] wrote:
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>
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest