mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 00:33:44 +08:00
7d9a823a55
Why is this change required? The flaky system test was due to the fact that we had to poll for the user preferences interface page to reload after saving. However, this turns out to be a bug on the user perferences interface page because the page should only reload if the user has selected a new theme that is different from the site's default but we were reloading the page for users that did not have any user theme selected. Therefore there was an unnecessary reload happening when saving other fields on the user preferences interface page.
52 lines
1.4 KiB
Ruby
52 lines
1.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class UserPreferences < PageObjects::Pages::Base
|
|
def visit(user)
|
|
page.visit("/u/#{user.username}/preferences")
|
|
self
|
|
end
|
|
|
|
def click_interface_tab
|
|
click_link "Interface"
|
|
self
|
|
end
|
|
|
|
def click_secondary_navigation_menu_scroll_right
|
|
find(".horizontal-overflow-nav__scroll-right").click
|
|
end
|
|
|
|
def click_secondary_navigation_menu_scroll_left
|
|
find(".horizontal-overflow-nav__scroll-left").click
|
|
end
|
|
|
|
INTERFACE_LINK_CSS_SELECTOR = ".user-nav__preferences-tracking"
|
|
|
|
def has_interface_link_visible?
|
|
horizontal_secondary_link_visible?(INTERFACE_LINK_CSS_SELECTOR, visible: true)
|
|
end
|
|
|
|
def has_interface_link_not_visible?
|
|
horizontal_secondary_link_visible?(INTERFACE_LINK_CSS_SELECTOR, visible: false)
|
|
end
|
|
|
|
ACCOUNT_LINK_CSS_SELECTOR = ".user-nav__preferences-account"
|
|
|
|
def has_account_link_visible?
|
|
horizontal_secondary_link_visible?(ACCOUNT_LINK_CSS_SELECTOR, visible: true)
|
|
end
|
|
|
|
def has_account_link_not_visible?
|
|
horizontal_secondary_link_visible?(ACCOUNT_LINK_CSS_SELECTOR, visible: false)
|
|
end
|
|
|
|
private
|
|
|
|
def horizontal_secondary_link_visible?(selector, visible: true)
|
|
within(".user-navigation-secondary") { page.has_selector?(selector, visible: visible) }
|
|
end
|
|
end
|
|
end
|
|
end
|