source: Dev/branches/play-2.0.1/samples/scala/zentasks/test/IntegrationSpec.scala @ 322

Last change on this file since 322 was 322, checked in by hendrikvanantwerpen, 13 years ago

Added Play! framework and application with Jena dependency. Working on
the basic things now (login/register), after that start implementing
our data model.

File size: 1.1 KB
Line 
1package test
2
3import org.specs2.mutable._
4
5import play.api.test._
6import play.api.test.Helpers._
7
8class IntegrationSpec extends Specification {
9 
10  "Application" should {
11   
12    "work from within a browser" in {
13      running(TestServer(3333), HTMLUNIT) { browser =>
14        browser.goTo("http://localhost:3333/")
15        browser.$("header a").first.getText must equalTo("Zentasks")
16        browser.$("#email").text("guillaume@sample.com")
17        browser.$("#password").text("secret111")
18        browser.$("#loginbutton").click()
19        browser.pageSource must contain("Invalid email or password")
20
21        browser.$("#email").text("guillaume@sample.com")
22        browser.$("#password").text("secret")
23        browser.$("#loginbutton").click()
24        browser.$("dl.error").size must equalTo(0)
25        browser.pageSource must not contain("Sign in")
26        browser.pageSource must contain("guillaume@sample.com")
27        browser.pageSource must contain("Logout")
28       
29        val items = browser.$("li")
30        items.size must equalTo(15)
31        items.get(3).getText must contain("Website Delete")
32      }
33    }
34   
35  }
36 
37}
Note: See TracBrowser for help on using the repository browser.