Commit Graph

281 Commits

Author SHA1 Message Date
Angel Perez
9575aa5a42 Fix failing specs for skipping invalid map markers 2018-05-28 11:44:53 -04:00
rgarcia
994e15666e Skip invalid map markers
Why:
Sometimes the latitude or longitude it passed to the map as *********
instead of the actual latitude or longitud. The asterisks are not a
string, breaking the whole array
https://github.com/consul/consul/issues/2380

What:
This commits skips invalid markers and displays the rest

How:
- Substituting the mysterious asterisks for null
(cleanInvestmentCoordinates)

- Validating the coordinates are numbers before trying to pain
them(validCoordinates)

- Adding a numeric function to validate the latitude and longitude
(isNumeric)
https://stackoverflow.com/questions/9716468/is-there-any-function-like-i
snumeric-in-javascript-to-validate-numbers#answer-9716488
2018-05-28 11:44:53 -04:00
decabeza
f1e722ac5c Adds message to selected budget investments 2018-05-10 14:54:34 +02:00
iagirre
4e5c9e2166 Modify specs to work with new features
Add specs to check that the translations
are being deleted correctly and the
current locale tab is highlighted when the
admin visits the edit milestone page.
2018-05-09 16:12:47 +02:00
Alberto
1b52ecc9ec Merge pull request #2614 from microweb10/issue-2604
Fixes Issue #2604
2018-05-09 11:26:16 +02:00
Julian Herrero
833670117e add test for not selected bugets investments 2018-04-30 13:59:57 +07:00
Julian Herrero
3a643f3c29 add test for unfeasible bugets investments 2018-04-30 13:55:48 +07:00
Alberto García
223c06f588 Merge pull request #2567 from consul/mode-view
Mode view
2018-04-27 19:28:54 +02:00
rgarcia
65e2360650 Use a float smaller than 1 as a random seed
By using a random seed value smaller than 1, we solve the previous
situation[1] in a simpler way

This test is now obsolete.
It’s hard to write a tests to verify that even with a big seed in
params, we will covert it to a float smaller than 1.

We should refactor these `set_random_seed` methods into a nice model or
controller concern and test it thoroughly

[1]
https://github.com/AyuntamientoMadrid/consul/commit/ba3bf11526fc6ce9c66f
647c414946c61ff945fe
2018-04-05 22:16:54 +02:00
rgarcia
3dcbb6b976 Run random order tests without javascript
Speeds it up a little, there is no need to take into account javascript
in these tests
2018-04-05 22:16:54 +02:00
rgarcia
ef30dc1efe Add defensive test to display correctly a user's votes
This is a defensive test, just in case we decide to go back to using
`setseed` instead of the `modulus`[1] approach to display investments
in random order

The reason for this test is that `setseed` only ~works in the next
`select` statement. And as when loading a user’s votes for investments
we do a second `select` it does not work as expected 😌

To solve this… we could call `set_random_seed` before loading a user’s
votes for an investment[2]

[1] https://github.com/consul/consul/pull/2131
[2]
https://github.com/AyuntamientoMadrid/consul/blob/master/app/controllers
/budgets/investments_controller.rb#L37
2018-04-05 22:16:54 +02:00
rgarcia
ce3cb045f8 Convert random seed to a small value
We are trying out a modulus function to return investments in random
order https://github.com/consul/consul/pull/2131

However we ran into the gotcha of having a seed value too big for the
modulus function to work as expected

If the seed is bigger than the investment id, the records are returned
ordered by id

By dividing the seed by a big number, this problem seems to get fixed
2018-04-05 22:16:54 +02:00
rgarcia
39c6ac4a91 Display message in budget's index when there are no budgets
When there are no budgets we were seeing an exception in the budgets’
index

There are two parts to take into account here:
1) Making sure there is a current_budget present, otherwise we display
the “no budgets” message

2) The map helper is called from the controller, so we need to make
sure current_budget is present there too

