Merge pull request #1465 from basecamp/flavorjones/fix-smoke-test
test: Fix the flaky smoke test on attachments
This commit is contained in:
@@ -22,11 +22,17 @@ class SmokeTest < ApplicationSystemTestCase
|
||||
click_on "Upload file"
|
||||
end
|
||||
|
||||
assert_image_figure_attachment content_type: "image/jpeg", caption: "moon.jpg"
|
||||
within("form lexxy-editor figure.attachment[data-content-type='image/jpeg']") do
|
||||
assert_selector "img[src*='/rails/active_storage']"
|
||||
assert_selector "figcaption input[placeholder='moon.jpg']"
|
||||
end
|
||||
|
||||
click_on "Post this comment"
|
||||
|
||||
assert_image_figure_attachment content_type: "image/jpeg", caption: "moon.jpg"
|
||||
within("action-text-attachment") do
|
||||
assert_selector "a img[src*='/rails/active_storage']"
|
||||
assert_selector "figcaption span.attachment__name", text: "moon.jpg"
|
||||
end
|
||||
end
|
||||
|
||||
test "dismissing notifications" do
|
||||
@@ -53,16 +59,4 @@ class SmokeTest < ApplicationSystemTestCase
|
||||
editor_element.set with
|
||||
page.execute_script("arguments[0].value = '#{with}'", editor_element)
|
||||
end
|
||||
|
||||
def assert_figure_attachment(content_type:, &block)
|
||||
figure = find("figure.attachment[data-content-type='#{content_type}']")
|
||||
within(figure, &block) if block_given?
|
||||
end
|
||||
|
||||
def assert_image_figure_attachment(content_type: "image/png", caption:)
|
||||
assert_figure_attachment(content_type: content_type) do
|
||||
assert_selector "img[src*='/rails/active_storage']", wait: 10
|
||||
assert_selector "figcaption input[placeholder='#{caption}']", wait: 10
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user