<commit_before>package test

import org.specs2.mutable._

import play.api.test._
import play.api.test.Helpers._
import java.io.File

class IntegrationSpec extends Specification {
  
  "Application" should {
    
    "work from within a browser" in new WithBrowser(port = 3333, webDriver = HTMLUNIT, app = FakeApplication(path = new File("sample"))) {

      // login failed
      browser.goTo("http://localhost:3333/")
      browser.$("#email").text("<EMAIL>")
      browser.$("#password").text("<PASSWORD>")
      browser.$("#loginbutton").click()
      browser.pageSource must contain("Invalid email or password")

      // login succeded
      browser.$("#email").text("<EMAIL>")
      browser.$("#password").text("<PASSWORD>")
      browser.$("#loginbutton").click()
      browser.$("dl.error").size must equalTo(0)
      browser.pageSource must not contain("Sign in")
      browser.pageSource must contain("logout")

      // logout
      browser.$("a").click()
      browser.pageSource must contain("Sign in")

      browser.goTo("http://localhost:3333/message/write")
      browser.pageSource must contain("Sign in")

    }

    "authorize" in new WithBrowser(port = 3333, webDriver = HTMLUNIT, app = FakeApplication(path = new File("sample"))) {

      // login succeded
      browser.goTo("http://localhost:3333/")
      browser.$("#email").text("<EMAIL>")
      browser.$("#password").text("<PASSWORD>")
      browser.$("#loginbutton").click()
      browser.$("dl.error").size must equalTo(0)
      browser.pageSource must not contain("Sign in")
      browser.pageSource must contain("logout")

      browser.goTo("http://localhost:3333/message/write")
      browser.pageSource must contain("no permission")

      browser.goTo("http://localhost:3333/logout")
      browser.$("#email").text("<EMAIL>")
      browser.$("#password").text("<PASSWORD>")
      browser.$("#loginbutton").click()
      browser.$("dl.error").size must equalTo(0)
      browser.goTo("http://localhost:3333/message/write")
      browser.pageSource must not contain("no permission")

    }

  }
  
}
<commit_msg>fix IntegrationSpec.scala<commit_after>package test

import org.specs2.mutable._

import play.api.test._
import play.api.test.Helpers._
import java.io.File

class IntegrationSpec extends Specification {
  
  "Application" should {
    
    "work from within a browser" in new WithBrowser(webDriver = HTMLUNIT, app = FakeApplication(path = new File("sample"))) {

      val baseURL = s"http://localhost:${port}"
      // login failed
      browser.goTo(baseURL)
      browser.$("#email").text("<EMAIL>")
      browser.$("#password").text("<PASSWORD>")
      browser.$("#loginbutton").click()
      browser.pageSource must contain("Invalid email or password")

      // login succeded
      browser.$("#email").text("<EMAIL>")
      browser.$("#password").text("<PASSWORD>")
      browser.$("#loginbutton").click()
      browser.$("dl.error").size must equalTo(0)
      browser.pageSource must not contain("Sign in")
      browser.pageSource must contain("logout")

      // logout
      browser.$("a").click()
      browser.pageSource must contain("Sign in")

      browser.goTo(s"$baseURL/message/write")
      browser.pageSource must contain("Sign in")

    }

    "authorize" in new WithBrowser(webDriver = HTMLUNIT, app = FakeApplication(path = new File("sample"))) {

      val baseURL = s"http://localhost:${port}"

      // login succeded
      browser.goTo(baseURL)
      browser.$("#email").text("<EMAIL>")
      browser.$("#password").text("<PASSWORD>")
      browser.$("#loginbutton").click()
      browser.$("dl.error").size must equalTo(0)
      browser.pageSource must not contain("Sign in")
      browser.pageSource must contain("logout")

      browser.goTo(s"${baseURL}/message/write")
      browser.pageSource must contain("no permission")

      browser.goTo(s"${baseURL}/logout")
      browser.$("#email").text("<EMAIL>")
      browser.$("#password").text("<PASSWORD>")
      browser.$("#loginbutton").click()
      browser.$("dl.error").size must equalTo(0)
      browser.goTo(s"${baseURL}/message/write")
      browser.pageSource must not contain("no permission")

    }

  }
  
}

{'fraction_non_alphanumeric': 0.17274243507267095, 'fraction_numerical': 0.009530617107457708, 'mean_word_length': 3.3189300411522633, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '952359', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1198, 'n_words': 235}