mirror of
https://github.com/discourse/discourse.git
synced 2024-12-21 08:23:44 +08:00
34 lines
782 B
Ruby
34 lines
782 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Modals
|
|
class Badge < PageObjects::Pages::Base
|
|
GRANTABLE_BADGES_DROPDOWN = ".select-kit"
|
|
|
|
def modal
|
|
find(".grant-badge-modal")
|
|
end
|
|
|
|
def select_badge(badge_name)
|
|
within(modal) do
|
|
grantable_badges_dropdown.expand
|
|
grantable_badges_dropdown.select_row_by_name(badge_name)
|
|
end
|
|
end
|
|
|
|
def grant
|
|
within(modal) { find(".d-modal__footer .btn").click }
|
|
end
|
|
|
|
def has_success_flash_visible?
|
|
within(modal) { has_css?(".alert-success") }
|
|
end
|
|
|
|
def grantable_badges_dropdown
|
|
@grantable_badges_dropdown ||=
|
|
PageObjects::Components::SelectKit.new(GRANTABLE_BADGES_DROPDOWN)
|
|
end
|
|
end
|
|
end
|
|
end
|