You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Per Newgro <pe...@gmx.ch> on 2007/10/25 16:27:07 UTC

WicketTester - reload page after model changed

Hi *,

how can i reload the page managed by my wicketTester instance. The background is that i try to test the markup on a css-class after the model of component has changed.

In production mode everything works, but howto test it?

Cheers
Per
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WicketTester - reload page after model changed

Posted by Newgro <pe...@gmx.ch>.
Hi,

found the solution. With replacing
final WebRequestCycle cycle = _tester.setupRequestAndResponse();
all works as expected.

Thanks for the help
Per
-- 
View this message in context: http://www.nabble.com/WicketTester---reload-page-after-model-changed-tf4691262.html#a13422228
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WicketTester - reload page after model changed

Posted by Newgro <pe...@gmx.ch>.
Hi David,

thanks for your reply. I tried your way, but didn't overwirte the
WicketTester. I simply added

  final WebRequestCycle cycle = _tester.createRequestCycle();
  p.setModelObject(refreshDay);
  try {
    cycle.request(new PageRequestTarget(_tester.getLastRenderedPage()));
  } finally {
    cycle.getResponse().close();
  }
  _tester.assertNoErrorMessage();

But now i have the old and the new rendered page in
System.out.println(_tester.getServletResponse().getDocument());

Can i avoid that?

Thanks Per
-- 
View this message in context: http://www.nabble.com/WicketTester---reload-page-after-model-changed-tf4691262.html#a13421842
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: WicketTester - reload page after model changed

Posted by David Shepherdson <da...@ontology-partners.com>.
On Thursday 25 October 2007 3.27.07 pm Per Newgro wrote:

> how can i reload the page managed by my wicketTester instance.

We're doing it with something like this in a subclass of WicketTester:

    public Page refresh() {

        final WebRequestCycle cycle = createRequestCycle();
        try {
            cycle.request(new PageRequestTarget(getLastRenderedPage()));
        } finally {
            cycle.getResponse().close();
        }
        
        //postProcessRequestCycle(cycle);
        
        return getLastRenderedPage();
    }

The only difficulty is the commented-out line: the 
postProcessRequestCycle(...) method in MockWebApplication is private, 
so we had to copy the code into our tester class.

David


.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org