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

Commit fb68ae9

Browse files
DEV: Drop widget post-menu spec (#1236)
In preparation for discourse/discourse#31211
1 parent 30242a2 commit fb68ae9

File tree

1 file changed

+74
-82
lines changed

1 file changed

+74
-82
lines changed

spec/system/ai_bot/share_spec.rb

Lines changed: 74 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -43,122 +43,114 @@
4343
page.execute_script("window.navigator.clipboard.writeText('')")
4444
end
4545

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

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

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

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

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

61-
visit(pm.url)
62-
63-
find("#post_2 .post-action-menu__share-ai").click
64-
65-
try_until_success do
66-
clip_text = cdp.read_clipboard
67-
expect(clip_text).not_to eq("")
68-
end
59+
try_until_success do
60+
clip_text = cdp.read_clipboard
61+
expect(clip_text).not_to eq("")
62+
end
6963

70-
conversation = (<<~TEXT).strip
71-
<details class='ai-quote'>
72-
<summary>
73-
<span>This is my special PM</span>
74-
<span title='Conversation with AI'>AI</span>
75-
</summary>
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>
7670
77-
**ai_sharer:**
71+
**ai_sharer:**
7872
79-
How do I do stuff?
73+
How do I do stuff?
8074
81-
**Tester_bot:**
75+
**Tester_bot:**
8276
83-
No idea
84-
</details>
85-
TEXT
77+
No idea
78+
</details>
79+
TEXT
8680

87-
expect(conversation).to eq(clip_text)
88-
end
81+
expect(conversation).to eq(clip_text)
82+
end
8983

90-
it "can share a conversation" do
91-
clip_text = nil
84+
it "can share a conversation" do
85+
clip_text = nil
9286

93-
pm
94-
pm_posts
87+
pm
88+
pm_posts
9589

96-
visit(pm.url)
90+
visit(pm.url)
9791

98-
find("#post_2 .post-action-menu__share-ai").click
92+
find("#post_2 .post-action-menu__share-ai").click
9993

100-
try_until_success do
101-
clip_text = cdp.read_clipboard
102-
expect(clip_text).not_to eq("")
103-
end
94+
try_until_success do
95+
clip_text = cdp.read_clipboard
96+
expect(clip_text).not_to eq("")
97+
end
10498

105-
conversation = (<<~TEXT).strip
106-
<details class='ai-quote'>
107-
<summary>
108-
<span>This is my special PM</span>
109-
<span title='Conversation with AI'>AI</span>
110-
</summary>
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>
111105
112-
**ai_sharer:**
106+
**ai_sharer:**
113107
114-
test test test user reply 1
108+
test test test user reply 1
115109
116-
**gpt-4:**
110+
**gpt-4:**
117111
118-
test test test bot reply 1
119-
</details>
120-
TEXT
112+
test test test bot reply 1
113+
</details>
114+
TEXT
121115

122-
expect(conversation).to eq(clip_text)
116+
expect(conversation).to eq(clip_text)
123117

124-
page.execute_script("window.navigator.clipboard.writeText('')")
118+
page.execute_script("window.navigator.clipboard.writeText('')")
125119

126-
find("#post_6 .post-action-menu__share-ai").click
127-
find(".ai-share-modal__slider input").set("2")
128-
find(".ai-share-modal button.btn-primary").click
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
129123

130-
try_until_success do
131-
clip_text = cdp.read_clipboard
132-
expect(clip_text).not_to eq("")
133-
end
124+
try_until_success do
125+
clip_text = cdp.read_clipboard
126+
expect(clip_text).not_to eq("")
127+
end
134128

135-
conversation = (<<~TEXT).strip
136-
<details class='ai-quote'>
137-
<summary>
138-
<span>This is my special PM</span>
139-
<span title='Conversation with AI'>AI</span>
140-
</summary>
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>
141135
142-
**ai_sharer:**
136+
**ai_sharer:**
143137
144-
test test test user reply 2
138+
test test test user reply 2
145139
146-
**gpt-4:**
140+
**gpt-4:**
147141
148-
test test test bot reply 2
142+
test test test bot reply 2
149143
150-
**ai_sharer:**
144+
**ai_sharer:**
151145
152-
test test test user reply 3
146+
test test test user reply 3
153147
154-
**gpt-4:**
148+
**gpt-4:**
155149
156-
test test test bot reply 3
157-
</details>
158-
TEXT
150+
test test test bot reply 3
151+
</details>
152+
TEXT
159153

160-
expect(conversation).to eq(clip_text)
161-
end
162-
end
154+
expect(conversation).to eq(clip_text)
163155
end
164156
end

0 commit comments

Comments
 (0)