Specify we're testing validation on the server

Testing the validation on the server side doesn't work with chromedriver
because HTML valdations result in the browser not even submitting the
form, so we're adding a `:no_js` tag to indicate we deliberately choose
to use the Rack driver.

The following test checking client side validation passes on my machine
but fails on Github Actions:

```
scenario "Validates price formats on the client side", :js do
  investment.update!(visible_to_valuators: true)

  visit edit_valuation_budget_budget_investment_path(budget, investment)

  fill_in "Price (€)", with: "12345,98"
  click_button "Save changes"

  validation_message = find_field("Price (€)").native.attribute("validationMessage")

  expect(validation_message).to be_present
end
```
This commit is contained in:
Javi Martín
2021-03-27 14:43:14 +01:00
parent fb6e4d6c08
commit 0fcb97a78f

View File

@@ -442,17 +442,13 @@ describe "Valuation budget investments" do
end end
end end
scenario "Validates price formats" do scenario "Validates price formats on the server side", :no_js do
investment.update!(visible_to_valuators: true) investment.update!(visible_to_valuators: true)
visit valuation_budget_budget_investments_path(budget) visit edit_valuation_budget_budget_investment_path(budget, investment)
within("#budget_investment_#{investment.id}") do fill_in "Price (€)", with: "12345,98"
click_link "Edit dossier" fill_in "Cost during the first year (€) (optional, data not public)", with: "9876.6"
end
fill_in "budget_investment_price", with: "12345,98"
fill_in "budget_investment_price_first_year", with: "9876.6"
click_button "Save changes" click_button "Save changes"
expect(page).to have_content("2 errors") expect(page).to have_content("2 errors")