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

Paul King Paul King <paulk@asert.com.au>
Thu, 07 Dec 2006 23:46:08 +1000


java@herr-der-mails.de wrote:
> ... I still have to understand why ...

Normally WebTest simply ignores dialogs. Think of it as automatically
always clicking the OK button. By using the <expectDialog/> step you
have taken control of dialog handling and are expected to create a
list of the dialogs the user is expected to interact with. You are
stating that you expect one interaction.

Normally you then invoke your test. It would typically cause some
JavaScript to be executed which would trigger the dialog and
"use up" the first expected dialog from the list. It effectively
then moves on to the next expected dialog. After running the test
steps you would go back to the list to make sure all the dialogs
in the list were in fact used. This is what <verifyNoDialogs/>
does.

In your case, you are following a slightly different path.
You state that you are expecting exactly one dialog. The groovy
code is then checking that in fact the dialog hasn't been
used up, i.e. this could only be true if no dialogs were
triggered by your application.

Cheers, Paul.