Save/Update product image test

This commit is contained in:
Matt-Yorkley
2017-12-31 16:38:53 +00:00
parent 526317c373
commit 23deb37876

View File

@@ -781,8 +781,8 @@ feature %q{
# Shows new image when finished
expect(page).to have_css "img.preview"
new_image_src = page.find("img.preview")['src']
expect(old_image_src) != new_image_src
@new_image_src = page.find("img.preview")['src']
expect(old_image_src) != @new_image_src
# Close modal
page.find("a.close-reveal-modal").click
@@ -791,9 +791,31 @@ feature %q{
expect(page).to_not have_selector "div.reveal-modal.product-image-upload"
within "table#listing_products tr#p_#{product.id}" do
# Updated thumbnail is shown in image column
new_thumb_src = page.find("a.image-modal img")['src']
expect(@old_thumb_src) != new_thumb_src
# New thumbnail is shown in image column
@new_thumb_src = page.find("a.image-modal img")['src']
expect(@old_thumb_src) != @new_thumb_src
page.find("a.image-modal").trigger('click')
end
expect(page).to have_selector "div.reveal-modal.product-image-upload"
within "div.reveal-modal.product-image-upload" do
# Upload another image file
attach_file 'image-upload', Rails.root.join("public/422.jpg"), visible: false
# Overwrites existing image
expect(page).to have_css "img.preview"
newer_image_src = page.find("img.preview")['src']
expect(@new_image_src) != newer_image_src
page.find("a.close-reveal-modal").click
end
within "table#listing_products tr#p_#{product.id}" do
# Newer thumbnail is shown in image column
newer_thumb_src = page.find("a.image-modal img")['src']
expect(@new_thumb_src) != newer_thumb_src
end
end
end