diff --git a/spec/system/page_objects/components/select_kit.rb b/spec/system/page_objects/components/select_kit.rb index aeafd85406d..19f6842b919 100644 --- a/spec/system/page_objects/components/select_kit.rb +++ b/spec/system/page_objects/components/select_kit.rb @@ -39,7 +39,7 @@ module PageObjects end def expand - collapsed_component.find(":not(.is-expanded) .select-kit-header").click + collapsed_component.find(":not(.is-expanded) .select-kit-header", visible: :all).click expanded_component end diff --git a/spec/system/user_preferences_interface_spec.rb b/spec/system/user_preferences_interface_spec.rb index 859c3b8cb6a..ef5317aecf9 100644 --- a/spec/system/user_preferences_interface_spec.rb +++ b/spec/system/user_preferences_interface_spec.rb @@ -9,32 +9,26 @@ describe "User preferences for Interface", type: :system, js: true do describe "Bookmarks" do it "changes the bookmark after notification preference" do - skip(<<~TEXT) if ENV["CI"] - This is currently failing on CI with the following: + user_preferences_page.visit(user) + click_link(I18n.t("js.user.preferences_nav.interface")) - ``` - Failure/Error: expect(page).to have_content(I18n.t("js.saved")) - expected `#.has_content?("Saved!")` to be truthy, got false - ``` - TEXT - - user_preferences_page.visit(user).click_interface_tab + dropdown = PageObjects::Components::SelectKit.new("#bookmark-after-notification-mode") # preselects the default user_option.bookmark_auto_delete_preference value of 3 (clear_reminder) - expect(user_preferences_interface_page).to have_bookmark_after_notification_mode( - Bookmark.auto_delete_preferences[:clear_reminder], - ) + expect(dropdown).to have_selected_value(Bookmark.auto_delete_preferences[:clear_reminder]) - user_preferences_interface_page.select_bookmark_after_notification_mode( - Bookmark.auto_delete_preferences[:when_reminder_sent], - ).save_changes + dropdown.select_row_by_value(Bookmark.auto_delete_preferences[:when_reminder_sent]) + click_button(I18n.t("js.save")) - expect( - UserOption.exists?( - user_id: user.id, - bookmark_auto_delete_preference: Bookmark.auto_delete_preferences[:when_reminder_sent], - ), - ).to eq(true) + # the preference page reloads after saving, so we need to poll the db + try_until_success(timeout: 20) do + expect( + UserOption.exists?( + user_id: user.id, + bookmark_auto_delete_preference: Bookmark.auto_delete_preferences[:when_reminder_sent], + ), + ).to be_truthy + end end end end