discourse/spec/system/page_objects/pages/header.rb
Martin Brennan 832ed8ce74
UX: Fix various search shortcut UX issues (#31903)
Now we have the search input showing in a few
different configurations:

* Welcome banner
* Header field
* Header icon

And we can get to the search with both `/` and
`Ctrl+F` shortcuts. These configurations can
be used together, and we need to focus on the right
search input at the right time.

This commit fixes the shortcuts not working
or showing the wrong thing in some cases,
and adds a comprehensive system spec for all
the variants.
2025-03-21 09:20:58 +10:00

25 lines
648 B
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class Header < PageObjects::Pages::Base
def get_computed_style_value(selector, property)
page.evaluate_script(
"window.getComputedStyle(document.querySelector('#{selector}')).getPropertyValue('#{property}')",
).strip
end
def resize_element(selector, size)
page.evaluate_script("document.querySelector('#{selector}').style.height = '#{size}px'")
end
def active_element_id
current_active_element[:id]
end
def click_outside
find(".d-modal").click(x: 0, y: 0)
end
end
end
end