diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index c5caf120c..ef9743694 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -127,7 +127,9 @@ end When /^I click to delete the first uploaded photo$/ do page.execute_script("$('#photodropzone .x').css('display', 'block');") + image_count = all(".publisher_photo img").count find("#photodropzone .x", match: :first).trigger "click" + page.assert_selector(".publisher_photo img", count: image_count - 1) end And /^I click on selector "([^"]*)"$/ do |selector| diff --git a/features/support/publishing_cuke_helpers.rb b/features/support/publishing_cuke_helpers.rb index 3fe3e4b59..2b78f8e97 100644 --- a/features/support/publishing_cuke_helpers.rb +++ b/features/support/publishing_cuke_helpers.rb @@ -14,10 +14,13 @@ module PublishingCukeHelpers def upload_file_with_publisher(path) page.execute_script(%q{$("input[name='qqfile']").css("opacity", '1');}) + image_count = all(".publisher_photo img").count with_scope("#publisher-textarea-wrapper") do attach_file("qqfile", Rails.root.join(path).to_s) # wait for the image to be ready page.assert_selector(".publisher_photo.loading", count: 0) + page.assert_selector(".publisher_photo img", count: image_count + 1) + page.assert_selector(".publisher_photo img.hidden", count: 0) end end