11require 'test_helper'
22
33class SearchControllerTest < ActionDispatch ::IntegrationTest
4- def setup
5- @test_strategy = Flipflop ::FeatureSet . current . test!
6- @test_strategy . switch! ( :gdt , false )
7- end
8-
94 def mock_primo_search_success
105 # Mock the Primo search components to avoid external API calls
116 sample_doc = {
@@ -80,14 +75,12 @@ def mock_timdex_search_success
8075 end
8176
8277 test 'index shows advanced search form with URL parameter' do
83- if Flipflop . enabled? ( :gdt )
84- get '/?advanced=true'
85- assert_response :success
86- details_div = assert_select ( 'details#advanced-search-panel' )
87- assert details_div . attribute ( 'open' )
88- else
89- skip ( 'Advanced search functionality not implemented in USE UI' )
90- end
78+ skip ( 'Advanced search functionality not implemented in USE UI' )
79+
80+ get '/?advanced=true'
81+ assert_response :success
82+ details_div = assert_select ( 'details#advanced-search-panel' )
83+ assert details_div . attribute ( 'open' )
9184 end
9285
9386 test 'index shows basic search form when GDT is disabled' do
@@ -104,17 +97,14 @@ def mock_timdex_search_success
10497 end
10598
10699 test 'advanced search form appears on results page with URL parameter' do
107- if Flipflop . enabled? ( :gdt )
108- VCR . use_cassette ( 'advanced' ,
109- allow_playback_repeats : true ,
110- match_requests_on : %i[ method uri body ] ) do
111- get '/results?advanced=true'
112- assert_response :success
113- details_div = assert_select ( 'details#advanced-search-panel' )
114- assert details_div . attribute ( 'open' )
115- end
116- else
117- skip ( 'Advanced search functionality not implemented in USE UI' )
100+ skip ( 'Advanced search functionality not implemented in USE UI' )
101+ VCR . use_cassette ( 'advanced' ,
102+ allow_playback_repeats : true ,
103+ match_requests_on : %i[ method uri body ] ) do
104+ get '/results?advanced=true'
105+ assert_response :success
106+ details_div = assert_select ( 'details#advanced-search-panel' )
107+ assert details_div . attribute ( 'open' )
118108 end
119109 end
120110
@@ -123,20 +113,6 @@ def mock_timdex_search_success
123113
124114 # Basic search field should always be present
125115 assert_select 'input#basic-search-main' , { count : 1 }
126-
127- if Flipflop . enabled? ( :gdt )
128- # Please note that this test confirms fields in the DOM - but not whether
129- # they are visible. Fields in a hidden details panel are still in the DOM,
130- # but not visible or reachable via keyboard interaction.
131- assert_select 'input#advanced-citation' , { count : 1 }
132- assert_select 'input#advanced-contributors' , { count : 1 }
133- assert_select 'input#advanced-fundingInformation' , { count : 1 }
134- assert_select 'input#advanced-identifiers' , { count : 1 }
135- assert_select 'input#advanced-locations' , { count : 1 }
136- assert_select 'input#advanced-subjects' , { count : 1 }
137- assert_select 'input#advanced-title' , { count : 1 }
138- assert_select 'input.source' , { minimum : 3 }
139- end
140116 end
141117
142118 test 'advanced search source checkboxes can be controlled by env' do
0 commit comments