Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix flaky spec for the /about admin config area (#27697)

Osama Sayegh7c12b75a5ccb
diff --git a/spec/system/admin_about_config_area_spec.rb b/spec/system/admin_about_config_area_spec.rb
index 44a5c90a5c1..be62a78afa5 100644
--- a/spec/system/admin_about_config_area_spec.rb
+++ b/spec/system/admin_about_config_area_spec.rb
@@ -38,7 +38,7 @@ describe "Admin About Config Area Page", type: :system do
expect(config_area.general_settings_section.community_description_editor.value).to eq(
"this is an extended description for my forums",
)
- expect(config_area.general_settings_section.banner_image_uploader).to have_uploaded_picture
+ expect(config_area.general_settings_section.banner_image_uploader).to have_uploaded_image
expect(config_area.contact_information_section.community_owner_input.value).to eq("kitty")
expect(config_area.contact_information_section.contact_email_input.value).to eq(
@@ -79,6 +79,7 @@ describe "Admin About Config Area Page", type: :system do
with: "here's an extended description for the **community**",
)
config_area.general_settings_section.banner_image_uploader.select_image(image_file.path)
+ expect(config_area.general_settings_section.banner_image_uploader).to have_uploaded_image
config_area.general_settings_section.save_button.click
expect(config_area.general_settings_section).to have_saved_successfully
diff --git a/spec/system/page_objects/components/uppy_image_uploader.rb b/spec/system/page_objects/components/uppy_image_uploader.rb
index 1ecf69c6504..e5b1c1fcb06 100644
--- a/spec/system/page_objects/components/uppy_image_uploader.rb
+++ b/spec/system/page_objects/components/uppy_image_uploader.rb
@@ -11,8 +11,12 @@ module PageObjects
attach_file(path) { @element.find("label.btn-default").click }
end
- def has_uploaded_picture?
- @element.has_css?(".uploaded-image-preview")
+ def has_uploaded_image?
+ # if there's a delete button (.btn-danger), then there must be an
+ # uploaded image.
+ # allow up to 10 seconds for the upload to finish in case this is
+ # called immediately after selecting an image.
+ @element.has_css?(".btn-danger", wait: 10)
end
end
end