junit + Window.alert

10 views
Skip to first unread message

Pjeutr

unread,
May 15, 2008, 6:55:45 AM5/15/08
to Google Web Toolkit
Hi

I am testing my application by extending GWTTestCase.
In the application I use Window.alert messages and these popup during
the test, and wait for a click.
Is there a way to click them in the test. I looked at fireClickEvent,
but see no way to get a handle to the alert.
Or is there a way to make the test ignore the alerts, so the test
keeps running.

Peter

Ian Petersen

unread,
May 15, 2008, 7:58:13 AM5/15/08
to Google-We...@googlegroups.com
In a non-GWT app it would be easy--just replace window.alert with an
empty function. You could try the same thing with JSNI, but I'm not
sure if it'll work--the compiler might be playing tricks on you. If
it doesn't work with JSNI, try putting a snippet of Javascript at the
top of your test HTML that replaces window.alert. If that doesn't
work, you might be hosed. If so, you'll have to modify your code such
that it doesn't call alert during test runs.

Ian

--
Tired of pop-ups, security holes, and spyware?
Try Firefox: http://www.getfirefox.com

Reply all
Reply to author
Forward
0 new messages