Commit Graph

17 Commits

Author SHA1 Message Date
Javi Martín
448775a5e9 Remove unused Campaign model
The only way to use campaigns is to manually insert them in the
database, which IMHO isn't very practical.

We're going to change every piece of code that generates an Ahoy event
and, in this case, the easiest way to change the Campaing model so it
doesn't use Ahoy events is to simply remove it.

Note we're keeping the database tables until we release a new version,
just in case some Consul Democracy installations are using them. We'll
inform in the release notes that we'll remove the campaigns table after
the release, so existing installations using the `campaigns` table can
move the data somewhere else before we remove the table.
2024-05-09 14:28:32 +02:00
Javi Martín
772be11525 Fix budget investments chart in admin stats
The JavaScript required to display the chart wasn't loaded on the admin
stats page.

We're not adding a test because we're going to move the budgets graph to
a different page on the pull request containing this commit.

Note we're changing the "Go back" link, since using a turbolinks refresh
broke this link when using the Chromium browser. Besides, there was an
inconsistency where some of the "Go back" links in admin stats pointed
to the admin stats page but other links pointed to `:back`.
2024-05-09 14:28:31 +02:00
taitus
1ea5b699cf Fix flaky spec in budget supports admin stats
The test that was not passing sometimes since commit 915999db4 because
we no longer created the budget before visiting the page that loads it.
So now we're forcing its creation with `let!`.
2023-02-21 19:35:43 +01:00
Javi Martín
b536a7cb77 Extract component for supporting budget admin stats
This is consistent with the component for balloting stats. We're about
to change both components, and the changes are easier to follow if
they're similar.

We're also using consistent names in methods.
2023-02-20 14:21:22 +01:00
Javi Martín
76b08398cf Extract component for balloting budget admin stats
We're also moving the tests, but we're keeping one system test in order
to test the controller and the navigation to get to this page.

Note we're slightly changing the order of the methods in the component;
the order of the instance variables was `user_`, `vote_`, `vote_`,
`user_`, which was hard to follow.
2023-02-20 14:20:50 +01:00
Javi Martín
915999db4a Simplify data in budget admin stats tests
We don't need groups to create headings since commit 20b1085dc, and
`let!` was used as a substitute for instance variables in commit
91c21b098, but it isn't necessary in this case.
2023-02-20 14:20:50 +01:00
Javi Martín
74ca332989 Add expectations to check requests are complete
We want to make sure the request is finished after clicking a button and
before visiting a different page, so we need to check the page has
changed.

Usually this shouldn't be a problem because most of our forms are sent
with regular HTTP requests instead of AJAX ones, so the `visit` method
wouldn't be called before the request is finished.

However, we're experiencing problems with certain version of
Chromedriver, and in general it's a good practice because we might send
forms using AJAX/Turbolinks in the future.
2021-04-16 14:35:03 +02:00
Javi Martín
a7664ad817 Query the database before visiting a page in tests
We can assign query results to variables and so we avoid querying the
database after starting the browser.
2021-04-16 14:33:26 +02:00
Javi Martín
994745839b Simplify tests checking dates are present
When we create a record like a debate or an event and we check the page
content, we want to make sure that today's date is present, since it's
the date where the record is supposed to have been created.

This way we avoid querying the database after the browser has been
started.
2021-04-16 14:33:26 +02:00
Javi Martín
a8c4676240 Simplify system tests re-fetching records
It's strange to create records without assigning them to a variable and
then query the database to fetch the very same records. Assigning them
to a variable makes the tests easier to understand.

Besides, this way we avoid querying the database after the browser has
started.
2021-04-16 14:33:26 +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
9cfcbf2f3b Use visible texts in tests
Content like lowercase letters with `text-transform: uppercase` or
spaces after elements with `display: block` or "You're on page:" are not
seen that way by users with a browser supporting CSS.

So we're testing what most users actually experience.
2021-04-07 14:41:06 +02:00
Javi Martín
b2bb0c7143 Remove unnecessary code to visit a URL
Visiting a URL before creating data in system tests might cause
concurrency issues if we start using a driver supporting JavaScript.
2021-04-07 14:32:49 +02:00
Javi Martín
5831f190ba Fix "Go back" link in stat graphs
The link appeared twice when visiting stats for a budget's supporting
phase.
2021-04-02 20:56:09 +02:00
Senén Rodero Rodríguez
9b2d349e21 Create SDG stats page 2021-01-23 12:23:29 +01:00
Javi Martín
3da4ee00b8 Simplify tests requiring admin login
We were repeating the same code over and over (with a few variants) to
setup tests which require an administrator. We can use a tag and
simplify the code.
2020-12-02 15:33:19 +01: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