mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
DEV: Add system test for soft loading topic search results (#25525)
Follow up to: https://github.com/discourse/discourse/pull/25504
This commit is contained in:
parent
6791eb1a94
commit
bf02657dbf
@ -8,6 +8,15 @@ module PageObjects
|
||||
self
|
||||
end
|
||||
|
||||
def type_in_search_menu(input)
|
||||
find("input#search-term").send_keys(input)
|
||||
self
|
||||
end
|
||||
|
||||
def click_search_menu_link
|
||||
find(".search-menu .results .search-link").click
|
||||
end
|
||||
|
||||
def clear_search_input
|
||||
find("input.full-page-search").set("")
|
||||
self
|
||||
@ -29,8 +38,16 @@ module PageObjects
|
||||
find(".d-header #search-button").click
|
||||
end
|
||||
|
||||
def click_first_topic
|
||||
find(".topic-list-body tr:first-of-type").click
|
||||
end
|
||||
|
||||
SEARCH_RESULT_SELECTOR = ".search-results .fps-result"
|
||||
|
||||
def has_topic_title_for_first_search_result?(title)
|
||||
page.has_css?(".search-menu .results .search-result-topic", text: title)
|
||||
end
|
||||
|
||||
def has_search_result?
|
||||
page.has_selector?(SEARCH_RESULT_SELECTOR)
|
||||
end
|
||||
|
@ -85,4 +85,26 @@ describe "Search", type: :system do
|
||||
expect(search_page).to have_warning_message
|
||||
end
|
||||
end
|
||||
|
||||
describe "when search menu on desktop" do
|
||||
before do
|
||||
SearchIndexer.enable
|
||||
SearchIndexer.index(topic, force: true)
|
||||
SearchIndexer.index(topic2, force: true)
|
||||
end
|
||||
|
||||
after { SearchIndexer.disable }
|
||||
|
||||
it "still displays last topic search results after navigating away, then back" do
|
||||
visit("/")
|
||||
search_page.click_search_icon
|
||||
search_page.type_in_search_menu("test")
|
||||
search_page.click_search_menu_link
|
||||
expect(search_page).to have_topic_title_for_first_search_result(topic.title)
|
||||
|
||||
search_page.click_first_topic
|
||||
search_page.click_search_icon
|
||||
expect(search_page).to have_topic_title_for_first_search_result(topic.title)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user