<commit_before>package views.disposal_of_vehicle

import helpers.UiSpec
import helpers.webbrowser.TestHarness
import pages.disposal_of_vehicle.BeforeYouStartPage.startNow
import pages.disposal_of_vehicle._
import org.openqa.selenium.WebDriver
import helpers.disposal_of_vehicle.CookieFactoryForUISpecs
import mappings.disposal_of_vehicle.RelatedCacheKeys

class BeforeYouStartIntegrationSpec extends UiSpec with TestHarness  {

  "BeforeYouStart Integration" should {

    "be presented" in new WebBrowser {
      go to BeforeYouStartPage

      assert(page.title equals BeforeYouStartPage.title)
    }

    "go to next page after the button is clicked" in new WebBrowser {
      go to BeforeYouStartPage

      click on startNow

      assert(page.title equals SetupTradeDetailsPage.title)
    }

    "remove redundant cookies when 'exit' button is clicked" in new WebBrowser {
      def cacheSetup()(implicit webDriver: WebDriver) =
        CookieFactoryForUISpecs.setupTradeDetailsIntegration().
          businessChooseYourAddressIntegration().
          dealerDetailsIntegration().
          vehicleDetailsModelIntegration().
          disposeFormModelIntegration().
          disposeTransactionIdIntegration().
          vehicleRegistrationNumberIntegration()

      go to BeforeYouStartPage
      cacheSetup()
      go to BeforeYouStartPage

      // Verify the cookies identified by the full set of cache keys have been removed
      RelatedCacheKeys.FullSet.map(cacheKey => assert(webDriver.manage().getCookieNamed(cacheKey) == null))
    }
  }
}<commit_msg>Refactor: Changed map to foreach as the return type will be unit<commit_after>package views.disposal_of_vehicle

import helpers.UiSpec
import helpers.webbrowser.TestHarness
import pages.disposal_of_vehicle.BeforeYouStartPage.startNow
import pages.disposal_of_vehicle._
import org.openqa.selenium.WebDriver
import helpers.disposal_of_vehicle.CookieFactoryForUISpecs
import mappings.disposal_of_vehicle.RelatedCacheKeys

class BeforeYouStartIntegrationSpec extends UiSpec with TestHarness  {

  "BeforeYouStart Integration" should {

    "be presented" in new WebBrowser {
      go to BeforeYouStartPage

      assert(page.title equals BeforeYouStartPage.title)
    }

    "go to next page after the button is clicked" in new WebBrowser {
      go to BeforeYouStartPage

      click on startNow

      assert(page.title equals SetupTradeDetailsPage.title)
    }

    "remove redundant cookies when 'exit' button is clicked" in new WebBrowser {
      def cacheSetup()(implicit webDriver: WebDriver) =
        CookieFactoryForUISpecs.setupTradeDetailsIntegration().
          businessChooseYourAddressIntegration().
          dealerDetailsIntegration().
          vehicleDetailsModelIntegration().
          disposeFormModelIntegration().
          disposeTransactionIdIntegration().
          vehicleRegistrationNumberIntegration()

      go to BeforeYouStartPage
      cacheSetup()
      go to BeforeYouStartPage

      // Verify the cookies identified by the full set of cache keys have been removed
      RelatedCacheKeys.FullSet.foreach(cacheKey => assert(webDriver.manage().getCookieNamed(cacheKey) == null))
    }
  }
}
{'fraction_non_alphanumeric': 0.059266227657572904, 'fraction_numerical': 0.0, 'mean_word_length': 3.8480243161094223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '138876', 'n_tokens_mistral': 875, 'n_tokens_neox': 831, 'n_words': 217}