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

Commit c666533

Browse files
committed
Test with the glimmer post menu enabled and disabled
1 parent 942ee5d commit c666533

File tree

1 file changed

+85
-75
lines changed

1 file changed

+85
-75
lines changed

spec/system/ai_bot/share_spec.rb

Lines changed: 85 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
Fabricate.build(:topic_allowed_user, user: admin),
1414
Fabricate.build(:topic_allowed_user, user: bot_user),
1515
],
16-
)
16+
)
1717
end
1818

1919
let(:pm_posts) do
@@ -43,114 +43,124 @@
4343
page.execute_script("window.navigator.clipboard.writeText('')")
4444
end
4545

46-
it "can share a conversation with a persona user" do
47-
clip_text = nil
46+
glimmer_post_menu_states = %w[enabled disabled]
4847

49-
persona = Fabricate(:ai_persona, name: "Tester")
50-
persona.create_user!
48+
glimmer_post_menu_states.each do |state|
49+
context "with the glimmer post menu #{state}" do
50+
before do
51+
SiteSetting.glimmer_post_menu_mode = state
52+
end
5153

52-
Fabricate(:post, topic: pm, user: admin, raw: "How do I do stuff?")
53-
Fabricate(:post, topic: pm, user: persona.user, raw: "No idea")
54+
it "can share a conversation with a persona user" do
55+
clip_text = nil
5456

55-
visit(pm.url)
57+
persona = Fabricate(:ai_persona, name: "Tester")
58+
persona.create_user!
5659

57-
find("#post_2 .post-action-menu__share-ai").click
60+
Fabricate(:post, topic: pm, user: admin, raw: "How do I do stuff?")
61+
Fabricate(:post, topic: pm, user: persona.user, raw: "No idea")
5862

59-
try_until_success do
60-
clip_text = cdp.read_clipboard
61-
expect(clip_text).not_to eq("")
62-
end
63+
visit(pm.url)
6364

64-
conversation = (<<~TEXT).strip
65-
<details class='ai-quote'>
66-
<summary>
67-
<span>This is my special PM</span>
68-
<span title='Conversation with AI'>AI</span>
69-
</summary>
65+
find("#post_2 .post-action-menu__share-ai").click
7066

71-
**ai_sharer:**
67+
try_until_success do
68+
clip_text = cdp.read_clipboard
69+
expect(clip_text).not_to eq("")
70+
end
7271

73-
How do I do stuff?
72+
conversation = (<<~TEXT).strip
73+
<details class='ai-quote'>
74+
<summary>
75+
<span>This is my special PM</span>
76+
<span title='Conversation with AI'>AI</span>
77+
</summary>
7478
75-
**Tester_bot:**
79+
**ai_sharer:**
7680
77-
No idea
78-
</details>
79-
TEXT
81+
How do I do stuff?
8082
81-
expect(conversation).to eq(clip_text)
82-
end
83+
**Tester_bot:**
8384
84-
it "can share a conversation" do
85-
clip_text = nil
85+
No idea
86+
</details>
87+
TEXT
8688

87-
pm
88-
pm_posts
89+
expect(conversation).to eq(clip_text)
90+
end
8991

90-
visit(pm.url)
92+
it "can share a conversation" do
93+
clip_text = nil
9194

92-
find("#post_2 .post-action-menu__share-ai").click
95+
pm
96+
pm_posts
9397

94-
try_until_success do
95-
clip_text = cdp.read_clipboard
96-
expect(clip_text).not_to eq("")
97-
end
98+
visit(pm.url)
9899

99-
conversation = (<<~TEXT).strip
100-
<details class='ai-quote'>
101-
<summary>
102-
<span>This is my special PM</span>
103-
<span title='Conversation with AI'>AI</span>
104-
</summary>
100+
find("#post_2 .post-action-menu__share-ai").click
105101

106-
**ai_sharer:**
102+
try_until_success do
103+
clip_text = cdp.read_clipboard
104+
expect(clip_text).not_to eq("")
105+
end
107106

108-
test test test user reply 1
107+
conversation = (<<~TEXT).strip
108+
<details class='ai-quote'>
109+
<summary>
110+
<span>This is my special PM</span>
111+
<span title='Conversation with AI'>AI</span>
112+
</summary>
109113
110-
**gpt-4:**
114+
**ai_sharer:**
111115
112-
test test test bot reply 1
113-
</details>
114-
TEXT
116+
test test test user reply 1
115117
116-
expect(conversation).to eq(clip_text)
118+
**gpt-4:**
117119
118-
page.execute_script("window.navigator.clipboard.writeText('')")
120+
test test test bot reply 1
121+
</details>
122+
TEXT
119123

120-
find("#post_6 .post-action-menu__share-ai").click
121-
find(".ai-share-modal__slider input").set("2")
122-
find(".ai-share-modal button.btn-primary").click
124+
expect(conversation).to eq(clip_text)
123125

124-
try_until_success do
125-
clip_text = cdp.read_clipboard
126-
expect(clip_text).not_to eq("")
127-
end
126+
page.execute_script("window.navigator.clipboard.writeText('')")
127+
128+
find("#post_6 .post-action-menu__share-ai").click
129+
find(".ai-share-modal__slider input").set("2")
130+
find(".ai-share-modal button.btn-primary").click
128131

129-
conversation = (<<~TEXT).strip
130-
<details class='ai-quote'>
131-
<summary>
132-
<span>This is my special PM</span>
133-
<span title='Conversation with AI'>AI</span>
134-
</summary>
132+
try_until_success do
133+
clip_text = cdp.read_clipboard
134+
expect(clip_text).not_to eq("")
135+
end
135136

136-
**ai_sharer:**
137+
conversation = (<<~TEXT).strip
138+
<details class='ai-quote'>
139+
<summary>
140+
<span>This is my special PM</span>
141+
<span title='Conversation with AI'>AI</span>
142+
</summary>
137143
138-
test test test user reply 2
144+
**ai_sharer:**
139145
140-
**gpt-4:**
146+
test test test user reply 2
141147
142-
test test test bot reply 2
148+
**gpt-4:**
143149
144-
**ai_sharer:**
150+
test test test bot reply 2
145151
146-
test test test user reply 3
152+
**ai_sharer:**
147153
148-
**gpt-4:**
154+
test test test user reply 3
149155
150-
test test test bot reply 3
151-
</details>
152-
TEXT
156+
**gpt-4:**
153157
154-
expect(conversation).to eq(clip_text)
158+
test test test bot reply 3
159+
</details>
160+
TEXT
161+
162+
expect(conversation).to eq(clip_text)
163+
end
164+
end
155165
end
156166
end

0 commit comments

Comments
 (0)