2025-04-22 10:22:03 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PageObjects
|
|
|
|
module Components
|
|
|
|
class AiPmHomepage < PageObjects::Components::Base
|
|
|
|
HOMEPAGE_WRAPPER_CLASS = ".ai-bot-conversations__content-wrapper"
|
|
|
|
|
2025-04-24 11:17:24 -05:00
|
|
|
def visit
|
|
|
|
page.visit("/discourse-ai/ai-bot/conversations")
|
|
|
|
end
|
|
|
|
|
2025-04-22 10:22:03 -05:00
|
|
|
def input
|
|
|
|
page.find("#ai-bot-conversations-input")
|
|
|
|
end
|
|
|
|
|
|
|
|
def submit
|
|
|
|
page.find(".ai-conversation-submit").click
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_too_short_dialog?
|
|
|
|
page.find(
|
|
|
|
".dialog-content",
|
|
|
|
text: I18n.t("js.discourse_ai.ai_bot.conversations.min_input_length_message"),
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_homepage?
|
|
|
|
page.has_css?(HOMEPAGE_WRAPPER_CLASS)
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_no_homepage?
|
|
|
|
page.has_no_css?(HOMEPAGE_WRAPPER_CLASS)
|
|
|
|
end
|
2025-04-24 11:17:24 -05:00
|
|
|
|
2025-04-24 13:47:11 -05:00
|
|
|
def has_no_new_question_button?
|
|
|
|
page.has_no_css?(".ai-new-question-button")
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_new_question_button
|
|
|
|
page.find(".ai-new-question-button").click
|
|
|
|
end
|
|
|
|
|
2025-04-24 11:17:24 -05:00
|
|
|
def persona_selector
|
|
|
|
PageObjects::Components::SelectKit.new(".persona-llm-selector__persona-dropdown")
|
|
|
|
end
|
|
|
|
|
|
|
|
def llm_selector
|
|
|
|
PageObjects::Components::SelectKit.new(".persona-llm-selector__llm-dropdown")
|
|
|
|
end
|
2025-04-22 10:22:03 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|