mirror of
https://github.com/discourse/discourse.git
synced 2025-10-03 17:21:20 +08:00
DEV: Resolve flaky chat preferences spec (#34978)
This commit is contained in:
parent
2c84945853
commit
667f525292
2 changed files with 12 additions and 5 deletions
|
@ -31,11 +31,10 @@ module PageObjects
|
|||
end
|
||||
|
||||
def save_changes_and_refresh
|
||||
page.find(".save-changes").click
|
||||
# reloading the page happens in JS on save but capybara doesnt wait for it
|
||||
# which can mess up navigating away too soon in tests
|
||||
# so doing a manual refresh here to mimic
|
||||
page.refresh
|
||||
button_element = page.find(".save-changes")
|
||||
button_element.click
|
||||
|
||||
wait_until_hidden(button_element)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -357,4 +357,12 @@ module SystemHelpers
|
|||
def wait_for_timeout(ms = 100)
|
||||
page.driver.with_playwright_page { |pw_page| pw_page.wait_for_timeout(ms) }
|
||||
end
|
||||
|
||||
def wait_until_hidden(element)
|
||||
element.with_playwright_element_handle do |playwright_element|
|
||||
playwright_element.wait_for_element_state("hidden")
|
||||
rescue Playwright::Error => e
|
||||
raise e unless e.message.match?(/Element is not attached to the DOM/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue