Commit Graph

16005 Commits

Author SHA1 Message Date
Javi Martín
489e012e1b Test 500 Internal server error page in system spec
We were testing what happens when users disable features in the admin
panel, so it makes sense to test what happens from the user's point of
view when trying to access a disabled feature: they see a page with the
test "Internal server error".

Whether we should responde with 500 Internal server error page or a 404
Not Found is up to debate; personally I find the latter more
appropriate.

Code based on the article "Changing Rails consider_all_requests_local in
RSpec fails" [1].

[1] http://atodorov.org/blog/2016/04/27/changing-rails-consider_all_requests_local-in-rspec-fails/
2021-03-31 14:42:20 +02:00
Javi Martín
5ef6c9c2b5 Simplify controller tests requiring admin login
Similar to what we did in commit 3da4ee00b for system tests.
2021-03-31 14:42:20 +02:00
Javi Martín
24caa749e7 Merge pull request #4451 from consul/dates_in_specs
Improve filling in dates in specs
2021-03-31 14:20:27 +02:00
Javi Martín
487f41cd84 Merge pull request #4450 from consul/notification_relative_urls
Fix admin notification with relative URLs
2021-03-31 14:15:30 +02:00
Javi Martín
0c95ababdf Use dates to fill in admin date input fields
Tests are easier to read now. Besides, since we changed the inputs in
the admin section so they don't use jQuery but an HTML date field,
formatting with %d/%m/%Y might not work depending on the browser's
locale.
2021-03-31 14:09:13 +02:00
Javi Martín
24a66f16f2 Close datepicker in tests after filling in dates
Some tests were failing depending on the window resolution due to the
datepicker making it impossible to click the "Filter" button. They were
also failing if using `clear: :backspace` to fill in those fields.

So we're focusing on a different field in order to hide the datepicker
and click the "Filter" button.
2021-03-31 14:09:13 +02:00
Javi Martín
863f70044b Fix test trying to set a wrong date
The line `fill_in "advanced_search_date_max", with: "wrong date"`
doesn't work because the jQuery UI datepicker prevents users from
entering that value.
2021-03-31 14:09:13 +02:00
Javi Martín
52e0d45ff7 Fix filling in dates in advanced search tests
We were filling in dates with times, which is not what users would do.
2021-03-31 14:09:13 +02:00
Javi Martín
d7563be8b3 Fix admin notification with relative URLs
The test was passing because it was using the rack driver, but on real
browsers it wasn't generating the expected URL.
2021-03-31 14:03:26 +02:00
Javi Martín
f33d2cc3b1 Merge pull request #4445 from consul/toggle_buttons
Allow toggling elements with the keyboard
2021-03-31 13:52:41 +02:00
Javi Martín
6ea9383743 Allow toggling elements with the keyboard
Using `<a>` tags with no `href` means these elements cannot be activated
by keyboard users, so we're replacing them with buttons.

In the future we probably want to add more consistency so all toggle
buttons use the same code. We might also add styles depending on the
`aria-expanded` property.
2021-03-31 13:38:38 +02:00
taitus
bfbbda00e3 Add new mixin to render buttons as links 2021-03-31 13:21:10 +02:00
Javi Martín
f1fcdc62da Merge pull request #4444 from consul/mimemagic
Bump mimemagic to version 0.3.8
2021-03-25 19:01:32 +01:00
taitus
e34f8fcbf2 Bump mimemagic to version 0.3.8 2021-03-25 18:43:38 +01:00
Javi Martín
e371ad1f80 Merge pull request #4404 from consul/budget_styles
Change budgets section styles
2021-03-24 16:08:39 +01:00
decabeza
aabf8493f8 Use brand colors on budgets section 2021-03-24 15:50:26 +01:00
Alberto
048ca61207 Improve styles for budgets voting phase 2021-03-24 15:50:25 +01:00
Alberto
f79edf6ba4 Improve message to submit ballot 2021-03-24 15:48:24 +01:00
Alberto
10eb7f47c8 Use underscores on HTML IDs 2021-03-24 15:48:24 +01:00
Alberto
896fee6e99 Improve icon to remove investment from ballot
Note we're absolutely positioning the link instead of the icon; that way
keyboard users will be able to focus on the icon. Until now, users would
focus on an empty link.

