2022-12-01 05:27:53 +08:00
|
|
|
# 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_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
|
|
|
|
|
2023-01-18 01:18:16 +08:00
|
|
|
INTERFACE_LINK_CSS_SELECTOR = ".user-nav__preferences-tracking"
|
2022-12-01 05:27:53 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-01-18 01:18:16 +08:00
|
|
|
ACCOUNT_LINK_CSS_SELECTOR = ".user-nav__preferences-account"
|
2022-12-01 05:27:53 +08:00
|
|
|
|
|
|
|
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
|