Skip to content

A platform for community discussion. Free, open, simple.

FIX: rely on capybara waiters (#32789)

Joffrey JAFFEUXae074f0c9084
diff --git a/spec/system/search_shortcut_variation_spec.rb b/spec/system/search_shortcut_variation_spec.rb
index 1b5bb827821..785bb542c8b 100644
--- a/spec/system/search_shortcut_variation_spec.rb
+++ b/spec/system/search_shortcut_variation_spec.rb
@@ -19,7 +19,7 @@ describe "Search | Shortcuts for variations of search input", type: :system do
expect(welcome_banner).to be_visible
page.send_keys("/")
expect(search_page).to have_search_menu
- expect(current_active_element[:id]).to eq("welcome-banner-search-input")
+ expect(page).to have_css("#welcome-banner-search-input:focus")
page.send_keys(:escape)
expect(search_page).to have_no_search_menu_visible
end
@@ -34,7 +34,7 @@ describe "Search | Shortcuts for variations of search input", type: :system do
expect(welcome_banner).to be_invisible
page.send_keys("/")
expect(search_page).to have_search_menu
- expect(current_active_element[:id]).to eq("header-search-input")
+ expect(page).to have_css("#header-search-input:focus")
page.send_keys(:escape)
expect(search_page).to have_no_search_menu_visible
end
@@ -49,7 +49,7 @@ describe "Search | Shortcuts for variations of search input", type: :system do
expect(welcome_banner).to be_hidden
page.send_keys("/")
expect(search_page).to have_search_menu
- expect(current_active_element[:id]).to eq("header-search-input")
+ expect(page).to have_css("#header-search-input:focus")
page.send_keys(:escape)
expect(search_page).to have_no_search_menu_visible
end
@@ -67,7 +67,7 @@ describe "Search | Shortcuts for variations of search input", type: :system do
expect(welcome_banner).to be_visible
page.send_keys("/")
expect(search_page).to have_search_menu
- expect(current_active_element[:id]).to eq("welcome-banner-search-input")
+ expect(page).to have_css("#welcome-banner-search-input:focus")
page.send_keys(:escape)
expect(search_page).to have_no_search_menu_visible
end
@@ -82,7 +82,7 @@ describe "Search | Shortcuts for variations of search input", type: :system do
expect(welcome_banner).to be_invisible
page.send_keys("/")
expect(search_page).to have_search_menu
- expect(current_active_element[:id]).to eq("icon-search-input")
+ expect(page).to have_css("#icon-search-input:focus")
page.send_keys(:escape)
expect(search_page).to have_no_search_menu_visible
end
@@ -97,7 +97,7 @@ describe "Search | Shortcuts for variations of search input", type: :system do
expect(welcome_banner).to be_hidden
page.send_keys("/")
expect(search_page).to have_search_menu
- expect(current_active_element[:id]).to eq("icon-search-input")
+ expect(page).to have_css("#icon-search-input:focus")
page.send_keys(:escape)
expect(search_page).to have_no_search_menu_visible
end
@@ -112,7 +112,7 @@ describe "Search | Shortcuts for variations of search input", type: :system do
visit "/t/#{topic.slug}/#{topic.id}"
page.send_keys("/")
expect(search_page).to have_search_menu
- expect(current_active_element[:id]).to eq("icon-search-input")
+ expect(page).to have_css("#icon-search-input:focus")
page.send_keys(:escape)
expect(search_page).to have_no_search_menu_visible
end