For the same reason, we couldn't use `click_link` with Capybara, since
it would fail to click an empty link. Now we can.

Co-authored-by: Javi Martín <javim@elretirao.net>
2021-03-24 15:48:24 +01:00
Javi Martín
8be7abe5fd Remove obsolete CSS selectors
The `investment-project` and `investment-project-show` classes aren't
used since commit d0b8fef6b.
2021-03-24 15:48:24 +01:00
Javi Martín
fb8c476fb2 Extract component for ballot investment
Using component inheritance we can remove duplication and share the same
view.
2021-03-24 15:48:24 +01:00
decabeza
72a24128a6 Improve upload image and documents buttons 2021-03-24 15:48:24 +01:00
Javi Martín
4bb12c573f Fix invisible text selection on brand text
When an element had a text using the brand color and was a child of an
element with a brand background, the selection was invisible.
2021-03-24 15:48:24 +01:00
Javi Martín
f124828cd8 Fix invisible text selection on brand backgrounds
Since we were defining the selection to have the same text color and
background color as the element they were in, it resulted in the
selection being invisible.

It wasn't that noticeable because we were using this color combination
mainly in links and buttons, and selecting their text is not as common.
But we plan to use the `$brand` color on budget headers as well, and
this issue is more obvious there.

Browsers like Chrome weren't that affected because they automatically
make the selection semi-transparent and so the selected text still had a
slightly different color. In order to prevent this effect when the
selection is white, we're using a 0.99 opacity (in this case Chrome
ignores numbers higher that 0.998).
2021-03-24 15:48:24 +01:00
Javi Martín
e2d540d203 Extract code to define brand background
Setting the color to `$white` or `#fff` while setting the background to
`$brand` is a pattern we were using in many places. Since we're going to
edit it in order to fix the `::selection` behavior, we're defining the
pattern in one place.
2021-03-24 15:48:24 +01:00
Javi Martín
8ec7f0efc0 Remove obsolete styles
These styles are not used since commit db7d57b14.
2021-03-24 15:48:24 +01:00
Javi Martín
c08aa6ade5 Split SCSS mixins in several files
One file was OK when we only had a couple of mixins, but recently we've
been adding quite a few.

We can now avoid a SCSS Lint warning by excluding just the file with the
affected mixin.
2021-03-24 15:48:24 +01:00
Javi Martín
25c55bfd62 Merge pull request #4439 from consul/bump_mimemagic
Bump mimemagic to version 0.3.6
2021-03-24 15:44:04 +01:00
Javi Martín
decc7351f6 Bump mimemagic to version 0.3.6
Mimemagic 0.3.5 and earlier have been yanked due to a licensing issue.
2021-03-24 15:16:00 +01:00
Javi Martín
bb38ce9d1f Merge pull request #4438 from consul/secret_key_base
Comment secret key base on production environments
2021-03-23 19:14:32 +01:00
Javi Martín
3529ee777a Merge pull request #4433 from consul/gitlab_ci
Add experimental Gitlab CI integration
2021-03-23 14:09:42 +01:00
Javi Martín
de746b4004 Add experimental Gitlab CI integration
Based on the configuration recommended by Knapsack PRO [1] and Pronto
[2].

So far there are a few issues:

* Bundled gems don't seem to be cached
* The Ruby version can't be read from .ruby-version and needs to be set
  manually
* Tests are slower than when run on Github Actions or Travis CI
* There seem to be many flaky tests, maybe because tests are slower
  (this might actually help us fixing flaky bugs or performance
  bottlenecks)

An advantage of Gitlab CI is we can access the screenshots taken when a
system test fails.

[1] https://docs.knapsackpro.com/2019/how-to-run-parallel-jobs-for-rspec-tests-on-gitlab-ci-pipeline-and-speed-up-ruby-javascript-testing
[2] https://github.com/prontolabs/pronto/#gitlab-integration
2021-03-23 13:02:41 +01:00
Javi Martín
c161d7b5f6 Comment secret key base on production enviroments
Although our installer automatically generates a secret key base, we
want to avoid any chance of installations who don't use the installer
having an empty secret key base or using the default secret key base we
provide to use on development and test environments.
2021-03-22 20:33:18 +01:00
Javi Martín
7c39eed0ee Merge pull request #4432 from consul/knapsack_forks
Avoid timeouts in Knapsack PRO
2021-03-22 19:23:53 +01:00
Javi Martín
5bbf1f6857 Merge pull request #4435 from consul/dependabot_config
Remove dependabot config file
2021-03-20 22:48:43 +01:00
Javi Martín
a8d6b9b330 Disable dependabot
Due to a bug in dependabot (see issue 2198 in the
`dependabot/dependabot-core` repository), Dependabot would open pull
requests on every fork, which would be inconvenient.

