Commit Graph

16206 Commits

Author SHA1 Message Date
taitus
9e6c8bf5b3 Release version 1.3.0 2021-04-27 12:37:34 +02:00
Javi Martín
45448374e3 Merge pull request #4497 from consul/small_screen_footer
Fix footer overflow on small screens
2021-04-27 12:34:06 +02:00
Javi Martín
963511d4cc Fix footer overflow on small screens
On small screens, sometimes the bottom of the footer didn't have the
footer's background color.

I'm not sure why the `min-height` rule affects this outcome. However,
since this rule usually results in footer with quite a bit of empty
space at the bottom, we can simpliy remove the rule and use padding to
guarantee there's a bit of space between the text in the footer and the
bottom of the screen.
2021-04-26 19:57:31 +02:00
Javi Martín
50bf83d417 Merge pull request #4487 from consul/dependabot/bundler/oauth-0.5.6
Bump oauth from 0.5.4 to 0.5.6
2021-04-23 16:23:05 +02:00
dependabot[bot]
1e9f4a2448 Bump oauth from 0.5.4 to 0.5.6
Bumps [oauth](https://github.com/oauth-xx/oauth-ruby) from 0.5.4 to 0.5.6.
- [Release notes](https://github.com/oauth-xx/oauth-ruby/releases)
- [Changelog](https://github.com/oauth-xx/oauth-ruby/blob/master/HISTORY)
- [Commits](https://github.com/oauth-xx/oauth-ruby/compare/v0.5.4...v0.5.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-23 14:01:36 +00:00
Javi Martín
39dd039faf Merge pull request #4489 from consul/pronto_dependabot
Fix checkout in Pronto on Dependabot pull requests
2021-04-23 15:59:07 +02:00
Javi Martín
8fcb9560e0 Merge pull request #4478 from consul/update_posgres_docker
Use a maintained PostgreSQL version in Docker
2021-04-23 12:50:57 +02:00
Javi Martín
a6cda37113 Use environment variable for password in Docker
We were getting an error since we started using the postgres 9.6 image:

```
Attaching to app_1, database_1
database_1  | Error: Database is uninitialized and superuser password is not specified.
database_1  |        You must specify POSTGRES_PASSWORD to a non-empty value for the
database_1  |        superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
database_1  |
database_1  |        You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
database_1  |        connections without a password. This is *not* recommended.
database_1  |
database_1  |        See PostgreSQL documentation about "trust":
database_1  |        https://www.postgresql.org/docs/current/auth-trust.html
```
2021-04-23 12:23:17 +02:00
Javi Martín
a5eada79c0 Fix Pronto on Dependabot pull requests
As explained in "GitHub Actions: Workflows triggered by Dependabot PRs
will run with read-only permissions" [1], we need to consider Dependabot
pull requests as external pull requests.

[1] https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
2021-04-23 00:14:16 +02:00
Javi Martín
7378d2cd8d Update PostgreSQL dependency to version 9.5
Version 9.4 hasn't been maintained since February 2020, so we aren't
supporting it either. And we might start using `UPSERT` instead of
`find_or_create`, which was introduced in PostgreSQL 9.5.

We're still supporting PostgreSQL 9.5 even if it's also unmaintained
because it has only been officially unmaintained for a couple of months.
2021-04-21 19:08:21 +02:00
Javi Martín
01a1eb7f4d Use a maintained PostgreSQL version in Docker
Neither PostgreSQL version 9.4 nor version 9.5 are maintained anymore.
2021-04-21 19:08:21 +02:00
Javi Martín
972432ebd1 Merge pull request #4486 from consul/enable_sdg_processes
Make it easier for admins to enable SDG processes
2021-04-21 19:06:11 +02:00
Javi Martín
32a61f826c Make it easier for admins to enable SDG processes
In order to ensure compatibility with existing CONSUL installations, we
disabled all settings related to SDG. However, we also made it much
harder to enable SDG globally on the site, since administrators first
had to enable the SDG feature and then enable it for each process.

Most people will expect SDG is enabled for all processes once they
enable the SDG feature, so that's what we're doing. They can of course
disable specific processes should they wish to do so.
2021-04-21 18:37:54 +02:00
Javi Martín
24a4c46465 Merge pull request #4483 from consul/draft_budgets_text
Add draft info on unpublished budgets
2021-04-21 18:28:55 +02:00
Javi Martín
fc1a0f33e7 Add draft info on unpublished budgets
Before commit 28caabecd, it was clear which budgets were in draft mode
because their phase was "drafting".

Now the phase isn't "drafting" anymore, so we have to make it clear
somehow that the budget is a draft.

I'm using styles similar to the ones we added in commit 2f636eaf7 for
completed budgets but at the same time making them slightly different so
it's easy to differenciate completed and drafting budgets.
2021-04-21 17:12:12 +02:00
Javi Martín
0eedc7b6ab Use readable texts in admin budgets test
Particularly the line with `within "tr", text: "Finished budget" do` is
now easier to read.

This way we avoid a potential pitfall. Imagine that the factory which
creates a finished budget generated a budget with the name "COMPLETED
Budget 1". Then the test:

```
within "#budget_#{finished_budget.id}" do
  expect(page).to have_content("COMPLETED")
end
```

Would pass even if we didn't add the text "COMPLETED" anywhere else,
because it would be included in the name of the budget.
2021-04-21 17:12:12 +02:00
Javi Martín
c50e04e9cb Extact method to get the budget status HTML class 2021-04-21 17:12:12 +02:00
Javi Martín
9f671b9617 Extract method to get budget status text 2021-04-21 17:12:12 +02:00
Javi Martín
be10e1afb6 Merge pull request #4484 from consul/forks-pr-pronto
Fix checkout in Pronto on external pull requests
2021-04-21 17:11:26 +02:00
taitus
9272873cf8 Fix checkout in Pronto on external pull requests
Since the target branch was in a different repository, the action failed
since it couldn't find the reference.

The code here is based on a recent change in Pronto [1] and with a comparison
between the repo.url property of pull_request.head and pull_request.base
to determine if the pull request was created from a forked repository

[1] https://github.com/prontolabs/pronto/commit/4fe28418b6
2021-04-21 16:39:07 +02:00
Javi Martín
0654bcbad9 Merge pull request #4476 from consul/source_translations_typos
Fix source translations typos
2021-04-21 13:25:05 +02:00
Senén Rodero Rodríguez
10d77e021e Improve remote census translation
This translation was confusing for Crowdin users.
Translators were not sure about the direction of the data.
2021-04-17 11:04:25 +02:00
Javi Martín
3169f87e44 Merge pull request #4475 from consul/browser_tests_database
Reduce test database access after visiting a page
2021-04-16 15:57:58 +02:00
Javi Martín
3345dd67d9 Remove unnecessary in_browser clause
We only need to define one `in_browser`, which is the one opening the
session as an administrator.

This change is done to simplify the code, although there's a small
chance it might also make the test stop failing in our CI. Sometimes in
our CI the first `visit` in the `in_browser(:admin)` block fails for
unknown reasons, rendering a blank page.
2021-04-16 14:37:58 +02:00
Javi Martín
9890571091 Use login form in tests checking expired passwords
The controller provided by the `devise-security` gem which tests
password is expired does not execute the `before_action` we have in our
application controller. That means it doesn't set the current locale.

We were having issues in the tests checking this behavior if the
previous test had set the current locale to a different one. This meant
the process running the browser had one locale while the process running
the test had a different one, which resulted in a page in English (as
expected), only the flash message notifying users their password expired
was in a different language.

To reproduce this behavior, run:

```
rspec './spec/system/welcome_spec.rb[1:1:2:2:1]' spec/system/users_auth_spec.rb:623 --order defined
```

I'm not sure whether this is a bug or it's a problem with the tests. In
theory it might be possible to reproduce a similar behavior in
production due to what we mention about the controller not executing the
`set_current_locale` method. But I haven't been able to reproduce the
situation, particularly since the password expiration seems to be
checked exclusively at login time (that is, if you stay logged in for 10
years, your password doesn't seem to expire).

So for now I'm just making the tests pass by using the login form
instead of using `login_as`.
2021-04-16 14:37:58 +02:00
Javi Martín
47d75b4ec5 Remove redundant click in legislation spec
The link to edit the process is already present before clicking the
"All" link, which meant the test failed sometimes because Capybara might
try to click on the "Edit" link at the same time the page is changing
due to the click on the "All" link".

Due to this issue, this test has failed at least one in our CI [1].

[1] https://github.com/consul/consul/runs/2324773853
2021-04-16 14:37:58 +02:00
Javi Martín
8a2e159805 Simplify tests for investments tag cloud
It's true that previously we didn't display the tag cloud on all phases
and so we added a test checking we did on all phases.

However, doing so makes tests really slow and prone to database
inconsistencies because the alter the database after the process running
the browser has started.

So now we're using a random phase in these tests to solve this issue.

We're also removing the `login_as(admin) if budget.drafting?` line
because we removed the drafting phase in commit 28caabecd.
2021-04-16 14:37:58 +02:00
Javi Martín
42bc8eb4da Test the user experience in organization creation
So we check the message with the verification link is present and
administrators see the organization in the admin section.
2021-04-16 14:37:58 +02:00
Javi Martín
aff102325a Fix expectations for already existing content
We were checking content which was already present/absent before making
a certain request, so the expectations were not checking the request had
already finished. Our intention here is to check the page contents after
the request has finished.
2021-04-16 14:37:46 +02: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
2732c08f3d Simplify calls to have_current_path
In general, we shold check the contents of the page instead of the
current path, since the contents of the page are what users experience.

In one test, the only reason we check the current path additionally to
the contents of the page is to make sure we're still in the management
section.

Checking just that we avoid querying the database after starting the
browser.
2021-04-16 14:33:26 +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
fc32c767dd Split independent blocks of tests
This way we avoid modifying the database in the middle of a system test
(after we've started the browser), which can lead to database
inconsistencies.

In the case of the reclassification specs we're simply removing part of
the test because that part is already tested by other specs.
2021-04-16 14:33:26 +02:00
Javi Martín
405c6e6d14 Test data introduced from the user's point of view
Users don't care about database content; they care about what they see
on the screen.

Writing tests this way we also avoid potencial database inconsistencies
due to accessing the database after starting the browser.
2021-04-16 14:33:26 +02:00
Javi Martín
7b15cc290d Use human labels to fill in proposal form in tests
This way we make sure the label is correctly associated with a field.
2021-04-16 14:33:26 +02:00
Javi Martín
386771f2df Remove duplicate line 2021-04-16 14:33:26 +02:00
Javi Martín
5f6c9852c7 Check table rows content instead of database
Checking the database with methods like Activity.last does not test that
the record is present where it should be (first record of the table in
this case). In these tests there's only one record, though, so the order
doesn't matter that match.

However, calling methods like Activity.last generates a database query
after the process running the browser has been started, and this might
lead to inconsistent data.
2021-04-16 14:33:25 +02:00
Javi Martín
9f926de54e Refactor method to reply to comment in tests
We take the comment as a parameter instead of the user, since usually
people reply to comments and not to users.

We also remove one database query after the browser has started, since
we can use `debate_path(debate)`. It's also more clear why we're using
`debate_path` in the test; before these changes, we had to enter the
`reply_to` method to realize that we were replying on a debate.
2021-04-16 14:25:34 +02:00
Javi Martín
2458ca22c5 Use a more descriptive parameter name 2021-04-16 14:25:34 +02:00
Javi Martín
9db4fb593c Simplify tests switching to a new window 2021-04-16 14:25:34 +02:00
Javi Martín
73992b2c82 Test erased reason from the user's point of view
What users care about isn't the database; they care about that reason
being displayed when administrators check the reason.

This way we also avoid accessing the database after the process running
the browser has been started.
2021-04-16 14:25:34 +02:00
Javi Martín
c8df5e3af2 Remove redundant delete account test
This scenario is already tested in the management users spec: ""Delete a
level 2 user account from document verification page".
2021-04-16 14:25:34 +02:00
Javi Martín
b55f2ab85c Test slugs from the user's point of view
System tests are about user experience, so instead of checking the slug
has been updated in the database, we check whether the page can be
accessed using the slug.

Note the budget group test is a bit different because the name of the
group isn't present in the budget group page.
2021-04-16 14:25:34 +02:00
Javi Martín
dbf7de5787 Simplify accessing the valuation page
We already test the navigation in the valuation spec file.
2021-04-16 14:25:34 +02:00
Javi Martín
a586ba8069 Test restoring data from the user's point of view
We were checking the database, but users don't care about what's inside
the database; they care about what happens when they visit the page of a
record they've just restored.

This way we also avoid data inconsistency due to the process running the
test accessing the database after the process running the browser has
started.
2021-04-16 14:25:34 +02:00
Javi Martín
fcb5f71ff2 Reload the page instead of checking the database 2021-04-16 14:25:34 +02:00
Javi Martín
559f842e68 Make account recommendations spec more robust
We check the changes have been saved and we check recommendations have
been disabled after visiting the debates and proposals pages. The
latter helps us avoid accessing the database after the process running
the browser has been started.
2021-04-16 14:25:34 +02:00
Javi Martín
21c715bb2a Remove unnecessary "reload" method calls in tests
Using "reload" might cause issues if the process running the browser has
already been started, and it isn't necessary in these cases.
2021-04-16 14:25:34 +02:00