sul-dlss / happy-heron

Self-Deposit for the Stanford Digital Repository (SDR): H2 is a Rails web application enabling users to deposit scholarly content into SDR
Apache License 2.0
10 stars 2 forks source link

Test missing expected wrapper #3513

Closed jcoyne closed 1 month ago

jcoyne commented 2 months ago

Capybara gives this warning when running the tests:

Modal window with text `Deposit will be enabled once files have finished uploading` has been opened, but you didn't wrap your code into (`accept_prompt` | `dismiss_prompt` | `accept_confirm` | `dismiss_confirm` | `accept_alert`), accepting by default
justinlittman commented 1 month ago

This is caused by https://github.com/sul-dlss/happy-heron/blob/main/app/javascript/controllers/dropzone_controller.js#L148

It seems like a race condition in which the deposit button is being clicked before the file upload is completed.

But here's what's weird: You'd expect the test to fail (even if the alert is accepted by default) since the form submit should be stopped. (I verified that behavior running locally by adding a delay into the controller.) But the test completes successfully, indicating that the form was submitted. No idea how to account for this.

Unfortunately, I couldn't find anyway in capybara to handle an alert that might occur. The suggested wrappers handle when an alert must occur.

Open to other suggestions, otherwise we should just live with it.