mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
DEV: Fix admin confirmation flaky spec (#29456)
This commit is contained in:
@ -26,8 +26,7 @@ describe "Admin Site Setting Requires Confirmation", type: :system do
|
|||||||
)
|
)
|
||||||
dialog.click_yes
|
dialog.click_yes
|
||||||
expect(dialog).to be_closed
|
expect(dialog).to be_closed
|
||||||
expect(settings_page).to have_overridden_setting("min_password_length")
|
expect(settings_page).to have_overridden_setting("min_password_length", value: 12)
|
||||||
expect(SiteSetting.min_password_length).to eq(12)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not save the new setting value if the admin cancels confirmation" do
|
it "does not save the new setting value if the admin cancels confirmation" do
|
||||||
@ -36,6 +35,6 @@ describe "Admin Site Setting Requires Confirmation", type: :system do
|
|||||||
expect(dialog).to be_open
|
expect(dialog).to be_open
|
||||||
dialog.click_no
|
dialog.click_no
|
||||||
expect(dialog).to be_closed
|
expect(dialog).to be_closed
|
||||||
expect(SiteSetting.min_password_length).to eq(10)
|
expect(settings_page).to have_no_overridden_setting("min_password_length")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -59,8 +59,14 @@ module PageObjects
|
|||||||
setting_element.find(".setting-controls button.ok").click
|
setting_element.find(".setting-controls button.ok").click
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_overridden_setting?(setting_name)
|
def has_overridden_setting?(setting_name, value: nil)
|
||||||
find_setting(setting_name, overridden: true)
|
setting_field = find_setting(setting_name, overridden: true)
|
||||||
|
return setting_field.find(".setting-value input").value == value.to_s if value
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
def has_no_overridden_setting?(setting_name)
|
||||||
|
find_setting(setting_name, overridden: false)
|
||||||
end
|
end
|
||||||
|
|
||||||
def values_in_list(setting_name)
|
def values_in_list(setting_name)
|
||||||
|
Reference in New Issue
Block a user