@Test
public void test1() {
beginAt("login");
setTextField("username", "myLogin");
setTextField("password", "myPassword");
clickButton("signin");
clickLink("supportedLayouts");
clickLink("newUplinkRequest");
String uplinkName = "my test uplink request";
setTextField("coolName", uplinkName);
clickLink("updateDescription");
clickLink("supportedLayouts");
assertTextPresent(uplinkName);
assertEquals(1,UplinkRequest.count());
UplinkRequest dbUplink = ((UplinkRequest)UplinkRequest.findAll().get(0)).refresh();
assertEquals(uplinkName, dbUplink.coolName);
}
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/3ImRbHH1oMYJ.
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/PtpsUsn4aJ4J.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
thanks,
dominik
--
Dominik Dorn
http://dominikdorn.com
http://twitter.com/domdorn
Skripten, Mitschriften, Lernunterlagen, etc. findest Du auf
http://www.studyguru.eu !
- net.sourceforge.jwebunit -> jwebunit-htmlunit-plugin 3.0
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/JF8SNDUHtQsJ.
It works without a problem with the dependencies file here :)
> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/iFSQzWkxA6sJ.
- net.sourceforge.jwebunit -> jwebunit-htmlunit-plugin 3.0:
exclude:
- javax.servlet -> servlet-api
- ch.qos.logback -> *
How are you handling logins/sesssions? I've added thsoe methods in the
BaseFunctionalTest class:
protected Http.Cookie sessionToCookie(Scope.Session sessionStore){
StringBuilder session = new StringBuilder();
for (String key : sessionStore.all().keySet()) {
session.append("\u0000");
session.append(key);
session.append(":");
session.append(sessionStore.all().get(key));
session.append("\u0000");
}
String sessionData = null;
try {
sessionData = URLEncoder.encode(session.toString(), "utf-8");
String sign = Crypto.sign(sessionData, Play.secretKey.getBytes());
Http.Cookie cookie = new Http.Cookie();
cookie.name =
Play.configuration.getProperty("application.session.cookie",
"PLAY")+"_SESSION";
cookie.value = sign + "-" + sessionData;
cookie.domain = null;
cookie.path = "/";
cookie.maxAge = null;
cookie.secure = false;
cookie.httpOnly = false;
return cookie;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
}
protected void setSession(Scope.Session session, String domain)
{
Http.Cookie cookie = sessionToCookie(session);
wt.getTestContext().addCookie(cookie.name, cookie.value,
Http.Request.current().host);
}
so now I can put stuff like this into my tests @Setup method:
Scope.Session session = new Scope.Session();
session.put("username", "dom...@host.com");
setSession(session);
wt.beginAt(getRouteAbsolute("sgcore.Account.index"));
I'm not quite sure if accessing the request in the helper method is
the right way.. is there always a request available in test-mode? or
is there another way to get to the current hostname?