Skip to content

Commit

Permalink
[#57704] Resolve pending spec in direct_ifc_upload_spec.rb (#16664)
Browse files Browse the repository at this point in the history
https://community.openproject.org/work_packages/57704

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.

---------

Co-authored-by: Christophe Bliard <[email protected]>
  • Loading branch information
akabiru and cbliard authored Sep 10, 2024
1 parent c0b1ae4 commit e52da85
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@

context "when the file size exceeds the allowed maximum", with_settings: { attachment_max_size: 1 } do
it "invalidates the form via JavaScript preventing submission" do
pending "This test is currently flaky due to an unknown reason"

visit new_bcf_project_ifc_model_path(project_id: project.identifier)

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 e52da85

Please sign in to comment.