Commit Graph

20241 Commits

Author SHA1 Message Date
taitus
11f09c281c Move test for check metadata to nested documentable system 2025-06-09 15:23:59 +02:00
taitus
9e805d95de Unify tests from "Only for edit path" describe in order to reduce duplicated code 2025-06-09 15:23:59 +02:00
taitus
2420f27704 Unify tests when removing documents 2025-06-09 15:23:59 +02:00
taitus
59c61d02cc Remove redundant tests from "Only for edit path" describe
These tests already tested in previous tests.
2025-06-06 17:18:15 +02:00
taitus
28e9832c40 Unify tests in order to remove duplicated code
Note that we are removing a specific "context" that can be replaced
with an "if" in the previous spec.
2025-06-06 17:18:15 +02:00
taitus
b7025a8135 Remove "outdated" comment
Since commit 23682fadd8, we have had the comment:
> # Review
> # Doble check why the file is stored with a name different to empty.pdf

This might be outdated.
2025-06-06 17:18:15 +02:00
taitus
afdf65dec9 Remove unnecessary tests and expectations related with loading-bar
These expectations are already covered by attach_new_file, so they are no longer needed:
>  expect(page).to have_css ".loading-bar.complete"

We can remove the tests:
> "Should update loading bar style after invalid file upload"
because the expectation:
> expect(page).to have_css ".loading-bar.errors"
It is already tested in "Should not update document cached_attachment field after invalid file upload"
2025-06-06 17:18:15 +02:00
taitus
88ba548343 Unify fill_in field in one line 2025-06-06 17:18:15 +02:00
taitus
e6089c2b63 Remove expect_document_has_title method
I think tests are now clearer by using have_field.

Note that I have remove the within ".document-fields" because there is
only one document.
2025-06-06 17:18:15 +02:00
taitus
d7581955f8 Remove duplicated code in imageable and documentable attach file methods 2025-06-06 17:18:15 +02:00
taitus
82296a33e2 Use documentable_attach_new_file method where possible
Use this commit to unify two similar specs.
2025-06-06 17:18:15 +02:00
taitus
64c1c59a7a Unify tests related with shows or hides max documents warning 2025-06-06 17:18:15 +02:00
taitus
a4e7b70227 Unify tests related with shows or hides new document link 2025-06-06 17:18:15 +02:00
taitus
82dac1225c Simplify tests by setting "max documents allowed" to 1
Note that this commit also applies a similar change to the
imageable_attach_new_file method by removing an unnecessary variable.

In order to testing with more than 1 max documents allowed we
keep one test with this value.
2025-06-06 17:18:15 +02:00
taitus
addda0c773 Unify duplicated methods in common_actions folder
Replaced the user with a level_two one in the "Default whole city" test to
bypass the full name requirement, which only applies to unverified users.
2025-06-06 17:07:50 +02:00
taitus
2cc23309b8 Unify attachables methods 2025-06-06 16:00:16 +02:00
taitus
e7c5b03d8c Extract edit proposals from shared nested documentable to system specs
We can remove shared nested documentable file because has not references.
2025-06-06 16:00:15 +02:00
taitus
979171ec45 Extract proposals from shared nested documentable to system specs
Removed the now-unused 'documentable_fill_new_valid_proposal' method
from common actions.

Note that it does not seem necessary to create an administrator with the user, as was
done in the original shared example. Also, as in the previous commit, it appears that
we do not need to set the user as the author when creating the documentable.

Also removed the documentable_redirected_to_resource_show_or_navigate_to method,
which was only used for the :proposal factory but was not necessary.
- In the "Proposal new" case (this commit), after submitting the form we are
redirected to the "created" page, where the link "Not now, go to my proposal"
does not appear. This caused the method to always raise a
Capybara::ElementNotFound and return nil.

Instead, this "created" page already displays a preview of the proposal
and a link to publish it. Since we can verify that the proposal was created
successfully here, no redirection or click is needed.

- In the "Proposal edit" case (next commit), the user is redirected directly
to the proposal's "show" page after update, so again, the method is
unnecessary and has been removed.
2025-06-06 15:56:27 +02:00
taitus
12c1d77061 Extract management_budget_investment from shared nested documentable spec to system specs
Replaced 'login_as' with 'do_login_for' using 'management: management_section?' to
handle login requirements correctly for each context.

Also removed the now-unused 'documentable_fill_new_valid_budget_investment' helper
from common actions.

Note that it does not seem necessary to create an administrator with the user, as was
done in the original shared example. Also, as in the previous commit, it appears that
we do not need to set the user as the author when creating the documentable.

While reviewing this, we also noticed that the create(:administrator, user: user) call
was unnecessarily included in the nested_imageable system spec in commit cdfaec5217 when
the path is a management section. So we use this commit to remove the unnecessary condition.
2025-06-06 15:56:27 +02:00
taitus
b7adf760f6 Extract budget_investment from shared nested documentable spec to system specs
Make 'path', 'submit_button_text' and 'notice_text' dynamic based on
the factory.

