• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / pdc_discovery / 5af13607-7741-41ac-b110-c94c8a3ee0f0

pending completion
5af13607-7741-41ac-b110-c94c8a3ee0f0

Pull #441

circleci

hectorcorrea
Better error handling
Pull Request #441: Indexing to a new collection

99 of 99 new or added lines in 3 files covered. (100.0%)

1816 of 2220 relevant lines covered (81.8%)

95.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

36.84
/spec/system/search_results_page_spec.rb
1
# frozen_string_literal: true
2

3
describe 'Search Results Page', type: :system, js: true do
1✔
4
  before do
1✔
5
    Blacklight.default_index.connection.delete_by_query('*:*')
10✔
6
    Blacklight.default_index.connection.commit
10✔
7
    data = file_fixture('search_results_items.xml').read
10✔
8
    indexer = DspaceIndexer.new(data)
10✔
9
    indexer.index
10✔
10
    page.driver.browser.manage.window.resize_to(2000, 2000)
×
11
  end
12

13
  it "renders expected fields" do
1✔
14
    visit '/?search_field=all_fields&q='
×
15

16
    expect(page).to have_link('Midplane neutral density profiles in the National Spherical Torus Experiment', href: '/catalog/78348')
×
17
    expect(page).to have_content 'Stotler, D.; F. Scotti; R.E. Bell; A. Diallo' # authors
×
18
    expect(page).to have_content 'Atomic and molecular density data in the outer midplane of NSTX' # abstract
×
19
  end
20

21
  describe "title searches" do
1✔
22
    it "finds record by title" do
1✔
23
      # Notice that the search is successful even with a slight variation in terms (profile vs profiles)
24
      visit '/?search_field=title&q=profile'
×
25
      expect(page).to have_link('Midplane neutral density profiles in the National Spherical Torus Experiment', href: '/catalog/78348')
×
26
    end
27
    it "does not find non-existing titles" do
1✔
28
      visit '/?search_field=title&q=crofile'
×
29
      expect(page).to have_content('No results found')
×
30
    end
31
  end
32

33
  describe "author searches" do
1✔
34
    it "finds record by author" do
1✔
35
      visit '/?search_field=author&q=podesta'
×
36
      expect(page).to have_link('Midplane neutral density profiles in the National Spherical Torus Experiment', href: '/catalog/78348')
×
37
    end
38

39
    it "finds record by author synonym" do
1✔
40
      visit '/?search_field=author&q=dan'
×
41
      expect(page).to have_content("Author(s):\nTrueman, Daniel")
×
42
      expect(page).to have_link('bitKlavier Grand Sample Library—Piano Bar Mic Image', href: '/catalog/123476')
×
43
    end
44
  end
45

46
  describe "bookmarks" do
1✔
47
    it "does not render bookmark checkboxes" do
1✔
48
      visit '/?search_field=author&q=podesta'
×
49
      expect(page).not_to have_css "div.toggle-bookmark"
×
50
    end
51
  end
52

53
  # rubocop:disable RSpec/ExampleLength
54
  describe "facets" do
1✔
55
    it "shows expected facets" do
1✔
56
      visit '/?search_field=all_fields&q='
×
57
      domain_facet_html = '<div class="card facet-limit blacklight-domain_ssi ">'
×
58
      expect(page.html.include?(domain_facet_html)).to be true
×
59

60
      community_facet_html = '<div class="card facet-limit blacklight-community_root_name_ssi ">'
×
61
      expect(page.html.include?(community_facet_html)).to be true
×
62

63
      type_facet_html = '<div class="card facet-limit blacklight-genre_ssim ">'
×
64
      expect(page.html.include?(type_facet_html)).to be true
×
65

66
      year_facet_html = '<div class="card facet-limit blacklight-year_available_itsi ">'
×
67
      expect(page.html.include?(year_facet_html)).to be true
×
68

69
      # Collection facet is not rendered by defailt
70
      collection_facet_html = '<div class="card facet-limit blacklight-collection_name_ssi ">'
×
71
      expect(page.html.include?(collection_facet_html)).to be false
×
72
    end
73
    # rubocop:enable RSpec/ExampleLength
74

75
    it "shows collection facet for PPPL" do
1✔
76
      visit '/?f%5Bcommunity_root_name_ssi%5D%5B%5D=Princeton+Plasma+Physics+Laboratory'
×
77
      collection_facet_html = '<div class="card facet-limit blacklight-collection_name_ssi ">'
×
78
      expect(page.html.include?(collection_facet_html)).to be true
×
79
    end
80

81
    it "shows collection facet for Music and Arts" do
1✔
82
      visit '/?f%5Bcommunity_root_name_ssi%5D%5B%5D=Music+and+Arts'
×
83
      collection_facet_html = '<div class="card facet-limit blacklight-collection_name_ssi ">'
×
84
      expect(page.html.include?(collection_facet_html)).to be true
×
85
    end
86

87
    it "searches by the keyword facet even thought it is a hidden facet" do
1✔
88
      visit '/?f%5Bsubject_all_ssim%5D%5B%5D=Monte-Carlo+simulation'
×
89
      expect(page.html.include?("Keywords")).to be true
×
90
      expect(page.html.include?("Monte-Carlo simulation")).to be true
×
91
    end
92
  end
93
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc