A platform for community discussion. Free, open, simple.
DEV: correct flaky interface selector spec (#36823)
Sam881d84f49b92
diff --git a/spec/system/page_objects/components/interface_color_selector.rb b/spec/system/page_objects/components/interface_color_selector.rbindex b987026e197..b87773e3608 100644--- a/spec/system/page_objects/components/interface_color_selector.rb+++ b/spec/system/page_objects/components/interface_color_selector.rb@@ -6,33 +6,40 @@ module PageObjectsattr_reader :container_selectorSELECTOR = ".interface-color-selector"+ TRIGGER_SELECTOR = ".interface-color-selector-trigger"+ CONTENT_SELECTOR = ".interface-color-selector-content"def initialize(container_selector)@container_selector = container_selectorenddef available?- find(container_selector).has_css?(SELECTOR)+ find(container_selector).has_css?(TRIGGER_SELECTOR)enddef not_available?- find(container_selector).has_no_css?(SELECTOR)+ find(container_selector).has_no_css?(TRIGGER_SELECTOR)enddef expand- find(container_selector).find(SELECTOR).click+ # Ensure the menu is closed before we try to expand it.+ # This prevents flakiness if the menu is still closing from a previous action.+ page.has_no_css?(CONTENT_SELECTOR)++ find(container_selector).find(TRIGGER_SELECTOR).click+ find(CONTENT_SELECTOR)enddef has_light_as_current_mode?- has_css?(SELECTOR + "[data-current-mode='light']")+ has_css?(TRIGGER_SELECTOR + "[data-current-mode='light']")enddef has_dark_as_current_mode?- has_css?(SELECTOR + "[data-current-mode='dark']")+ has_css?(TRIGGER_SELECTOR + "[data-current-mode='dark']")enddef has_auto_as_current_mode?- has_css?(SELECTOR + "[data-current-mode='auto']")+ has_css?(TRIGGER_SELECTOR + "[data-current-mode='auto']")enddef light_option