Skip to content

Commit

Permalink
Fix direct_ifc_upload_spec test
Browse files Browse the repository at this point in the history
When the file input gets a file, it makes a request to the backend to
check for the file size. This request takes some time. The test was not
waiting for the request to complete before checking the form validity.

By adding a check on the validation message of the file input, we make
sure the test waits for the request to complete and the that form
validity check is correct.
  • Loading branch information
cbliard committed Sep 10, 2024
1 parent 36f73b7 commit 0871e8b
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@

page.attach_file("file", ifc_fixture.path, visible: :all)

expected_validation_message = I18n.t("activerecord.errors.messages.file_too_large", count: 1024)
expect(page).to have_field(type: "file", validation_message: expected_validation_message)

form_validity = page.evaluate_script <<~JS
document
.querySelector('#new_bim_ifc_models_ifc_model')
Expand Down

0 comments on commit 0871e8b

Please sign in to comment.