2023-10-30 08:24:35 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PageObjects
|
|
|
|
module Modals
|
|
|
|
class Flag < PageObjects::Modals::Base
|
|
|
|
BODY_SELECTOR = ".flag-modal-body"
|
|
|
|
MODAL_SELECTOR = ".flag-modal"
|
|
|
|
|
|
|
|
def choose_type(type)
|
|
|
|
body.find("#radio_#{type}").click
|
|
|
|
end
|
|
|
|
|
|
|
|
def confirm_flag
|
|
|
|
click_primary_button
|
|
|
|
end
|
|
|
|
|
|
|
|
def take_action(action)
|
|
|
|
select_kit =
|
2023-11-15 18:14:47 +08:00
|
|
|
PageObjects::Components::SelectKit.new(".d-modal__footer .reviewable-action-dropdown")
|
2023-10-30 08:24:35 +08:00
|
|
|
select_kit.expand
|
|
|
|
select_kit.select_row_by_value(action)
|
|
|
|
end
|
2024-02-21 10:49:19 +08:00
|
|
|
|
|
|
|
def fill_message(message)
|
|
|
|
body.fill_in("message", with: message)
|
|
|
|
end
|
|
|
|
|
|
|
|
def check_confirmation
|
|
|
|
body.check("confirmation")
|
|
|
|
end
|
2024-08-05 09:01:25 +08:00
|
|
|
|
|
|
|
def has_choices?(*choices)
|
|
|
|
body.all(".flag-action-type-details strong").map(&:text) == choices
|
|
|
|
end
|
2023-10-30 08:24:35 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|