mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-02 08:13:47 +08:00
This particular system test is taking a long time (~20 seconds) on CI because it is doing many full page loads. This commit refactors the test to be more efficient about the number of full page loads triggered by the tests thus reducing the runtime by half. Co-authored-by: Krzysztof Kotlarek <kotlarek.krzysztof@gmail.com>
37 lines
878 B
Ruby
37 lines
878 B
Ruby
# 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 =
|
|
PageObjects::Components::SelectKit.new(".d-modal__footer .reviewable-action-dropdown")
|
|
select_kit.expand
|
|
select_kit.select_row_by_value(action)
|
|
end
|
|
|
|
def fill_message(message)
|
|
body.fill_in("message", with: message)
|
|
end
|
|
|
|
def check_confirmation
|
|
body.check("confirmation")
|
|
end
|
|
|
|
def has_choices?(*choices)
|
|
expect(body.all(".flag-action-type-details strong").map(&:text)).to eq(choices)
|
|
end
|
|
end
|
|
end
|
|
end
|