Commit Graph

15 Commits

Author SHA1 Message Date
Javi Martín
5e7b5ccfd3 Add and apply Capybara/ClickLinkOrButtonStyle rule
This rule was added in rubocop-capybara 2.19.0. We were following it
most of the time.
2023-11-08 14:18:16 +01:00
Javi Martín
a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00
Javi Martín
c8270d58bd Add and apply Rails/DurationArithmetic rubocop rule
This rule was added in rubocop-rails 2.13.0. We were already applying it
most of the time.
2022-08-24 23:24:36 +02:00
Javi Martín
a5c66c7281 Use buttons instead of links to hide content
We're continuing to replace links with buttons, for the reasons
explained in commit 5311daadf.

Since we're using the admin action component, we can also simplify the
logic handling the confirmation message.

In order to avoid duplicate IDs when generating buttons to block the
same author more than once in a page, we're including the record dom_id
in the ID of the button to block an author.
2021-12-30 15:50:03 +01:00
Javi Martín
600a2bd4c2 Use a button instead of a link to block users
We're continuing to replace links with buttons, for the reasons
explained in commit 5311daadf.

We're also adding an ARIA label since on the same page there might be
several links to block different users.
2021-12-30 15:50:02 +01:00
rhian-cs
609e58cacb Update system specs with detailed confirmation alerts 2021-12-22 12:32:47 +01:00
Javi Martín
227a5868b8 Use order links in moderation section
Using order links in this case causes an unusual interface, where we
show filter links, then information about the number of results, and
then order links.

Whether or not this makes sense needs to be confirmed with usability
tests. In any case, this is still way better than using `<select>`
fields which automatically change to a new page, since they cause
problems to keyboard users, are harder to select for touchscreen users,
might confuse screen reader users who will notice a form but no way to
submit it, and are not elements we generally use to let users choose the
order of the records.

For a more detailed explanation of these issues, check the commit
message in the commit "Use order links to sort comments and topics"
(just a few commits ago).
2021-06-28 00:15:08 +02:00
Javi Martín
55cf502e8f Fix typo in proposal notifications moderation test 2021-06-28 00:15:08 +02:00
Javi Martín
747da42972 Test the user's point of view in moderation specs
We were checking what happens in the database, but what's important is
what users experience after hiding content or blocking authors. Besides,
accessing the database in tests after the browser has started might lead
to database inconsistencies.
2021-04-15 16:27:19 +02:00
Javi Martín
92ddcb7aef Use JavaScript in system tests by default
JavaScript is used by about 98% of web users, so by testing without it
enabled, we're only testing that the application works for a very
reduced number of users.

We proceeded this way in the past because CONSUL started using Rails 4.2
and truncating the database between JavaScript tests with database
cleaner, which made these tests terribly slow.

When we upgraded to Rails 5.1 and introduced system tests, we started
using database transactions in JavaScript tests, making these tests much
faster. So now we can use JavaScript tests everywhere without critically
slowing down our test suite.
2021-04-07 14:41:06 +02:00
Javi Martín
23945c2a7c Use JavaScript in tests dealing with tabs
So what we write in the tests is close to what users experience.
2021-04-07 14:41:06 +02:00
Javi Martín
b2bc4d19f5 Use JavaScript in tests opening modal dialogs
This way we reproduce the user experience in the tests, and we can make
sure modal dialogs open when we expect it.
2021-04-07 14:41:06 +02:00
Javi Martín
5f0c422eb3 Explicitly use rack driver in notifications spec
The filter "Mark as viewed" doesn't work properly, so here's a case
where the test would fail with JavaScript not because the test is wrong,
but due to a bug.

For now we're keeping the test as it was, but eventually we'll have to
fix the bug.
2021-04-07 14:32:49 +02:00
Javi Martín
7127b46d9f Use have_current_path instead of include
Using `have_current_path`, Capybara waits until the condition is true,
while using `include` the expectation is evaluated immediately and so
tests might fail when using a driver supporting JavaScript.

Besides, using `have_current_path` the error message is more readable
when the test fails.
2021-04-07 14:32:49 +02:00
Javi Martín
9427f01442 Use system specs instead of feature specs
We get rid of database cleaner, and JavaScript tests are faster because
between tests we now rollback transactions instead of truncating the
database.
2020-04-24 15:43:54 +02:00