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