From f2e23ecdfb71f5fa53e38c9c69d7055c357c15d5 Mon Sep 17 00:00:00 2001 From: Lukas Krause Date: Tue, 17 Dec 2024 21:22:46 +0100 Subject: [PATCH] Adapt `requests_index_spec` to cover creators filter --- .../beta/webui/requests_index_spec.rb | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/api/spec/features/beta/webui/requests_index_spec.rb b/src/api/spec/features/beta/webui/requests_index_spec.rb index 4648479ba58..ae9f67678d6 100644 --- a/src/api/spec/features/beta/webui/requests_index_spec.rb +++ b/src/api/spec/features/beta/webui/requests_index_spec.rb @@ -113,36 +113,35 @@ # rubocop:enable RSpec/ExampleLength end - describe 'using the request creator filter', skip: 'Temporarily disable list of creators due to performance issues' do + describe 'using the request creator filter' do before do find_by_id('requests-dropdown-trigger').click if mobile? # open the filter dropdown - find_by_id('filter-creator-requests-button').click + fill_in('creators_search', with: receiver.login[0, 2]) + find('.ui-menu-item-wrapper', match: :first).click + # Remove focus from autocomplete search to allow the autosubmit + find('label[for="creators_search"]').click + sleep 2 + + fill_in('creators_search', with: another_submitter.login[0, 2]) + find('.ui-menu-item-wrapper', match: :first).click + # Remove focus from autocomplete search to allow the autosubmit + find('label[for="creators_search"]').click + sleep 2 end - it 'lists only the requests of the selected creator' do - check("creators[#{receiver.login}]") - + it 'filters the requests by multiple creators' do expect(page).to have_link(href: "/request/show/#{outgoing_request.number}") + expect(page).to have_link(href: "/request/show/#{other_incoming_request.number}") expect(page).to have_no_link(href: "/request/show/#{incoming_request.number}") - expect(page).to have_no_link(href: "/request/show/#{other_incoming_request.number}") end - it 'allows to filter by multiple request creators' do - check("creators[#{receiver.login}]") - check("creators[#{another_submitter.login}]") + it 'allows to modify the filter selection' do + uncheck("creators[#{receiver.login}]") + sleep 2 - expect(page).to have_link(href: "/request/show/#{outgoing_request.number}") + expect(page).to have_no_link(href: "/request/show/#{outgoing_request.number}") expect(page).to have_link(href: "/request/show/#{other_incoming_request.number}") expect(page).to have_no_link(href: "/request/show/#{incoming_request.number}") end - - it 'only shows the creators that match the search value filled in the dropdown' do - fill_in('request-creator-search', with: submitter.login[0, 2].to_s) - - within('div#request-creator-dropdown') do - expect(page).to have_field('creators[]', with: submitter.login.to_s) - expect(page).to have_no_field('creators[]', with: receiver.login.to_s) - end - end end end