Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 2db0a16

Browse files
committed
Spec for choosing persona and llm
1 parent 21c5e16 commit 2db0a16

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

spec/system/ai_bot/homepage_spec.rb

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,20 @@
1818
provider: "anthropic",
1919
url: "https://api.anthropic.com/v1/messages",
2020
name: "claude-2",
21+
display_name: "Claude 2",
22+
)
23+
end
24+
fab!(:claude_2_dup) do
25+
Fabricate(
26+
:llm_model,
27+
provider: "anthropic",
28+
url: "https://api.anthropic.com/v1/messages",
29+
name: "claude-2",
30+
display_name: "Duplicate",
2131
)
2232
end
2333
fab!(:bot_user) do
24-
toggle_enabled_bots(bots: [claude_2])
34+
toggle_enabled_bots(bots: [claude_2, claude_2_dup])
2535
SiteSetting.ai_bot_enabled = true
2636
claude_2.reload.user
2737
end
@@ -216,6 +226,18 @@
216226
expect(ai_pm_homepage).to have_homepage
217227
expect(sidebar).to have_no_section_link(pm.title)
218228
end
229+
230+
it "Allows choosing persona and LLM" do
231+
ai_pm_homepage.visit
232+
233+
ai_pm_homepage.persona_selector.expand
234+
ai_pm_homepage.persona_selector.select_row_by_name(persona.name)
235+
ai_pm_homepage.persona_selector.collapse
236+
237+
ai_pm_homepage.llm_selector.expand
238+
ai_pm_homepage.llm_selector.select_row_by_name(claude_2_dup.display_name)
239+
ai_pm_homepage.llm_selector.collapse
240+
end
219241
end
220242

221243
context "when `ai_enable_experimental_bot_ux` is disabled" do

spec/system/page_objects/components/ai_pm_homepage.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ module Components
55
class AiPmHomepage < PageObjects::Components::Base
66
HOMEPAGE_WRAPPER_CLASS = ".ai-bot-conversations__content-wrapper"
77

8+
def visit
9+
page.visit("/discourse-ai/ai-bot/conversations")
10+
end
11+
812
def input
913
page.find("#ai-bot-conversations-input")
1014
end
@@ -27,6 +31,14 @@ def has_homepage?
2731
def has_no_homepage?
2832
page.has_no_css?(HOMEPAGE_WRAPPER_CLASS)
2933
end
34+
35+
def persona_selector
36+
PageObjects::Components::SelectKit.new(".persona-llm-selector__persona-dropdown")
37+
end
38+
39+
def llm_selector
40+
PageObjects::Components::SelectKit.new(".persona-llm-selector__llm-dropdown")
41+
end
3042
end
3143
end
3244
end

0 commit comments

Comments
 (0)