Use JavaScript in tests opening modal dialogs
This way we reproduce the user experience in the tests, and we can make sure modal dialogs open when we expect it.
This commit is contained in:
@@ -95,37 +95,37 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
|
||||
end
|
||||
|
||||
context "Destroy" do
|
||||
scenario "Should show success notice after successful document upload" do
|
||||
scenario "Should show success notice after successful document upload", :js do
|
||||
login_as documentable.author
|
||||
|
||||
visit send(documentable_path, arguments)
|
||||
|
||||
within "#document_#{document.id}" do
|
||||
click_on "Delete document"
|
||||
accept_confirm { click_link "Delete document" }
|
||||
end
|
||||
|
||||
expect(page).to have_content "Document was deleted successfully."
|
||||
end
|
||||
|
||||
scenario "Should hide documents tab if there is no documents" do
|
||||
scenario "Should hide documents tab if there is no documents", :js do
|
||||
login_as documentable.author
|
||||
|
||||
visit send(documentable_path, arguments)
|
||||
|
||||
within "#document_#{document.id}" do
|
||||
click_on "Delete document"
|
||||
accept_confirm { click_link "Delete document" }
|
||||
end
|
||||
|
||||
expect(page).not_to have_content "Documents (0)"
|
||||
end
|
||||
|
||||
scenario "Should redirect to documentable path after successful deletion" do
|
||||
scenario "Should redirect to documentable path after successful deletion", :js do
|
||||
login_as documentable.author
|
||||
|
||||
visit send(documentable_path, arguments)
|
||||
|
||||
within "#document_#{document.id}" do
|
||||
click_on "Delete document"
|
||||
accept_confirm { click_link "Delete document" }
|
||||
end
|
||||
|
||||
within "##{ActionView::RecordIdentifier.dom_id(documentable)}" do
|
||||
|
||||
Reference in New Issue
Block a user