Note: We could have added a bunch of `try` statements in the budgets’s
index, instead of using a conditional, however there are quite a few
`current_budget` calls so it seems more appropriate to use a conditional
2018-04-05 14:25:32 +02:00
rgarcia
c4b6ad9ee6 Use strings instead of method calls in expectations 2018-04-04 14:38:36 +02:00
rgarcia
71bb5b3dcf Fix display of unfeasibility explanation
We were missing a check to make sure valuation had finished before
displaying the unfeasibility explanation
2018-04-04 14:38:31 +02:00
decabeza
2f5561bf03 Adds view mode on budget investments 2018-04-02 17:26:12 +02:00
Angel Perez
92af93e8bd Fix failing tests that simulated a click against the DOM
The now-deprecated `.trigger('click')` API simulated a click against
the DOM rather a click on the UI, which made our tests fragile and
wouldn't simulate actual user interaction
2018-03-27 14:47:51 -04:00
Angel Perez
ea21fe859b Format dates with .strftime('%d/%m/%Y') when filling datepickers
Advanced search scenarios for Budget::Investments, Debates and
Proposals need proper date formatting as they behave unexpectedly
when APIs such as `7.days.ago` are used
2018-03-27 14:47:49 -04:00
Angel Perez
375c43b5f1 Replace deprecated .trigger('mouseover') API with .hover 2018-03-27 14:47:49 -04:00
Angel Perez
5c53466e86 Remove unnecessary status code related assertion 2018-03-27 14:47:49 -04:00
Angel Perez
122b17033b Use Selenium API to accept/dismiss JS modals/browser alerts
JS modals/browser alerts are not automatically accepted now with
Selenium, events that trigger such events must be wrapped in one
of the following methods: `accept_alert`, `accept_confirm` or
`dismiss_confirm`
2018-03-27 14:47:49 -04:00
Angel Perez
38af45d450 Replace deprecated .trigger('click') API with .click 2018-03-27 14:47:49 -04:00
rgarcia
bdffb9765e Allow voting in multiple headings
Now that we have the option of voting in multiple headings per group,
the method of voting in a “different heading assigned” has become
deprecated and thus removed
2018-03-22 22:24:58 +01:00
Raúl Fuentes
cd5923c41d updated test, changed fixed seeds for the new seed function 2018-03-14 11:13:59 +01:00
decabeza
0e9190bc43 Adds heading link on different heading message 2018-03-08 11:50:09 +01:00
decabeza
1cc799ef11 Adds links to milestone description 2018-02-14 18:13:46 +01:00
Raúl Fuentes
ecdbc4a3f7 added balloting to the list of phases allowed to see all the links 2018-02-10 15:27:40 +01:00
Raúl Fuentes
6871193cbc Added test to bugets/index to ensure the correcto showing of the investment links over ths changes of the buget's phase 2018-02-10 15:27:40 +01:00
Raúl Fuentes
ebebbdf078 Added bigger pool for random seeds, now with a 9 * 10e-07 % of chance of appearing, also added test to cover edge cases (case in fact, the coincidence of the seeds it's correct)
Conflicts:
	app/controllers/budgets/investments_controller.rb
2018-02-08 16:33:15 +01:00
Raúl Fuentes
ae25fdfc15 fix for the flaky 2018-02-08 16:29:21 +01:00
Bertocq
67663804c5 Improve investments milestone scenario for ordering
Milestones should be listed ordered by publication date instead of
creation date. The spec was creating only one milestone and not even
expecting the descriptions to be present in the page.
2018-02-03 18:46:43 +01:00
BertoCQ
4020720b32 Merge pull request #2370 from consul/improve_budget_heading_style
Improve budget heading style
2018-01-31 02:35:51 +01:00
BertoCQ
f0f41b0403 Merge pull request #2373 from consul/single_heading_group_names
Improve heading names at select boxes
2018-01-31 02:35:11 +01:00
Bertocq
04d5a83031 Improve Budget's index feature spec scenarios 2018-01-30 03:01:44 +01:00
Bertocq
e5cff2fb60 Make budget feature spec comply with 100 linelenght 2018-01-25 00:48:52 +01:00
Bertocq
bc3c92acb4 Remove no longer valid drafting budget scenarios
Drafting budgets will no longer be listed under any conditions at the
budget index... not even as "current" budget.
2018-01-25 00:48:52 +01:00
Bertocq
210032e1ce Expect finished budget be listed at budget index
But only finished budgets should be listed here, not drafting ones,
neither current ones.
2018-01-25 00:48:31 +01:00
Bertocq
d692ff781a Refactor Budget feature spec Index scenario
Budget's home page has changed, no longer we'll be showing a list of
active budgets, but only one current (open) budget and a list of
finished ones.

So no need to create 3 budgets in a row, but a finished budget (because
we already have a valid budget created)
2018-01-24 22:00:03 +01:00
Bertocq
d6a6b99624 Fix rare flaky test, expect a price not just the number 2018-01-24 15:06:40 +01:00
Bertocq
e0abb86267 Update specs for new heading options naming rules
* Update budget heading order scenario to check new option name rules
* Update other scenarios that were expecting old heading naming convention
2018-01-24 14:15:10 +01:00
iagirre
4bb872bef7 Fixed errors detected in Travis 2018-01-23 15:42:01 +01:00
Raúl Fuentes
82b750de68 moved duplicated code to helper 2018-01-23 15:42:01 +01:00
iagirre
846898f3ec New phase "Information" added and UI modified to not show the links.
Specs to test the functionality added.
2018-01-23 15:42:01 +01:00
iagirre
8f3df54453 Fixed errors detected in Travis 2018-01-23 13:33:10 +01:00
Bertocq
217f62116e Correctly scape budget phase summary on phases list 2018-01-22 23:29:48 +01:00
María Checa
1f461b09f0 Merge pull request #2353 from consul/2339-admin_budgets_phases
Allow admins to edit Budget phases
2018-01-22 18:07:34 +01:00
Raúl Fuentes
93268fc5d6 changed advanced filter from budgets to budgets/investments 2018-01-22 09:59:09 +01:00
Raúl Fuentes
bb39f8af0a issue #1436, mirrored behavior from proposals 2018-01-22 09:59:09 +01:00
María Checa
94279448f3 Replaced 'participatory budget' with 'budget' 2018-01-20 14:03:14 +01:00
decabeza
f722caac24 removes budget steps on header 2018-01-19 14:35:05 +01:00