mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-27 10:02:16 +00:00
DEV: Drop widget post-menu spec (#1236)
In preparation for https://github.com/discourse/discourse/pull/31211
This commit is contained in:
parent
30242a27e6
commit
fb68ae9698
@ -43,122 +43,114 @@ RSpec.describe "Share conversation", type: :system do
|
|||||||
page.execute_script("window.navigator.clipboard.writeText('')")
|
page.execute_script("window.navigator.clipboard.writeText('')")
|
||||||
end
|
end
|
||||||
|
|
||||||
glimmer_post_menu_states = %w[enabled disabled]
|
it "can share a conversation with a persona user" do
|
||||||
|
clip_text = nil
|
||||||
|
|
||||||
glimmer_post_menu_states.each do |state|
|
persona = Fabricate(:ai_persona, name: "Tester")
|
||||||
context "with the glimmer post menu #{state}" do
|
persona.create_user!
|
||||||
before { SiteSetting.glimmer_post_menu_mode = state }
|
|
||||||
|
|
||||||
it "can share a conversation with a persona user" do
|
Fabricate(:post, topic: pm, user: admin, raw: "How do I do stuff?")
|
||||||
clip_text = nil
|
Fabricate(:post, topic: pm, user: persona.user, raw: "No idea")
|
||||||
|
|
||||||
persona = Fabricate(:ai_persona, name: "Tester")
|
visit(pm.url)
|
||||||
persona.create_user!
|
|
||||||
|
|
||||||
Fabricate(:post, topic: pm, user: admin, raw: "How do I do stuff?")
|
find("#post_2 .post-action-menu__share-ai").click
|
||||||
Fabricate(:post, topic: pm, user: persona.user, raw: "No idea")
|
|
||||||
|
|
||||||
visit(pm.url)
|
try_until_success do
|
||||||
|
clip_text = cdp.read_clipboard
|
||||||
find("#post_2 .post-action-menu__share-ai").click
|
expect(clip_text).not_to eq("")
|
||||||
|
|
||||||
try_until_success do
|
|
||||||
clip_text = cdp.read_clipboard
|
|
||||||
expect(clip_text).not_to eq("")
|
|
||||||
end
|
|
||||||
|
|
||||||
conversation = (<<~TEXT).strip
|
|
||||||
<details class='ai-quote'>
|
|
||||||
<summary>
|
|
||||||
<span>This is my special PM</span>
|
|
||||||
<span title='Conversation with AI'>AI</span>
|
|
||||||
</summary>
|
|
||||||
|
|
||||||
**ai_sharer:**
|
|
||||||
|
|
||||||
How do I do stuff?
|
|
||||||
|
|
||||||
**Tester_bot:**
|
|
||||||
|
|
||||||
No idea
|
|
||||||
</details>
|
|
||||||
TEXT
|
|
||||||
|
|
||||||
expect(conversation).to eq(clip_text)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "can share a conversation" do
|
|
||||||
clip_text = nil
|
|
||||||
|
|
||||||
pm
|
|
||||||
pm_posts
|
|
||||||
|
|
||||||
visit(pm.url)
|
|
||||||
|
|
||||||
find("#post_2 .post-action-menu__share-ai").click
|
|
||||||
|
|
||||||
try_until_success do
|
|
||||||
clip_text = cdp.read_clipboard
|
|
||||||
expect(clip_text).not_to eq("")
|
|
||||||
end
|
|
||||||
|
|
||||||
conversation = (<<~TEXT).strip
|
|
||||||
<details class='ai-quote'>
|
|
||||||
<summary>
|
|
||||||
<span>This is my special PM</span>
|
|
||||||
<span title='Conversation with AI'>AI</span>
|
|
||||||
</summary>
|
|
||||||
|
|
||||||
**ai_sharer:**
|
|
||||||
|
|
||||||
test test test user reply 1
|
|
||||||
|
|
||||||
**gpt-4:**
|
|
||||||
|
|
||||||
test test test bot reply 1
|
|
||||||
</details>
|
|
||||||
TEXT
|
|
||||||
|
|
||||||
expect(conversation).to eq(clip_text)
|
|
||||||
|
|
||||||
page.execute_script("window.navigator.clipboard.writeText('')")
|
|
||||||
|
|
||||||
find("#post_6 .post-action-menu__share-ai").click
|
|
||||||
find(".ai-share-modal__slider input").set("2")
|
|
||||||
find(".ai-share-modal button.btn-primary").click
|
|
||||||
|
|
||||||
try_until_success do
|
|
||||||
clip_text = cdp.read_clipboard
|
|
||||||
expect(clip_text).not_to eq("")
|
|
||||||
end
|
|
||||||
|
|
||||||
conversation = (<<~TEXT).strip
|
|
||||||
<details class='ai-quote'>
|
|
||||||
<summary>
|
|
||||||
<span>This is my special PM</span>
|
|
||||||
<span title='Conversation with AI'>AI</span>
|
|
||||||
</summary>
|
|
||||||
|
|
||||||
**ai_sharer:**
|
|
||||||
|
|
||||||
test test test user reply 2
|
|
||||||
|
|
||||||
**gpt-4:**
|
|
||||||
|
|
||||||
test test test bot reply 2
|
|
||||||
|
|
||||||
**ai_sharer:**
|
|
||||||
|
|
||||||
test test test user reply 3
|
|
||||||
|
|
||||||
**gpt-4:**
|
|
||||||
|
|
||||||
test test test bot reply 3
|
|
||||||
</details>
|
|
||||||
TEXT
|
|
||||||
|
|
||||||
expect(conversation).to eq(clip_text)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
conversation = (<<~TEXT).strip
|
||||||
|
<details class='ai-quote'>
|
||||||
|
<summary>
|
||||||
|
<span>This is my special PM</span>
|
||||||
|
<span title='Conversation with AI'>AI</span>
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
**ai_sharer:**
|
||||||
|
|
||||||
|
How do I do stuff?
|
||||||
|
|
||||||
|
**Tester_bot:**
|
||||||
|
|
||||||
|
No idea
|
||||||
|
</details>
|
||||||
|
TEXT
|
||||||
|
|
||||||
|
expect(conversation).to eq(clip_text)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "can share a conversation" do
|
||||||
|
clip_text = nil
|
||||||
|
|
||||||
|
pm
|
||||||
|
pm_posts
|
||||||
|
|
||||||
|
visit(pm.url)
|
||||||
|
|
||||||
|
find("#post_2 .post-action-menu__share-ai").click
|
||||||
|
|
||||||
|
try_until_success do
|
||||||
|
clip_text = cdp.read_clipboard
|
||||||
|
expect(clip_text).not_to eq("")
|
||||||
|
end
|
||||||
|
|
||||||
|
conversation = (<<~TEXT).strip
|
||||||
|
<details class='ai-quote'>
|
||||||
|
<summary>
|
||||||
|
<span>This is my special PM</span>
|
||||||
|
<span title='Conversation with AI'>AI</span>
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
**ai_sharer:**
|
||||||
|
|
||||||
|
test test test user reply 1
|
||||||
|
|
||||||
|
**gpt-4:**
|
||||||
|
|
||||||
|
test test test bot reply 1
|
||||||
|
</details>
|
||||||
|
TEXT
|
||||||
|
|
||||||
|
expect(conversation).to eq(clip_text)
|
||||||
|
|
||||||
|
page.execute_script("window.navigator.clipboard.writeText('')")
|
||||||
|
|
||||||
|
find("#post_6 .post-action-menu__share-ai").click
|
||||||
|
find(".ai-share-modal__slider input").set("2")
|
||||||
|
find(".ai-share-modal button.btn-primary").click
|
||||||
|
|
||||||
|
try_until_success do
|
||||||
|
clip_text = cdp.read_clipboard
|
||||||
|
expect(clip_text).not_to eq("")
|
||||||
|
end
|
||||||
|
|
||||||
|
conversation = (<<~TEXT).strip
|
||||||
|
<details class='ai-quote'>
|
||||||
|
<summary>
|
||||||
|
<span>This is my special PM</span>
|
||||||
|
<span title='Conversation with AI'>AI</span>
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
**ai_sharer:**
|
||||||
|
|
||||||
|
test test test user reply 2
|
||||||
|
|
||||||
|
**gpt-4:**
|
||||||
|
|
||||||
|
test test test bot reply 2
|
||||||
|
|
||||||
|
**ai_sharer:**
|
||||||
|
|
||||||
|
test test test user reply 3
|
||||||
|
|
||||||
|
**gpt-4:**
|
||||||
|
|
||||||
|
test test test bot reply 3
|
||||||
|
</details>
|
||||||
|
TEXT
|
||||||
|
|
||||||
|
expect(conversation).to eq(clip_text)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user