attempt to fix flickering search spec

rspec ./spec/features/search/search_spec.rb:307

the search for the first work package, having 1 in the subject, led to all 1x work packages being found.
This commit is contained in:
ulferts
2026-06-05 22:44:54 +02:00
parent 6885ca695d
commit 19468b6b68
+9 -4
View File
@@ -33,12 +33,18 @@ require "spec_helper"
RSpec.describe "Search", :js, :selenium, with_settings: { per_page_options: "5" } do
include Components::Autocompleter::NgSelectAutocompleteHelpers
create_shared_association_defaults_for_work_package_factory
def char_for(integer)
("a".ord + integer - 1).chr * 5
end
shared_let(:admin) { create(:admin) }
shared_let(:project) { create(:project) }
shared_let(:work_packages) do
(1..22).map do |n|
Timecop.freeze("2016-11-21 #{n}:00".to_datetime) do
subject = "Subject No. #{n} WP"
subject = "Subject #{char_for(n)} WP"
create(:work_package,
subject:,
project:)
@@ -90,7 +96,7 @@ RSpec.describe "Search", :js, :selenium, with_settings: { per_page_options: "5"
def expect_range(param_a, param_b)
(param_a..param_b).each do |n|
expect(page).to have_content("No. #{n} WP")
expect(page).to have_text("Subject #{char_for(n)} WP")
expect(page).to have_css("a[href*='#{work_package_path(work_packages[n - 1].id)}']")
end
end
@@ -452,11 +458,10 @@ RSpec.describe "Search", :js, :selenium, with_settings: { per_page_options: "5"
global_search.open_tab "All"
expect(page)
.to have_content attachment_text
.to have_text attachment_text
expect(page)
.to have_css(".search-highlight", text: query)
end
end
end