discourse/spec/system/page_objects/modals/create_invite.rb
Osama Sayegh 4bc030f76f
FIX: Add back the option to create invite without emailing (#29641)
Follow-up to a5497b74be

In the linked commit, as part of simplifying the invite modal, we removed the option to skip sending an email when creating an invite restricted to a specific address. This has caused confusion about whether an email will be sent by Discourse or not, so we're adding back the option to create a restricted invite without emailing.

Internal topic: t/134023/48.
2024-11-08 07:59:24 +03:00

66 lines
1.6 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Modals
class CreateInvite < PageObjects::Modals::Base
def modal
find(".create-invite-modal")
end
def edit_options_link
within(modal) { find(".edit-link-options") }
end
def save_button
within(modal) { find(".save-invite") }
end
def save_and_email_button
within(modal) { find(".save-invite-and-send-email") }
end
def copy_button
within(modal) { find(".copy-button") }
end
def has_copy_button?
within(modal) { has_css?(".copy-button") }
end
def has_alert_message?(message)
within(modal) { has_css?("#modal-alert .invite-link", text: message) }
end
def has_invite_link_input?
within(modal) { has_css?("input.invite-link") }
end
def invite_link_input
within(modal) { find("input.invite-link") }
end
def link_limits_info_paragraph
within(modal) { find("p.link-limits-info") }
end
def form
PageObjects::Components::FormKit.new(".create-invite-modal .form-kit")
end
def choose_topic(topic)
topic_picker = PageObjects::Components::SelectKit.new(".topic-chooser")
topic_picker.expand
topic_picker.search(topic.id)
topic_picker.select_row_by_index(0)
end
def choose_groups(groups)
group_picker = PageObjects::Components::SelectKit.new(".group-chooser")
group_picker.expand
groups.each { |group| group_picker.select_row_by_value(group.id) }
group_picker.collapse
end
end
end
end