<commit_before>package views.disposal_of_vehicle

import helpers.webbrowser.TestHarness
import pages.disposal_of_vehicle._
import helpers.disposal_of_vehicle.CacheSetup
import pages.common.ErrorPanel
import helpers.UiSpec

class DisposeIntegrationSpec extends UiSpec with TestHarness {

  "Dispose Integration" should {

    "be presented" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      assert(page.title equals DisposePage.title)
    }

    "display DisposeSuccess page on correct submission" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      CacheSetup.vehicleLookupFormModel()
      DisposePage.happyPath

      assert(page.title equals DisposeSuccessPage.title)
    }

    "display validation errors when no fields are completed" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      DisposePage.sadPath

      assert(ErrorPanel.numberOfErrors equals 3)
    }

    "redirect when no VehicleLookupFormModel is cached" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      go to DisposePage.url

      assert(page.title equals VehicleLookupPage.title)
    }


    "redirect when no VehicleLookupFormModel is cached" in new WebBrowser {
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      assert(page.title equals SetupTradeDetailsPage.title)
    }


    "redirect when no traderBusinessName is cached" in new WebBrowser {
      go to DisposePage.url

      assert(page.title equals SetupTradeDetailsPage.title)
    }

    "display validation errors when month and year are input but no day" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      DisposePage.dateOfDisposalMonth select "12"
      DisposePage.dateOfDisposalYear enter "2013"
      click on DisposePage.dispose

      assert(ErrorPanel.numberOfErrors equals 1)
    }

    "display validation errors when day and year are input but no month" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      DisposePage.dateOfDisposalDay select "12"
      DisposePage.dateOfDisposalYear enter "2013"
      click on DisposePage.dispose

      assert(ErrorPanel.numberOfErrors equals 1)
    }

    "display validation errors when day and month are input but no year" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      DisposePage.dateOfDisposalDay select "12"
      DisposePage.dateOfDisposalMonth select "2"
      click on DisposePage.dispose

      assert(ErrorPanel.numberOfErrors equals 1)
    }

    "display previous page when back link is clicked" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      click on DisposePage.back

      assert(page.title equals VehicleLookupPage.title)
    }
  }
}
<commit_msg>amended duplicate tests name to prevent errors<commit_after>package views.disposal_of_vehicle

import helpers.webbrowser.TestHarness
import pages.disposal_of_vehicle._
import helpers.disposal_of_vehicle.CacheSetup
import pages.common.ErrorPanel
import helpers.UiSpec

class DisposeIntegrationSpec extends UiSpec with TestHarness {

  "Dispose Integration" should {

    "be presented" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      assert(page.title equals DisposePage.title)
    }

    "display DisposeSuccess page on correct submission" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      CacheSetup.vehicleLookupFormModel()
      DisposePage.happyPath

      assert(page.title equals DisposeSuccessPage.title)
    }

    "display validation errors when no fields are completed" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      DisposePage.sadPath

      assert(ErrorPanel.numberOfErrors equals 3)
    }

    "redirect when no VehicleLookupFormModel is cached" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      go to DisposePage.url

      assert(page.title equals VehicleLookupPage.title)
    }


    "redirect when no businessChooseYourAddress is cached" in new WebBrowser {
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      assert(page.title equals SetupTradeDetailsPage.title)
    }


    "redirect when no traderBusinessName is cached" in new WebBrowser {
      go to DisposePage.url

      assert(page.title equals SetupTradeDetailsPage.title)
    }

    "display validation errors when month and year are input but no day" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      DisposePage.dateOfDisposalMonth select "12"
      DisposePage.dateOfDisposalYear enter "2013"
      click on DisposePage.dispose

      assert(ErrorPanel.numberOfErrors equals 1)
    }

    "display validation errors when day and year are input but no month" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      DisposePage.dateOfDisposalDay select "12"
      DisposePage.dateOfDisposalYear enter "2013"
      click on DisposePage.dispose

      assert(ErrorPanel.numberOfErrors equals 1)
    }

    "display validation errors when day and month are input but no year" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      DisposePage.dateOfDisposalDay select "12"
      DisposePage.dateOfDisposalMonth select "2"
      click on DisposePage.dispose

      assert(ErrorPanel.numberOfErrors equals 1)
    }

    "display previous page when back link is clicked" in new WebBrowser {
      CacheSetup.businessChooseYourAddress()
      CacheSetup.vehicleDetailsModel()
      go to DisposePage.url

      click on DisposePage.back

      assert(page.title equals VehicleLookupPage.title)
    }
  }
}

{'fraction_non_alphanumeric': 0.056080655324511654, 'fraction_numerical': 0.0059861373660995585, 'mean_word_length': 3.424390243902439, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5561517', 'n_tokens_mistral': 1806, 'n_tokens_neox': 1669, 'n_words': 470}