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

Commit b0e4ebd

Browse files
committed
Address review
1 parent 8e51e39 commit b0e4ebd

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

spec/system/ai_bot/homepage_spec.rb

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,20 +204,12 @@
204204
expect(header).to have_icon_in_bot_button(icon: "robot")
205205
end
206206

207-
it "displays 'new question' button on the topic page" do
207+
it "displays 'new question' button on homepage and topic page" do
208208
topic_page.visit_topic(pm)
209-
expect(sidebar).to have_css(
210-
"button.ai-new-question-button",
211-
text: I18n.t("js.discourse_ai.ai_bot.conversations.new"),
212-
)
213-
end
209+
expect(ai_pm_homepage).to have_new_question_button
214210

215-
it "displays 'new question' button on the topic page" do
216211
ai_pm_homepage.visit
217-
expect(sidebar).to have_css(
218-
"button.ai-new-question-button",
219-
text: I18n.t("js.discourse_ai.ai_bot.conversations.new"),
220-
)
212+
expect(ai_pm_homepage).to have_new_question_button
221213
end
222214

223215
it "displays sidebar and 'new question' on the topic page" do

spec/system/page_objects/components/ai_pm_homepage.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ def has_no_new_question_button?
3636
page.has_no_css?(".ai-new-question-button")
3737
end
3838

39+
def has_new_question_button?
40+
sidebar = PageObjects::Components::NavigationMenu::Sidebar.new
41+
sidebar.has_css?(
42+
"button.ai-new-question-button",
43+
text: I18n.t("js.discourse_ai.ai_bot.conversations.new"),
44+
)
45+
end
46+
3947
def click_new_question_button
4048
page.find(".ai-new-question-button").click
4149
end

0 commit comments

Comments
 (0)