So we're disabling the updates until this issue is fixed; since we
currently have almost 50 open pull requests, it shouldn't affect us that
much.
2021-03-20 22:36:49 +01:00
Javi Martín
ad638b6a0f Merge pull request #4412 from consul/dependabot/bundler/rails-5.2.4.5
Bump rails from 5.2.4.4 to 5.2.4.5
2021-03-20 20:14:14 +01:00
Javi Martín
cefa015b71 Merge pull request #4312 from consul/dependabot/bundler/redcarpet-3.5.1
[Security] Bump redcarpet from 3.5.0 to 3.5.1
2021-03-20 20:09:20 +01:00
dependabot[bot]
83f23b3ef1 Bump rails from 5.2.4.4 to 5.2.4.5
Bumps [rails](https://github.com/rails/rails) from 5.2.4.4 to 5.2.4.5.
- [Release notes](https://github.com/rails/rails/releases)
- [Commits](https://github.com/rails/rails/compare/v5.2.4.4...v5.2.4.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-20 20:02:02 +01:00
dependabot-preview[bot]
ebdd889a5d [Security] Bump redcarpet from 3.5.0 to 3.5.1
Bumps [redcarpet](https://github.com/vmg/redcarpet) from 3.5.0 to 3.5.1. **This update includes a security fix.**
- [Release notes](https://github.com/vmg/redcarpet/releases)
- [Changelog](https://github.com/vmg/redcarpet/blob/master/CHANGELOG.md)
- [Commits](https://github.com/vmg/redcarpet/compare/v3.5.0...v3.5.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-20 18:56:01 +00:00
Javi Martín
416b474122 Avoid timeouts in knapsack PRO
The way it's recommended since knapsack_pro version 2.3.0 [1].

[1] https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/CHANGELOG.md#230
2021-03-20 19:20:46 +01:00
Javi Martín
bb75c03ae0 Remove unneeded line loading knapsack pro tasks
This line isn't needed since knapsack_pro version 0.46.0 [1].

[1] https://github.com/KnapsackPro/knapsack_pro-ruby/blob/master/CHANGELOG.md#0460
2021-03-20 19:11:57 +01:00
Javi Martín
c1cdcf25ba Merge pull request #4257 from consul/dependabot/bundler/pg_search-2.3.5
Bump pg_search from 2.3.4 to 2.3.5
2021-03-20 19:11:03 +01:00
dependabot-preview[bot]
bd39e3ce4a Bump pg_search from 2.3.4 to 2.3.5
Bumps [pg_search](https://github.com/Casecommons/pg_search) from 2.3.4 to 2.3.5.
- [Release notes](https://github.com/Casecommons/pg_search/releases)
- [Changelog](https://github.com/Casecommons/pg_search/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Casecommons/pg_search/compare/v2.3.4...v2.3.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-20 15:36:11 +00:00
Javi Martín
3fcdfddf0d Merge pull request #4406 from consul/dependabot/add-v2-config-file
Create Dependabot config file
2021-03-20 16:07:36 +01:00
dependabot-preview[bot]
f6bddcb32b Create Dependabot config file 2021-03-20 14:52:16 +00:00
Javi Martín
5194fae65f Merge pull request #4392 from consul/dependabot/bundler/nokogiri-1.11.2
[Security] Bump nokogiri from 1.10.10 to 1.11.2
2021-03-20 15:29:47 +01:00
dependabot-preview[bot]
fc87a111d2 [Security] Bump nokogiri from 1.10.10 to 1.11.2
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.10 to 1.11.2. **This update includes security fixes.**
- [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.10.10...v1.11.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-03-20 01:32:41 +00:00
Javi Martín
06f07758f1 Merge pull request #4397 from consul/unify_budgets
Unify budget landing pages
2021-03-19 18:17:51 +01:00