mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-28 07:19:11 +08:00
Improves some chat integration provider setup UX. First, we added a quick link to the provider site settings. Second, we've added a way to quickly turn on each provider from a quick menu. Providers which need additional settings before being enabled (like Telegram and Slack) will show a form in a modal first.
48 lines
1.3 KiB
Ruby
Vendored
48 lines
1.3 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class ChatIntegrationSetupProvider < PageObjects::Pages::Base
|
|
FORM_SCOPE = "#chat-integration-setup-provider-modal"
|
|
|
|
def form
|
|
@form ||= PageObjects::Components::FormKit.new(FORM_SCOPE)
|
|
end
|
|
|
|
def add_provider_menu
|
|
PageObjects::Components::DMenu.new(find(".chat-integration-add-provider-trigger"))
|
|
end
|
|
|
|
def setup_popular_provider(provider_name)
|
|
find(".chat-integration-providers-list").find(
|
|
".chat-integration-popular-provider-setup.--#{provider_name}",
|
|
).click
|
|
self
|
|
end
|
|
|
|
def fill_slack_access_token(value)
|
|
form.field("chat_integration_slack_access_token").fill_in(value)
|
|
self
|
|
end
|
|
|
|
def fill_slack_webhook_url(value)
|
|
form.field("chat_integration_slack_outbound_webhook_url").fill_in(value)
|
|
self
|
|
end
|
|
|
|
def fill_telegram_access_token(value)
|
|
form.field("chat_integration_telegram_access_token").fill_in(value)
|
|
self
|
|
end
|
|
|
|
def submit
|
|
form.submit
|
|
self
|
|
end
|
|
|
|
def has_field_error?(field_name)
|
|
within(FORM_SCOPE) { has_css?(".form-kit__field[data-name='#{field_name}'].has-error") }
|
|
end
|
|
end
|
|
end
|
|
end
|