<commit_before>require 'erubis'
require 'uri'
require 'net/http'
require 'json'
require 'w3c_validators'

include W3CValidators

def login_if_webseal_present
  if $TEST_ENVIRONMENT_WEBSEAL == 'integration' then
    if content.find('You are already logged in') then
      click('Terminate existing login')
    end
    fill_in 'username', with: $WEBSEAL_LOGIN
    fill_in 'password', with: <PASSWORD>
    click_button('Sign In')
  end
end

def content
  page.body.text
end

def insert_unverified_title(title_number = 'AGL1013')
  @title = {
    title_number: title_number
  }
  process_title_template(@title, false, 'unverified_title_template')
end

def insert_title_with_owners(number_proprietors = 1, closure_status = 'OPEN', wait_for_updater = true)
  @title = create_title_hash(random_title_number, closure_status)
  @title[:proprietors] = create_non_private_proprietors(number_proprietors)
  process_title_template(@title, wait_for_updater)
  make_title_searchable
end

def insert_title_with_district(number_proprietors = 1, closure_status = 'OPEN', wait_for_updater = true, district)<commit_msg>Revert "Revert "Amend find function in login script""<commit_after>require 'erubis'
require 'uri'
require 'net/http'
require 'json'
require 'w3c_validators'

include W3CValidators

def login_if_webseal_present
  if $TEST_ENVIRONMENT_WEBSEAL == 'integration' then
    if content.has_text?('You are already logged in') then
      click('Terminate existing login')
    end
    fill_in 'username', with: $WEBSEAL_LOGIN
    fill_in 'password', with: <PASSWORD>
    click_button('Sign In')
  end
end

def content
  page.body.text
end

def insert_unverified_title(title_number = 'AGL1013')
  @title = {
    title_number: title_number
  }
  process_title_template(@title, false, 'unverified_title_template')
end

def insert_title_with_owners(number_proprietors = 1, closure_status = 'OPEN', wait_for_updater = true)
  @title = create_title_hash(random_title_number, closure_status)
  @title[:proprietors] = create_non_private_proprietors(number_proprietors)
  process_title_template(@title, wait_for_updater)
  make_title_searchable
end

def insert_title_with_district(number_proprietors = 1, closure_status = 'OPEN', wait_for_updater = true, district)
{'fraction_non_alphanumeric': 0.08872046366473473, 'fraction_numerical': 0.007133303611234953, 'mean_word_length': 6.2387096774193544, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7460631', 'n_tokens_mistral': 779, 'n_tokens_neox': 781, 'n_words': 164}