EDIT: I\'m using Play! version 1.2 (production release)
I want to test controller actions that are secured by Secure module class, so I need to log
I think there must be a misunderstanding of what the @Before interceptor does. It executes before your test is executed. If your test then logs you in, then this event happens AFTER the @Before code has been executed and the results of the secure module should be saved to the Cookie.
Therefore, I can only assume that the Cookie is not being sent with the following request, therefore, I would suggest trying the following...
get the cookie used by the secure cookie from the Response object immediately following your login. Create a Request object and set the Cookie to the request object, then call your POST method, passing in your request object.
I have not tested this code, so not sure how it is going to react to mixing a pre-built request object, and passing in a URL, but not sure what else to suggest.