discourse/spec/system/page_objects/modals/penalize_user.rb
Krzysztof Kotlarek f63fe5ab69
FIX: JS error when silencing and unsilencing the user (#33851)
In this PR `silenced` became a computed property -
https://github.com/discourse/discourse/pull/33537

When we silence the user, one of the serialised attributes is
`silenced`. When we tried to assign it with `setProperties`, Ember was
throwing an error. This was fixed by explicitly defining the arguments.



https://github.com/user-attachments/assets/e8126484-2980-4fd8-90a7-35594076e9d8
2025-07-25 14:33:07 +08:00

41 lines
983 B
Ruby

# frozen_string_literal: true
module PageObjects
module Modals
class PenalizeUser < PageObjects::Modals::Base
def initialize(penalty_type)
@penalty_type = penalty_type
end
def similar_users
modal.all("table tbody tr td:nth-child(2)").map(&:text)
end
def modal
find(".d-modal.#{@penalty_type}-user-modal")
end
def fill_in_suspend_reason(reason)
find("input.suspend-reason").fill_in with: reason
end
def fill_in_silence_reason(reason)
find("input.silence-reason").fill_in with: reason
end
def set_future_date(date)
select = PageObjects::Components::SelectKit.new(".future-date-input details")
select.expand
select.select_row_by_value(date)
end
def perform
find(".perform-penalize").click
end
def has_error_message?(message)
expect(find("#modal-alert").text).to eq(message)
end
end
end
end