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

pulibrary / pdc_discovery / b3ff4e78-d88d-4913-960f-dcc0d9e55d1f

10 Oct 2023 04:33PM UTC coverage: 94.075% (-2.9%) from 96.965%
b3ff4e78-d88d-4913-960f-dcc0d9e55d1f

push

circleci

jrgriffiniii
wip

2604 of 2768 relevant lines covered (94.08%)

178.97 hits per line

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

81.82
/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)
10✔
11
  end
12

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

16
    expect(page).to have_link('Midplane neutral density profiles in the National Spherical Torus Experiment', href: '/catalog/78348')
1✔
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'
1✔
25
      expect(page).to have_link('Midplane neutral density profiles in the National Spherical Torus Experiment', href: '/catalog/78348')
1✔
26
    end
27
    it "does not find non-existing titles" do
1✔
28
      visit '/?search_field=title&q=crofile'
1✔
29
      expect(page).to have_content('No results found')
1✔
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'
1✔
36
      expect(page).to have_link('Midplane neutral density profiles in the National Spherical Torus Experiment', href: '/catalog/78348')
1✔
37
    end
38

39
    it "finds record by author synonym" do
1✔
40
      visit '/?search_field=author&q=dan'
1✔
41
      expect(page).to have_content("Author(s):\nTrueman, Daniel")
1✔
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'
1✔
49
      expect(page).not_to have_css "div.toggle-bookmark"
1✔
50
    end
51
  end
52

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

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

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

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

69
    it "shows collection facet for PPPL" do
1✔
70
      visit '/?f%5Bcommunities_ssim%5D%5B%5D=Princeton+Plasma+Physics+Laboratory'
1✔
71
      collection_facet_html = '<div class="card facet-limit blacklight-collection_tag_ssim ">'
1✔
72
      expect(page.html.include?(collection_facet_html)).to be true
1✔
73
    end
74

75
    it "shows collection facet for Music and Arts" do
1✔
76
      visit '/?f%5Bcommunities_ssim%5D%5B%5D=Music+and+Arts'
1✔
77
      collection_facet_html = '<div class="card facet-limit blacklight-collection_tag_ssim ">'
1✔
78
      expect(page.html.include?(collection_facet_html)).to be true
1✔
79
    end
80

81
    it "searches by the keyword facet even thought it is a hidden facet" do
1✔
82
      visit '/?f%5Bsubject_all_ssim%5D%5B%5D=Monte-Carlo+simulation'
1✔
83
      expect(page.html.include?("Keywords")).to be true
1✔
84
      expect(page.html.include?("Monte-Carlo simulation")).to be true
×
85
    end
86
  end
87
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