<commit_before>module SessionInitializer
  def self.init(team_name, email, password, channel)
    Capybara.default_max_wait_time = 20

    Capybara.register_driver :chrome do |app|
      Capybara::Selenium::Driver.new(app, browser: :chrome)
      # Capybara::Selenium::Driver.new(app, browser: :chrome, switches: ['--incognito'])
    end
    Capybara.default_driver = :chrome
    Capybara.javascript_driver = :chrome

    session = Capybara::Session.new(:chrome)

    session.visit "https://#{team_name}.slack.com/messages/#{channel}/"

    if session.first('strong', text: /^email address$/) && session.first('strong', text: /^password$/)
      session.fill_in 'email', with: email
      session.fill_in 'password', with: password
      session.find('#signin_btn').click
    else
      session.click_on 'Sign in with Google'
      session.fill_in 'Email', with: email
      session.click_on 'Next'
      session.fill_in 'Password', with: password
      session.click_on 'Sign in'
    end
    session
  end
end<commit_msg>Having to call visit again to make sure we go to the right URL.<commit_after>module SessionInitializer
  def self.init(team_name, email, password, channel)
    Capybara.default_max_wait_time = 20

    Capybara.register_driver :chrome do |app|
      Capybara::Selenium::Driver.new(app, browser: :chrome)
      # Capybara::Selenium::Driver.new(app, browser: :chrome, switches: ['--incognito'])
    end
    Capybara.default_driver = :chrome
    Capybara.javascript_driver = :chrome

    session = Capybara::Session.new(:chrome)

    session.visit "https://#{team_name}.slack.com/messages/#{channel}/"

    if session.first('strong', text: /^email address$/) && session.first('strong', text: /^password$/)
      session.fill_in 'email', with: email
      session.fill_in 'password', with: password
      session.find('#signin_btn').click
    else
      session.click_on 'Sign in with Google'
      session.fill_in 'Email', with: email
      session.click_on 'Next'
      session.fill_in 'Password', with: password
      session.click_on 'Sign in'
    end

    session.assert_selector '#channels'
    # Just incase we were not directed to the right channel :/
    session.visit "https://#{team_name}.slack.com/messages/#{channel}/"

    session
  end
end
{'fraction_non_alphanumeric': 0.12901805372082784, 'fraction_numerical': 0.0017613386173491853, 'mean_word_length': 3.5898989898989897, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, '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': '3919687', 'n_tokens_mistral': 717, 'n_tokens_neox': 702, 'n_words': 166}