<commit_before>require 'feature_helper'
require 'api_test_helper'
require 'cookie_names'

RSpec.describe 'When the user visits the start page with a variant cookie' do
  context 'on LOA2' do
    it 'will display the control start page for LOA2 in English' do
      set_session_and_ab_session_cookies!('loa1_shortened_journey_v3' => 'loa1_shortened_journey_v3_variant')
      visit '/start'
      expect(page).to have_content 'Sign in with GOV.UK Verify'
      expect(page).to have_css 'html[lang=en]'
      expect_feedback_source_to_be(page, 'START_PAGE', '/start')
    end
  end
  context 'on LOA1' do
    before(:each) do
      set_session_and_ab_session_cookies!('loa1_shortened_journey_v3' => 'loa1_shortened_journey_v3_variant')
      set_loa_in_session('LEVEL_1')
    end

    it 'will display the variant start page for LOA1 in English' do
      visit '/start'
      expect(page).to have_content 'Create an identity account'
      expect(page).to have_css 'html[lang=en]'
      expect_feedback_source_to_be(page, 'START_PAGE', '/start')
    end

    it 'will redirect to IPD picker when selecting Create an identity account' do
      stub_api_idp_list
      visit '/start'
      expect(page).to have_content 'Create an identity account'
      click_link 'Create an identity account'
      expect(page).to have_current_path('/choose-a-certified-company')
      expect_feedback_source_to_be(page, 'CHOOSE_A_CERTIFIED_COMPANY_PAGE', '/choose-a-certified-company')
    end

    it 'on LOA1 will redirect to sign in page when selecting sign in' do
      stub_api_idp_list
      visit '/start'
      expect(page).to have_content 'Create an identity account'
      click_link 'sign in'
      expect(page).to have_current_path('/sign-in')
      expect_feedback_source_to_be(page, 'SIGN_IN_PAGE', '/sign-in')
    end
  end

  context 'when there is an error' do<commit_msg>TT-1615: Fixed typo in the test name<commit_after>require 'feature_helper'
require 'api_test_helper'
require 'cookie_names'

RSpec.describe 'When the user visits the start page with a variant cookie' do
  context 'on LOA2' do
    it 'will display the control start page for LOA2 in English' do
      set_session_and_ab_session_cookies!('loa1_shortened_journey_v3' => 'loa1_shortened_journey_v3_variant')
      visit '/start'
      expect(page).to have_content 'Sign in with GOV.UK Verify'
      expect(page).to have_css 'html[lang=en]'
      expect_feedback_source_to_be(page, 'START_PAGE', '/start')
    end
  end
  context 'on LOA1' do
    before(:each) do
      set_session_and_ab_session_cookies!('loa1_shortened_journey_v3' => 'loa1_shortened_journey_v3_variant')
      set_loa_in_session('LEVEL_1')
    end

    it 'will display the variant start page for LOA1 in English' do
      visit '/start'
      expect(page).to have_content 'Create an identity account'
      expect(page).to have_css 'html[lang=en]'
      expect_feedback_source_to_be(page, 'START_PAGE', '/start')
    end

    it 'will redirect to IDP picker when selecting Create an identity account' do
      stub_api_idp_list
      visit '/start'
      expect(page).to have_content 'Create an identity account'
      click_link 'Create an identity account'
      expect(page).to have_current_path('/choose-a-certified-company')
      expect_feedback_source_to_be(page, 'CHOOSE_A_CERTIFIED_COMPANY_PAGE', '/choose-a-certified-company')
    end

    it 'on LOA1 will redirect to sign in page when selecting sign in' do
      stub_api_idp_list
      visit '/start'
      expect(page).to have_content 'Create an identity account'
      click_link 'sign in'
      expect(page).to have_current_path('/sign-in')
      expect_feedback_source_to_be(page, 'SIGN_IN_PAGE', '/sign-in')
    end
  end

  context 'when there is an error' do
{'fraction_non_alphanumeric': 0.08764940239043825, 'fraction_numerical': 0.00849933598937583, 'mean_word_length': 3.8282051282051284, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6957903', 'n_tokens_mistral': 1257, 'n_tokens_neox': 1233, 'n_words': 333}