2022-12-16 06:50:31 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-06-07 09:26:58 +08:00
|
|
|
describe "User preferences for Interface", type: :system do
|
2023-11-10 06:47:59 +08:00
|
|
|
fab!(:user)
|
2022-12-16 06:50:31 +08:00
|
|
|
let(:user_preferences_page) { PageObjects::Pages::UserPreferences.new }
|
2023-05-29 11:56:21 +08:00
|
|
|
let(:user_preferences_interface_page) { PageObjects::Pages::UserPreferencesInterface.new }
|
2022-12-16 06:50:31 +08:00
|
|
|
|
|
|
|
before { sign_in(user) }
|
|
|
|
|
|
|
|
describe "Bookmarks" do
|
|
|
|
it "changes the bookmark after notification preference" do
|
2023-05-29 16:48:59 +08:00
|
|
|
user_preferences_page.visit(user)
|
|
|
|
click_link(I18n.t("js.user.preferences_nav.interface"))
|
2023-05-29 15:03:49 +08:00
|
|
|
|
2023-05-29 16:48:59 +08:00
|
|
|
dropdown = PageObjects::Components::SelectKit.new("#bookmark-after-notification-mode")
|
2022-12-16 06:50:31 +08:00
|
|
|
|
|
|
|
# preselects the default user_option.bookmark_auto_delete_preference value of 3 (clear_reminder)
|
2023-05-29 16:48:59 +08:00
|
|
|
expect(dropdown).to have_selected_value(Bookmark.auto_delete_preferences[:clear_reminder])
|
|
|
|
|
|
|
|
dropdown.select_row_by_value(Bookmark.auto_delete_preferences[:when_reminder_sent])
|
|
|
|
click_button(I18n.t("js.save"))
|
|
|
|
|
|
|
|
# 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
|
2022-12-16 06:50:31 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|