discourse/spec/system/page_objects/modals/avatar_selector.rb
Ted Johansson 3604aa2bcc
DEV: Add a Gravatar enable/disable toggle (#33533)
We want to add the ability to enable/disable users selecting Gravatar for their avatar.

This change adds a site setting to enable/disable the option (default to enabled.) This will prevent users from configuring Gravatars from that point on. It does not affect already configured avatars.

We're also taking this chance to hide some of the advanced settings from the UI.
2025-07-10 15:09:32 +08:00

40 lines
1 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Modals
class AvatarSelector < PageObjects::Modals::Base
BODY_SELECTOR = ".avatar-selector"
MODAL_SELECTOR = ".avatar-selector-modal"
AVATAR_UPLOAD_BUTTON_SELECTOR = ".avatar-uploader__button"
def select_avatar_upload_option
body.choose("avatar", option: "custom")
end
def select_system_assigned_option
body.choose("avatar", option: "system")
end
def click_avatar_upload_button
body.find(AVATAR_UPLOAD_BUTTON_SELECTOR).click
end
def has_avatar_upload_button?
has_css?(AVATAR_UPLOAD_BUTTON_SELECTOR)
end
def has_no_avatar_upload_button?
has_no_css?(AVATAR_UPLOAD_BUTTON_SELECTOR)
end
def has_avatar_options?(*options)
ordered_options = options.map { |o| ".avatar-choice--#{o}" }.join(" + ")
body.has_css?(ordered_options)
end
def has_user_avatar_image_uploaded?
body.has_css?(".avatar[src*='uploads/default']")
end
end
end
end