Wait for the image actually uploaded and removed again

This commit is contained in:
Benjamin Neff 2018-07-15 21:12:52 +02:00
parent 80bc90afa9
commit d06ef4505c
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 5 additions and 0 deletions

View file

@ -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|

View file

@ -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