Testing behavior of a ModalWindows: close, click...

2008-07-10 Thread Daniele Dellafiore
Hi all.

I am trying to test, with WicketTester, a behavior like this, a
classic delete confirmation dialog:

click on link opens a ModalWindow (OK)
check that the Modal is open indeed (OK, with
tester.assertComponentOnAjaxResponse(deleteModal);)
click on a confirm button on the page in the modal, and test that the
element has been deleted (NO!!!)

I cannot find a way to simulate the click becouse I cannot find the
path for the page inside the modal window.
For me it will be enough to close the modal from the test couse the
code that perform the delete is in the CloseCallback.

Is possible with WicketTester or I have to use some other testing framework?

-- 
Daniele Dellafiore
http://blog.ildella.net/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Testing behavior of a ModalWindows: close, click...

2008-07-10 Thread Timo Rantalaiho
On Thu, 10 Jul 2008, Daniele Dellafiore wrote:
 click on link opens a ModalWindow (OK)
 check that the Modal is open indeed (OK, with
 tester.assertComponentOnAjaxResponse(deleteModal);)
 click on a confirm button on the page in the modal, and test that the
 element has been deleted (NO!!!)


modalWindow.visitChildren(AjaxButton.class, new IVisitor() {
public void component(Component component) {
if (component.getId().equals(confirm)) {
wicketTester.executeAjaxEvent(component, onclick);
}
return CONTINUE_TRAVERSAL;
}
});
assertTrue(elementHasBeenDeleted());

 I cannot find a way to simulate the click becouse I cannot find the
 path for the page inside the modal window.

WickeTester has a method for printing component tree to 
System.out, but using visitors for long component paths
helps to make your tests more robust.

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]