DEV: uses select-kit component for interface spec (#21790)
This commit is contained in:
parent
ac0f5ca1b2
commit
9321299caa
|
@ -39,7 +39,7 @@ module PageObjects
|
||||||
end
|
end
|
||||||
|
|
||||||
def expand
|
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
|
expanded_component
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,32 +9,26 @@ describe "User preferences for Interface", type: :system, js: true do
|
||||||
|
|
||||||
describe "Bookmarks" do
|
describe "Bookmarks" do
|
||||||
it "changes the bookmark after notification preference" do
|
it "changes the bookmark after notification preference" do
|
||||||
skip(<<~TEXT) if ENV["CI"]
|
user_preferences_page.visit(user)
|
||||||
This is currently failing on CI with the following:
|
click_link(I18n.t("js.user.preferences_nav.interface"))
|
||||||
|
|
||||||
```
|
dropdown = PageObjects::Components::SelectKit.new("#bookmark-after-notification-mode")
|
||||||
Failure/Error: expect(page).to have_content(I18n.t("js.saved"))
|
|
||||||
expected `#<Capybara::Session>.has_content?("Saved!")` to be truthy, got false
|
|
||||||
```
|
|
||||||
TEXT
|
|
||||||
|
|
||||||
user_preferences_page.visit(user).click_interface_tab
|
|
||||||
|
|
||||||
# preselects the default user_option.bookmark_auto_delete_preference value of 3 (clear_reminder)
|
# 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(
|
expect(dropdown).to have_selected_value(Bookmark.auto_delete_preferences[:clear_reminder])
|
||||||
Bookmark.auto_delete_preferences[:clear_reminder],
|
|
||||||
)
|
|
||||||
|
|
||||||
user_preferences_interface_page.select_bookmark_after_notification_mode(
|
dropdown.select_row_by_value(Bookmark.auto_delete_preferences[:when_reminder_sent])
|
||||||
Bookmark.auto_delete_preferences[:when_reminder_sent],
|
click_button(I18n.t("js.save"))
|
||||||
).save_changes
|
|
||||||
|
|
||||||
|
# the preference page reloads after saving, so we need to poll the db
|
||||||
|
try_until_success(timeout: 20) do
|
||||||
expect(
|
expect(
|
||||||
UserOption.exists?(
|
UserOption.exists?(
|
||||||
user_id: user.id,
|
user_id: user.id,
|
||||||
bookmark_auto_delete_preference: Bookmark.auto_delete_preferences[:when_reminder_sent],
|
bookmark_auto_delete_preference: Bookmark.auto_delete_preferences[:when_reminder_sent],
|
||||||
),
|
),
|
||||||
).to eq(true)
|
).to be_truthy
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue