discourse/spec/system/page_objects/pages/discovery.rb
Joffrey JAFFEUX 9392bd0f79
DEV: fix tag synonyms flakey specs (#21787)
The fix use the SelectKit component in the spec and improves reliability of SelectKit component to ensure expanded/collapsed state effectively set/present.

Multiple lines have also been removed as they are not necessary, eg: 

- check button is present
- click button

The check is un-necesssary as we won't find the button on click if not present. This kind of checks are only necessary when another element has to be present before the button is show, eg:

- check modal is displayed
- click button

FInally this commit changes the way the SelectKit component initializes component and now uses a css selector instead of a finder, it ensures we are always getting fresh object and allows to build complete selectors: ".context[data-id=1].foo:enabled"
2023-05-28 15:35:55 +02:00

24 lines
547 B
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class Discovery < PageObjects::Pages::Base
def topic_list
Components::TopicList.new
end
def category_drop
Components::SelectKit.new(".category-breadcrumb li:first-of-type .category-drop")
end
def subcategory_drop
Components::SelectKit.new(".category-breadcrumb li:nth-of-type(2) .category-drop")
end
def tag_drop
Components::SelectKit.new(".category-breadcrumb .tag-drop")
end
end
end
end