mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
DEV: convert grant badge modal to component API (#23378)
* DEV: convert grant-badge to use component modal API * DEV: add system test for grant badge modal happy path
This commit is contained in:
32
spec/system/page_objects/modals/badge.rb
Normal file
32
spec/system/page_objects/modals/badge.rb
Normal file
@ -0,0 +1,32 @@
|
||||
# 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
|
Reference in New Issue
Block a user