Hi! Help, anybody familiar enough with WicketTester to help me out with "browsing" my wicket application?
> > My main question is: how to process multiple consecutive "raw" > requests using WicketTester, during the same user session. > > By "raw" I mean page requests that do not result from clicking links > on pages, but instead, they would be equivalent to the user simply > typing them into the browser (like the startPage). > > My scheme is as follows: > > We assume the user is logged in, but certain member functionality > (MemberArea -page) is not accessible until email has been confirmed. > > 1. In the Unit-test the user starts a session with > wicketTester.startPage(MemberArea.class); > > 2. Authentication scheme remembers the user and logs her in. > > 3. Authentication scheme, however, notices the user has not confirmed > her email, and issues a throw new > RestartResponseAtInterceptPageException(EmailConfirmationPending.class); > > 4. In order to be allowed to continue, the user is supposed visit a > bookmarkable email confirmation link > http://<site>/EmailConfirmation/confirmationKey > > If the email confirmation is approved, the EmailConfirmation -page > should redirect the user back to the originally requested content > (i.e., MemberArea -page in this test case). > > This is the scenario we want to be unit-tested. > > Now, if she was using a browser, it would be easy: just type the url > into the browser. However, with the wicketTester, I cannot seem to > find a way of accomplishing this. I cannot embed the link onto the web > page, because this would not correspond to the standard scheme: the > link is supposed to arrive separately via email. > > I have tried the following approaches with results indicated below: > a) calling new WicketTester(myApplication).startPage(new > EmailConfirmation(pageParameters)), which results in a completely > cleared PageMap and the method continueToOriginalDestination() in > EmailConfirmation fails for some reason. > Instead, wicketTester.assertRenderedPage(MemberArea.class) should > return true, but it does not because the EmailConfirmation.class is > rendered. > > b) calling wicketTester.setupRequestAndResponse(); and > wicketTester.getLastRenderedPage().setResponsePage(new > EmailConfirmation(pageParameters)), results in a slightly better > functionality. > However, instead of continueToOriginalDestination() on the > EmailConfirmation page rendering the MemberArea page, it now renders > the EmailConfirmationPending -page > which intercepted the request. Not good. > > c) another try, calling wicketTester.setupRequestAndResponse() and > wicketTester.getServletRequest().setRequestToComponent(new > EmailConfirmation(pageParameters)) gives the same results as b). > > If I perform the same tests with a browser, I get the expected > results. Is this somehow not the proper way to handle the raw > requests with wicketTester and expecting the PageMap to be updated > accordingly? > > Hou should I properly implement such tests? Or is it a bug/missing > feature in wicket? > > Thank you in advance! > > -- > Martin Makundi > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]