DEV: Fix flaky admin confirmation spec (#27784)

Waiting for the dialog to close was not enough,
need to wait for the overridden indicator to
show on the site setting.
This commit is contained in:
Martin Brennan 2024-07-09 12:05:31 +10:00 committed by GitHub
parent c0ac15575f
commit 7111d5e4bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -26,6 +26,7 @@ describe "Admin Site Setting Requires Confirmation", type: :system do
)
dialog.click_yes
expect(dialog).to be_closed
expect(settings_page).to have_overridden_setting("min_password_length")
expect(SiteSetting.min_password_length).to eq(12)
end

View File

@ -22,8 +22,10 @@ module PageObjects
self
end
def find_setting(setting_name)
find(".admin-detail .row.setting[data-setting='#{setting_name}']")
def find_setting(setting_name, overridden: false)
find(
".admin-detail .row.setting[data-setting='#{setting_name}']#{overridden ? ".overridden" : ""}",
)
end
def toggle_setting(setting_name, text = "")
@ -49,6 +51,10 @@ module PageObjects
setting_element.find(".setting-controls button.ok").click
end
def has_overridden_setting?(setting_name)
find_setting(setting_name, overridden: true)
end
def values_in_list(setting_name)
vals = []
setting = find(".admin-detail .row.setting[data-setting='#{setting_name}']")