Also adjusted the user. Budget investments require a level 2 user but do not need to be
an administrator.

Copied and renamed the 'documentable_fill_new_valid_budget_investment' method from
common actions, and introduced a 'fill_in_required_fields' method to manage multiple factories.

Added the two tests that were conditionally skipped in the shared example using
'unless: documentable_factory_name == "dashboard_action"', but omitted the call to
'documentable_redirected_to_resource_show_or_navigate_to', since it only applies to
proposals.

Note that when we create the documentable seems do not need use the user as author.
2025-06-06 15:56:25 +02:00
taitus
4d8a337e8a Extract dashboard_action from shared nested documentable spec to system specs
Removed 'documentable_path_arguments' and 'management'
parameters because they are not used by dashboard_action.

Also moved and renamed the 'documentable_fill_new_valid_dashboard_action' method
from the common actions helper to this file, since it is now only used here.

Hardcoded 'path', 'submit_button_text', and 'notice_text' for dashboard_action.
These remain fixed for now until dynamic values are required in future commits.
2025-06-06 15:48:46 +02:00
Sebastia
40625e9455 Merge pull request #5984 from consuldemocracy/dependabot/bundler/rack-2.2.14
Bump rack from 2.2.13 to 2.2.14
2025-05-09 10:23:43 +02:00
dependabot[bot]
60e6f6a3b0 Bump rack from 2.2.13 to 2.2.14
Bumps [rack](https://github.com/rack/rack) from 2.2.13 to 2.2.14.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/v2.2.13...v2.2.14)

---
updated-dependencies:
- dependency-name: rack
  dependency-version: 2.2.14
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-08 19:25:00 +00:00
Sebastia
d9271c9a43 Merge pull request #5966 from consuldemocracy/remove-foundation-rails-helper
Vendor foundation_rails_helper/form_builder.rb to drop gem dependency
2025-05-06 18:02:13 +02:00
taitus
e662c704ac Vendor Foundation form builder to remove gem dependency
The "foundation_rails_helper" gem is no longer maintained and is
incompatible with Rails 7.1. To avoid blocking the upgrade, we've vendored
the vendor/foundation_rails_helper/form_builder.rb as a copy of the
original FormBuilder class.

To mantain compatibility with auto_labels and button_class variables, that
are used in the original builder, we are overwriting in the foundation
form builder initializer.

The gem has been removed from the Gemfile and replaced with this vendored
fallback. This workaround is safe to remove once legacy Foundation CSS
support is dropped.

All vendored code retains the original MIT license and attribution.
2025-05-06 17:07:08 +02:00
Sebastia
e93d303b1e Merge pull request #5867 from consuldemocracy/dependabot/bundler/ros-apartment-3.2.0
Bump ros-apartment from 2.11.0 to 3.2.0
2025-05-05 16:42:04 +02:00
Javi Martín
2ed07ded67 Merge pull request #5969 from consuldemocracy/dependabot/bundler/nokogiri-1.18.8
Bump nokogiri from 1.18.4 to 1.18.8
2025-05-05 15:18:24 +02:00
Javi Martín
b2a81a8784 Merge pull request #5971 from consuldemocracy/dependabot/bundler/net-imap-0.5.7
Bump net-imap from 0.5.6 to 0.5.7
2025-05-05 15:15:43 +02:00
Sebastia
391d924ec0 Merge pull request #5830 from consuldemocracy/dependabot/bundler/globalize-7.0.0
Bump globalize from 6.3.0 to 7.0.0
2025-04-30 14:45:28 +02:00
dependabot[bot]
efd7317adb Bump net-imap from 0.5.6 to 0.5.7
Bumps [net-imap](https://github.com/ruby/net-imap) from 0.5.6 to 0.5.7.
- [Release notes](https://github.com/ruby/net-imap/releases)
- [Commits](https://github.com/ruby/net-imap/compare/v0.5.6...v0.5.7)

---
updated-dependencies:
- dependency-name: net-imap
  dependency-version: 0.5.7
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-29 01:54:51 +00:00
dependabot[bot]
b02bd9b117 Bump nokogiri from 1.18.4 to 1.18.8
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.18.4 to 1.18.8.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.4...v1.18.8)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-version: 1.18.8
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-22 04:55:49 +00:00
taitus
b07e429356 Remove monkey patch for connected_to in Rails 7
ros-apartment 3.0.0+ includes official support for connection handling in Rails 7,
so we no longer need to override `ActiveRecord::ConnectionHandling#connected_to`.

References: PR #194 and #243 in ros-apartment
2025-04-11 15:41:59 +02:00
dependabot[bot]
4d256b8a4e Bump ros-apartment from 2.11.0 to 3.2.0
Note we aren't updating concurrent-ruby (which Dependabot would have
updated) due to an incompatibility with Rails 7.0.

Bumps [ros-apartment](https://github.com/rails-on-services/apartment) from 2.11.0 to 3.2.0.
- [Release notes](https://github.com/rails-on-services/apartment/releases)
- [Changelog](https://github.com/rails-on-services/apartment/blob/development/legacy_CHANGELOG.md)
- [Commits](https://github.com/rails-on-services/apartment/compare/2.11.0...v3.2.0)

---
updated-dependencies:
- dependency-name: ros-apartment
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-11 15:41:45 +02:00
dependabot[bot]
6e90b0cdf4 Bump globalize from 6.3.0 to 7.0.0
Note we aren't updating concurrent-ruby (which Dependabot would have
updated) due to an incompatibility with Rails 7.0.

Bumps [globalize](https://github.com/globalize/globalize) from 6.3.0 to 7.0.0.
- [Release notes](https://github.com/globalize/globalize/releases)
- [Changelog](https://github.com/globalize/globalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/globalize/globalize/compare/v6.3.0...v7.0.0)

---
updated-dependencies:
- dependency-name: globalize
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-11 15:20:37 +02:00
Sebastia
7aeae565df Merge pull request #5949 from consuldemocracy/release_2.3.1
Release version 2.3.1
2025-04-08 16:54:54 +02:00
taitus
bd0c880331 Release version 2.3.1 2025-04-08 16:41:48 +02:00
Sebastia
293f6974bb Merge pull request #5956 from consuldemocracy/i18n_crowdin
Update translations from Crowdin
2025-04-07 15:55:27 +02:00
taitus
30da0bc626 Update translations from Crowdin 2025-04-07 15:41:49 +02:00
Javi Martín
77c78d0507 Merge pull request #5954 from consuldemocracy/fix_crowdin_excluded_language
Fix language code for Spanish in Crowdin config
2025-04-04 12:32:15 +02:00
Javi Martín
715bc5ef05 Fix language code for Spanish in Crowdin config
We were using `es`, which is the code we use in `config/locales/`, but
Crowdin actually uses `es-ES`.
2025-04-04 12:22:52 +02:00
Javi Martín
3f9ae66e94 Merge pull request #5951 from consuldemocracy/labels_instead_of_placeholders
Reduce the number of fields with placeholders
2025-04-03 15:33:17 +02:00
Javi Martín
9dee0d9824 Use a hint instead of a placeholder in retire explanation
A hint is much easier to read than a placeholder.
2025-04-03 15:01:01 +02:00
Javi Martín
50e8153583 Use a legend instead of a label to group option fields
Using a label for a non-existent element ID was invalid HTML.
2025-04-03 15:01:01 +02:00
Javi Martín
c6f1974c45 Use labels in nested option fields
We were using a placeholder, which is way less accessible than a label.

One issue here (which also happened before, but is now more obvious) is
that, when adding several options, there will be many fields with the
same label.

Another issue is that, for some languages, we're using texts like "Add a
closed answer", which might be confusing because we might be editing an
existing answer. The proper solution would probably be using the text
"Option 1", "Option 2", ... I'm not doing so right now because I'm not
sure that's a good option and because changing the text would mean
losing the existing translations.
2025-04-03 15:01:01 +02:00
Javi Martín
9308189a00 Use number fields to enter number of votes
This way the fields are easier to use, and we can get rid of the
placeholders.

Note we're simplifying the `answer_result_value` in order to make it
easier to return `0` instead of `nil` when the field is empty.

Also note there's a small change of behavior here; previously, these
fields were empty by default, and now their value is `0` by default, so
blindly clicking the "Save" button would send `0` instead of an empty
value. I don't think it's a big deal, though, but we need to keep that
in mind.
2025-04-03 15:01:01 +02:00
Javi Martín
ff3ada780d Use fieldsets and legends in officing results form
We were using <h3> tags instead of a combination of <fieldset> and
<legend> tags to group fields together.
2025-04-03 15:01:01 +02:00
Javi Martín
31f413de61 Use labels in officing results form
Back when we added all the missing labels (changes that we merged in
commit c34cab282), we forgot about fields which had placeholdes, since
Axe doesn't report an error when there are placeholders but there aren't
labels.

In this case, we were using an invalid <label> tag for the question
options, and <h3> tags as labels for the votes.

Using standard labels solves the issue.
2025-04-03 15:00:46 +02:00
Javi Martín
1632990838 Extract component to render officing results form
In a couple of commits we're going to add some styles for this form, and
it's easier to know where to add these styles when there's a component.
2025-04-03 15:00:12 +02:00
Javi Martín
962aa388df Remove redundant placeholders in attachment fields
Saying that we're supposed to introduce a descriptive title in a field
labelled as "Title" is redundant. Besides, the text of the placeholder
was barely distinguishable, making it harder to fill in the form.
2025-04-03 15:00:12 +02:00
Javi Martín
bf06894043 Merge pull request #5950 from consuldemocracy/more_missing_expectations
Reduce the number of flaky tests
2025-04-03 13:37:42 +02:00