<commit_before>package controllers.s7_employment

import org.specs2.mutable.{Tags, Specification}
import play.api.test.WithBrowser
import controllers.ClaimScenarioFactory
import utils.pageobjects.s7_employment._
import utils.pageobjects.ClaimScenario

class G9NecessaryExpensesIntegrationSpec extends Specification with Tags {
  "Necessary Expenses" should {
    "be presented" in new WithBrowser with G8AboutExpensesPageContext {
      val claim = ClaimScenarioFactory s7Employment()
      page goToThePage()
      page fillPageWith claim
      page submitPage()
    }

    "contain 1 completed form" in new WithBrowser with G8AboutExpensesPageContext {
      val claim = ClaimScenarioFactory s7Employment()
      page goToThePage()
      page fillPageWith claim
      val p = page submitPage()
      p fillPageWith claim
      p submitPage() match {
        case p: G9NecessaryExpensesPage => p numberSectionsCompleted()  mustEqual 2
        case _ => ko("Next Page is not of the right type.")
      }
    }

    "be able to navigate back to a completed form" in new WithBrowser  with G8AboutExpensesPageContext {
      val claim = ClaimScenarioFactory s7Employment()
      page goToThePage()
      page fillPageWith claim
      val p = page submitPage()
      p fillPageWith claim
      p submitPage() match {
        case p: G9NecessaryExpensesPage => p numberSectionsCompleted()  mustEqual 2
        case _ => ko("Next Page is not of the right type.")
      }
      p goBack() must beAnInstanceOf[G8AboutExpensesPage]
    }
  } section("integration",models.domain.Employed.id)
}<commit_msg>Fixed test<commit_after>package controllers.s7_employment

import org.specs2.mutable.{Tags, Specification}
import play.api.test.WithBrowser
import controllers.ClaimScenarioFactory
import utils.pageobjects.s7_employment._
import utils.pageobjects.ClaimScenario

class G9NecessaryExpensesIntegrationSpec extends Specification with Tags {
  "Necessary expenses" should {
    "be presented" in new WithBrowser with G8AboutExpensesPageContext {
      page goToThePage()
    }

    "contain 1 completed form" in new WithBrowser with G8AboutExpensesPageContext {
      val claim = ClaimScenarioFactory s7Employment()
      page goToThePage()
      page fillPageWith claim
      page submitPage() match {
        case p: G9NecessaryExpensesPage => p numberSectionsCompleted()  mustEqual 1
        case _ => ko("Next Page is not of the right type.")
      }
    }

    "go to job completion directly" in new WithBrowser with G8AboutExpensesPageContext {
      val claim = new ClaimScenario
      claim.EmploymentDoYouPayforAnythingNecessaryToDoYourJob_1= "no"
      claim.EmploymentDoYouPayAnyoneLookAfterYourChild_1= "no"
      claim.EmploymentDoYouPayAnyonetoLookAfterPersonYouCareFor_1= "no"

      page goToThePage()
      page fillPageWith claim
      page submitPage() must beAnInstanceOf[G14JobCompletionPage]
    }

    "go to childcare" in new WithBrowser with G8AboutExpensesPageContext {
      val claim = new ClaimScenario
      claim.EmploymentDoYouPayforAnythingNecessaryToDoYourJob_1= "no"
      claim.EmploymentDoYouPayAnyoneLookAfterYourChild_1= "yes"
      claim.EmploymentDoYouPayAnyonetoLookAfterPersonYouCareFor_1= "yes"

      page goToThePage()
      page fillPageWith claim
      page submitPage() must beAnInstanceOf[G10ChildcareExpensesPage]
    }

    "go to care" in new WithBrowser with G8AboutExpensesPageContext {
      val claim = new ClaimScenario
      claim.EmploymentDoYouPayforAnythingNecessaryToDoYourJob_1= "no"
      claim.EmploymentDoYouPayAnyoneLookAfterYourChild_1= "no"
      claim.EmploymentDoYouPayAnyonetoLookAfterPersonYouCareFor_1= "yes"

      page goToThePage()
      page fillPageWith claim
      page submitPage() must beAnInstanceOf[G12PersonYouCareForExpensesPage]
    }

    "be able to navigate back to a completed form" in new WithBrowser  with G7PensionSchemesPageContext {
      val claim = ClaimScenarioFactory s7Employment()
      page goToThePage()
      page fillPageWith claim
      val submitted = page submitPage()
      val backPage = submitted goBack ()
      backPage must beAnInstanceOf[G7PensionSchemesPage]
    }
  } section("integration",models.domain.Employed.id)
}
{'fraction_non_alphanumeric': 0.060104117368670135, 'fraction_numerical': 0.011121628017037387, 'mean_word_length': 3.7979568671963677, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6818347', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1210, 'n_words': 325}