<commit_before>require File.join(File.dirname(__FILE__), 'spec_helper')

adminlogin = WEBPATH['admin']['login']
adminpassword = WEBPATH['<PASSWORD>']['password']

describe "logging in" do
  it "logs in" do
    login(adminlogin, adminpassword)
    current_route.should == "/"
  end

  it "logs the user out after two hours" do
    login(adminlogin, adminpassword)
    create_valid_workspace(:name => "FooWorkspace")
    Timecop.travel(Time.current + 3.hours) do
      click_link "Home"
      wait_for_ajax
      wait_until { current_route == "/login" }
      login(adminlogin, adminpassword)
      click_link("FooWorkspace")
      Timecop.travel(Time.current + 6.hours) do
        wait_for_ajax
        wait_until { current_route == "/login" }
      end
    end<commit_msg>Making login specs a little bit more robust [#33145597]<commit_after>require File.join(File.dirname(__FILE__), 'spec_helper')

adminlogin = WEBPATH['admin']['login']
adminpassword = WEBPATH['<PASSWORD>']['password']

describe "logging in" do
  it "logs in" do
    login(adminlogin, adminpassword)
    current_route.should == "/"
  end

  it "logs the user out after two hours" do
    login(adminlogin, adminpassword)
    create_valid_workspace(:name => "FooWorkspace")

    Timecop.travel(Time.current + 3.hours) do
      # Sometimes an AJAX may trigger the redirection before
      # and thus the link does not exist
      page.has_css?("a:contains('Home')") && click_link("Home")

      wait_until { current_route == "/login" }
      login(adminlogin, adminpassword)

      click_link("FooWorkspace")

      Timecop.travel(Time.current + 6.hours) do
        # Sometimes an AJAX may trigger the redirection before
        # and thus the link does not exist
        page.has_css?("a:contains('Home')") && click_link("Home")

        wait_until { current_route == "/login" }
      end
    end
{'fraction_non_alphanumeric': 0.11969940955448202, 'fraction_numerical': 0.00644122383252818, 'mean_word_length': 3.546341463414634, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5199741', 'n_tokens_mistral': 591, 'n_tokens_neox': 560, 'n_words': 143}