mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 03:13:43 +08:00
d28f113ce0
* DEV: convert grant-badge to use component modal API * DEV: add system test for grant badge modal happy path
33 lines
778 B
Ruby
33 lines
778 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(".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
|