Check the DOM after attaching file has succeeded
We were checking `expect_document_has_title(0, "My Title")`, which was already true before the AJAX request generated by `attach_file` had finished. That meant the AJAX request sometimes was handled after this test had finished, affecting the following test and causing it to fail because its cookie was overwritten and so `current_user` was set to `nil`. In the test checking the filename is present, a similar scenario was taking place: we were updating the `.file-name` element in the `change` event of `fileupload` (using `App.Documentable.setFilename`); that is, when the AJAX request started. And so the test passed before the request was finished, causing the same issue.
This commit is contained in:
@@ -80,6 +80,8 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
Rails.root.join("spec/fixtures/files/empty.pdf"),
|
||||
make_visible: true
|
||||
)
|
||||
|
||||
expect(page).to have_css ".loading-bar.complete"
|
||||
end
|
||||
|
||||
expect(page).to have_css ".file-name", text: "empty.pdf"
|
||||
@@ -110,6 +112,8 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na
|
||||
Rails.root.join("spec/fixtures/files/empty.pdf"),
|
||||
make_visible: true
|
||||
)
|
||||
|
||||
expect(page).to have_css ".loading-bar.complete"
|
||||
end
|
||||
|
||||
expect_document_has_title(0, "My Title")
|
||||
|
||||
Reference in New Issue
Block a user