|
10 | 10 | let(:composer) { PageObjects::Components::Composer.new } |
11 | 11 | let(:popup) { PageObjects::Components::AiCaptionPopup.new } |
12 | 12 | let(:dialog) { PageObjects::Components::Dialog.new } |
13 | | - let(:file_path) { file_from_fixtures("logo.jpg", "images").path } |
| 13 | + let(:file_path) { plugin_file_from_fixtures("100x100.jpg").path } |
| 14 | + let(:captioned_image_path) do |
| 15 | + plugin_file_from_fixtures("An image of discobot in action.png").path |
| 16 | + end |
14 | 17 | let(:caption) do |
15 | 18 | "The image shows a stylized speech bubble icon with a multicolored border on a black background." |
16 | 19 | end |
|
123 | 126 | end |
124 | 127 |
|
125 | 128 | it "should not show a prompt when submitting a post with no captionable images uploaded" do |
126 | | - original_file_path = Rails.root.join("spec/fixtures/images/logo.jpg") |
127 | | - temp_file_path = Rails.root.join("spec/fixtures/images/An image of Discourse logo.jpg") |
128 | | - FileUtils.cp(original_file_path, temp_file_path) |
129 | 129 | visit("/latest") |
130 | 130 | page.find("#create-topic").click |
131 | | - attach_file([temp_file_path]) { composer.click_toolbar_button("upload") } |
| 131 | + attach_file([captioned_image_path]) { composer.click_toolbar_button("upload") } |
132 | 132 | wait_for { composer.has_no_in_progress_uploads? } |
133 | 133 | composer.fill_title("I love using Discourse! It is my favorite forum software") |
134 | 134 | composer.create |
|
150 | 150 | end |
151 | 151 | end |
152 | 152 |
|
153 | | - context "when the user preference is enabled" do |
154 | | - before { user.user_option.update!(auto_image_caption: true) } |
155 | | - |
156 | | - skip "TODO: Fix auto_image_caption user option not present in testing environment?" do |
157 | | - it "should auto caption the image after uploading" do |
158 | | - DiscourseAi::Completions::Llm.with_prepared_responses([caption]) do |
159 | | - visit("/latest") |
160 | | - page.find("#create-topic").click |
161 | | - attach_file([Rails.root.join("spec/fixtures/images/logo.jpg")]) do |
162 | | - composer.click_toolbar_button("upload") |
163 | | - end |
164 | | - wait_for { composer.has_no_in_progress_uploads? } |
165 | | - wait_for { page.find(".image-wrapper img")["alt"] == caption_with_attrs } |
166 | | - expect(page.find(".image-wrapper img")["alt"]).to eq(caption_with_attrs) |
167 | | - end |
168 | | - end |
169 | | - end |
170 | | - end |
171 | | - |
172 | 153 | context "when a post has no uploads" do |
173 | 154 | before { user.user_option.update!(auto_image_caption: true) } |
174 | 155 |
|
|
0 commit comments