|
13 | 13 | Fabricate.build(:topic_allowed_user, user: admin), |
14 | 14 | Fabricate.build(:topic_allowed_user, user: bot_user), |
15 | 15 | ], |
16 | | - ) |
| 16 | + ) |
17 | 17 | end |
18 | 18 |
|
19 | 19 | let(:pm_posts) do |
|
43 | 43 | page.execute_script("window.navigator.clipboard.writeText('')") |
44 | 44 | end |
45 | 45 |
|
46 | | - it "can share a conversation with a persona user" do |
47 | | - clip_text = nil |
| 46 | + glimmer_post_menu_states = %w[enabled disabled] |
48 | 47 |
|
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 |
51 | 53 |
|
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 |
54 | 56 |
|
55 | | - visit(pm.url) |
| 57 | + persona = Fabricate(:ai_persona, name: "Tester") |
| 58 | + persona.create_user! |
56 | 59 |
|
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") |
58 | 62 |
|
59 | | - try_until_success do |
60 | | - clip_text = cdp.read_clipboard |
61 | | - expect(clip_text).not_to eq("") |
62 | | - end |
| 63 | + visit(pm.url) |
63 | 64 |
|
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 |
70 | 66 |
|
71 | | - **ai_sharer:** |
| 67 | + try_until_success do |
| 68 | + clip_text = cdp.read_clipboard |
| 69 | + expect(clip_text).not_to eq("") |
| 70 | + end |
72 | 71 |
|
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> |
74 | 78 |
|
75 | | - **Tester_bot:** |
| 79 | + **ai_sharer:** |
76 | 80 |
|
77 | | - No idea |
78 | | - </details> |
79 | | - TEXT |
| 81 | + How do I do stuff? |
80 | 82 |
|
81 | | - expect(conversation).to eq(clip_text) |
82 | | - end |
| 83 | + **Tester_bot:** |
83 | 84 |
|
84 | | - it "can share a conversation" do |
85 | | - clip_text = nil |
| 85 | + No idea |
| 86 | + </details> |
| 87 | + TEXT |
86 | 88 |
|
87 | | - pm |
88 | | - pm_posts |
| 89 | + expect(conversation).to eq(clip_text) |
| 90 | + end |
89 | 91 |
|
90 | | - visit(pm.url) |
| 92 | + it "can share a conversation" do |
| 93 | + clip_text = nil |
91 | 94 |
|
92 | | - find("#post_2 .post-action-menu__share-ai").click |
| 95 | + pm |
| 96 | + pm_posts |
93 | 97 |
|
94 | | - try_until_success do |
95 | | - clip_text = cdp.read_clipboard |
96 | | - expect(clip_text).not_to eq("") |
97 | | - end |
| 98 | + visit(pm.url) |
98 | 99 |
|
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 |
105 | 101 |
|
106 | | - **ai_sharer:** |
| 102 | + try_until_success do |
| 103 | + clip_text = cdp.read_clipboard |
| 104 | + expect(clip_text).not_to eq("") |
| 105 | + end |
107 | 106 |
|
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> |
109 | 113 |
|
110 | | - **gpt-4:** |
| 114 | + **ai_sharer:** |
111 | 115 |
|
112 | | - test test test bot reply 1 |
113 | | - </details> |
114 | | - TEXT |
| 116 | + test test test user reply 1 |
115 | 117 |
|
116 | | - expect(conversation).to eq(clip_text) |
| 118 | + **gpt-4:** |
117 | 119 |
|
118 | | - page.execute_script("window.navigator.clipboard.writeText('')") |
| 120 | + test test test bot reply 1 |
| 121 | + </details> |
| 122 | + TEXT |
119 | 123 |
|
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) |
123 | 125 |
|
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 |
128 | 131 |
|
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 |
135 | 136 |
|
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> |
137 | 143 |
|
138 | | - test test test user reply 2 |
| 144 | + **ai_sharer:** |
139 | 145 |
|
140 | | - **gpt-4:** |
| 146 | + test test test user reply 2 |
141 | 147 |
|
142 | | - test test test bot reply 2 |
| 148 | + **gpt-4:** |
143 | 149 |
|
144 | | - **ai_sharer:** |
| 150 | + test test test bot reply 2 |
145 | 151 |
|
146 | | - test test test user reply 3 |
| 152 | + **ai_sharer:** |
147 | 153 |
|
148 | | - **gpt-4:** |
| 154 | + test test test user reply 3 |
149 | 155 |
|
150 | | - test test test bot reply 3 |
151 | | - </details> |
152 | | - TEXT |
| 156 | + **gpt-4:** |
153 | 157 |
|
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 |
155 | 165 | end |
156 | 166 | end |
0 commit comments