mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-28 09:18:55 +08:00
This commit adds a new Revise... action that can be taken for queued post reviewables. This will open a modal where the user can select a Reason from a preconfigured list (or by choosing Other..., a custom reason) and provide feedback to the user about their post. The post will be rejected still, but a PM will also be sent to the user so they have an opportunity to improve their post when they resubmit it.
83 lines
2.2 KiB
Ruby
Vendored
83 lines
2.2 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class Review < PageObjects::Pages::Base
|
|
POST_BODY_TOGGLE_SELECTOR = ".post-body__toggle-btn"
|
|
POST_BODY_COLLAPSED_SELECTOR = ".post-body.is-collapsed"
|
|
REVIEWABLE_ACTION_DROPDOWN = ".reviewable-action-dropdown"
|
|
|
|
def visit_reviewable(reviewable)
|
|
page.visit("/review/#{reviewable.id}")
|
|
self
|
|
end
|
|
|
|
def select_bundled_action(reviewable, value)
|
|
within(reviewable_by_id(reviewable.id)) do
|
|
reviewable_action_dropdown.select_row_by_value(value)
|
|
end
|
|
end
|
|
|
|
def select_action(reviewable, value)
|
|
within(reviewable_by_id(reviewable.id)) do
|
|
find(".reviewable-action.#{value.dasherize}").click
|
|
end
|
|
end
|
|
|
|
def reviewable_by_id(id)
|
|
find(".reviewable-item[data-reviewable-id=\"#{id}\"]")
|
|
end
|
|
|
|
def click_post_body_toggle
|
|
find(POST_BODY_TOGGLE_SELECTOR).click
|
|
end
|
|
|
|
def has_post_body_toggle?
|
|
page.has_css?(POST_BODY_TOGGLE_SELECTOR)
|
|
end
|
|
|
|
def has_no_post_body_toggle?
|
|
page.has_no_css?(POST_BODY_TOGGLE_SELECTOR)
|
|
end
|
|
|
|
def has_post_body_collapsed?
|
|
page.has_css?(POST_BODY_COLLAPSED_SELECTOR)
|
|
end
|
|
|
|
def has_no_post_body_collapsed?
|
|
page.has_no_css?(POST_BODY_COLLAPSED_SELECTOR)
|
|
end
|
|
|
|
def has_reviewable_action_dropdown?
|
|
page.has_css?(REVIEWABLE_ACTION_DROPDOWN)
|
|
end
|
|
|
|
def has_no_reviewable_action_dropdown?
|
|
page.has_no_css?(REVIEWABLE_ACTION_DROPDOWN)
|
|
end
|
|
|
|
def has_reviewable_with_pending_status?(reviewable)
|
|
within(reviewable_by_id(reviewable.id)) { page.has_css?(".status .pending") }
|
|
end
|
|
|
|
def has_reviewable_with_rejected_status?(reviewable)
|
|
within(reviewable_by_id(reviewable.id)) { page.has_css?(".status .rejected") }
|
|
end
|
|
|
|
def has_error_dialog_visible?
|
|
page.has_css?(".dialog-container .dialog-content")
|
|
end
|
|
|
|
def has_no_error_dialog_visible?
|
|
page.has_no_css?("dialog-container .dialog-content")
|
|
end
|
|
|
|
private
|
|
|
|
def reviewable_action_dropdown
|
|
@reviewable_action_dropdown ||=
|
|
PageObjects::Components::SelectKit.new(REVIEWABLE_ACTION_DROPDOWN)
|
|
end
|
|
end
|
|
end
|
|
end
|