<commit_before>require "spec_helper"

describe "Dataset results", :reset => false do
  before :all do
    Capybara.reset_sessions!
    visit "/search"
    # scrolling in these specs doesn't work unless the window is resized
    page.driver.resize_window(1000, 1000)
  end

  after :each do
    page.execute_script "$('#dataset-results .master-overlay-content')[0].scrollTop = 0"
    fill_in "keywords", with: " "
  end

  let(:ast_l1a_id) { 'C14758250-LPDAAC_ECS' }
  let(:airh2ccf_id) { 'C186815383-GSFCS4PA' }

  it "displays the first 10 datasets when first visiting the page" do
    expect(page).to have_css('#dataset-results .panel-list-item', count: 20)
  end

  it "loads more results when the user scrolls to the bottom of the current list" do
    expect(page).to have_css('#dataset-results .panel-list-item', count: 20)
    page.execute_script "$('#dataset-results .master-overlay-content')[0].scrollTop = 10000"
    expect(page).to have_css('#dataset-results .panel-list-item', count: 40)
  end

  it "does not load additional results after all results have been loaded" do
    fill_in "keywords", with: "AST"
    expect(page).to have_css('#dataset-results .panel-list-item', count: 20)
    page.execute_script "$('#dataset-results .master-overlay-content')[0].scrollTop = 10000"
    expect(page).to have_css('#dataset-results .panel-list-item', count: 23)
    expect(page).to have_no_content('Loading datasets...')
  end

  it "displays thumbnails for datasets which have stored thumbnail URLs" do
    fill_in "keywords", with: airh2ccf_id

    expect(page).to have_css("img.panel-list-thumbnail")
    expect(page).to have_no_text("No image available")
  end
<commit_msg>Fix spec wording<commit_after>require "spec_helper"

describe "Dataset results", :reset => false do
  before :all do
    Capybara.reset_sessions!
    visit "/search"
    # scrolling in these specs doesn't work unless the window is resized
    page.driver.resize_window(1000, 1000)
  end

  after :each do
    page.execute_script "$('#dataset-results .master-overlay-content')[0].scrollTop = 0"
    fill_in "keywords", with: " "
  end

  let(:ast_l1a_id) { 'C14758250-LPDAAC_ECS' }
  let(:airh2ccf_id) { 'C186815383-GSFCS4PA' }

  it "displays the first 20 datasets when first visiting the page" do
    expect(page).to have_css('#dataset-results .panel-list-item', count: 20)
  end

  it "loads more results when the user scrolls to the bottom of the current list" do
    expect(page).to have_css('#dataset-results .panel-list-item', count: 20)
    page.execute_script "$('#dataset-results .master-overlay-content')[0].scrollTop = 10000"
    expect(page).to have_css('#dataset-results .panel-list-item', count: 40)
  end

  it "does not load additional results after all results have been loaded" do
    fill_in "keywords", with: "AST"
    expect(page).to have_css('#dataset-results .panel-list-item', count: 20)
    page.execute_script "$('#dataset-results .master-overlay-content')[0].scrollTop = 10000"
    expect(page).to have_css('#dataset-results .panel-list-item', count: 23)
    expect(page).to have_no_content('Loading datasets...')
  end

  it "displays thumbnails for datasets which have stored thumbnail URLs" do
    fill_in "keywords", with: airh2ccf_id

    expect(page).to have_css("img.panel-list-thumbnail")
    expect(page).to have_no_text("No image available")
  end

{'fraction_non_alphanumeric': 0.12652212652212652, 'fraction_numerical': 0.03267003267003267, 'mean_word_length': 4.141984732824428, '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': '1994264', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1074, 'n_words': 300}