mirror of
https://github.com/discourse/discourse.git
synced 2025-06-21 00:32:50 +08:00
DEV: Fix flaky system tests due to select kit (#31821)
The "Tag synonyms when visiting edit tag page allows an admin to create a new tag as synonym when tag does not exist" system test was flaky with the following error: ``` Failure/Error: super Capybara::ElementNotFound: Unable to find css "#add-synonyms.is-expanded" ``` Backtrace points to the following location: ``` ... ./spec/system/page_objects/components/select_kit.rb:30:in `expanded_component' ./spec/system/page_objects/components/select_kit.rb:88:in `search' ... ``` What I noticed is that `PageObjects::Components::SelectKit#expanded_component` has already found the expanded element when it calls `#expand`. Therefore, there is no need for us to search for it again.
This commit is contained in:

committed by
GitHub

parent
a91a03779d
commit
09bc857d42
@ -26,7 +26,7 @@ module PageObjects
|
|||||||
end
|
end
|
||||||
|
|
||||||
def expanded_component
|
def expanded_component
|
||||||
expand_if_needed
|
return expand if is_collapsed?
|
||||||
find(@context + ".is-expanded", wait: 5)
|
find(@context + ".is-expanded", wait: 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -99,10 +99,6 @@ module PageObjects
|
|||||||
def select_row_by_index(index)
|
def select_row_by_index(index)
|
||||||
expanded_component.find(".select-kit-row[data-index='#{index}']").click
|
expanded_component.find(".select-kit-row[data-index='#{index}']").click
|
||||||
end
|
end
|
||||||
|
|
||||||
def expand_if_needed
|
|
||||||
expand if is_collapsed?
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user