Submit the form after the image is attached
We were submitting the form without checking the AJAX request to attach the image had finished, so sometimes two requests were executed at the same time. Sometimes this made InvisibleCaptcha to go crazy and report the form was submitted too quickly. Checking the first AJAX request has finished before submitting the form solves the problem.
This commit is contained in:
@@ -182,6 +182,8 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
|||||||
Rails.root.join("spec/fixtures/files/clippy.jpg")
|
Rails.root.join("spec/fixtures/files/clippy.jpg")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
expect(page).to have_selector ".loading-bar.complete"
|
||||||
|
|
||||||
click_on submit_button
|
click_on submit_button
|
||||||
|
|
||||||
expect(page).to have_content imageable_success_notice
|
expect(page).to have_content imageable_success_notice
|
||||||
@@ -197,6 +199,8 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p
|
|||||||
Rails.root.join("spec/fixtures/files/clippy.jpg")
|
Rails.root.join("spec/fixtures/files/clippy.jpg")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
expect(page).to have_selector ".loading-bar.complete"
|
||||||
|
|
||||||
click_on submit_button
|
click_on submit_button
|
||||||
imageable_redirected_to_resource_show_or_navigate_to
|
imageable_redirected_to_resource_show_or_navigate_to
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user