Commit graph

85 commits

Author SHA1 Message Date
Colin Darie
560d291bcd test: retry system tests only on CI (get error fast in local) 2023-11-06 15:15:51 +01:00
Christian Lautier
db278e83ed add a constant for the most used test password 2023-08-31 13:40:05 +02:00
Eric Leroy-Terquem
3f1309011a test gem 2023-08-29 15:11:34 +02:00
François Vantomme
f747b0a46a Chore(test): enable rspec only-failures support 2021-04-15 14:17:39 +02:00
Pierre de La Morinerie
f9401cfbad spec: better split spec_helper and rails_helper
This fixes the

> DEPRECATION WARNING: Initialization autoloaded the constants ActionText::ContentHelper and ActionText::TagHelper.

error appearing when running specs.

It also gets us closer from a newly-generated rails config.
2021-03-04 22:59:39 +01:00
Pierre de La Morinerie
473a86b861 gems: remove guard
- It doesn't seem used a lot these days
- It has some incompatibility with rspec 4

We need to explicitely add the 'listen' gem now though.
2021-02-25 10:45:42 +00:00
Keirua
1a53bfed62 renommage des tests
Co-authored-by: Pierre de La Morinerie <pierre.de_la_morinerie@beta.gouv.fr>
2020-07-21 17:13:28 +02:00
clemkeirua
d31b4b6848 ajout d'un test sur le telechargement de zips 2020-07-21 15:45:57 +02:00
clemkeirua
031f59c9e1 add wcag accessibility tests for usager pages using axe-core 2020-06-26 17:10:26 +02:00
Pierre de La Morinerie
cae256fd28 rspec: allow Rails to auto-migrate the test schema
rails_helper already has `ActiveRecord::Migration.maintain_test_schema!`
which automatically updates the test database if needed.

However, if we raise **before** `maintain_test_schema` had the chance
to do its job, the test database is never-automigrated.

Thus by removing the check, we ensure the test database will be migrated
as needed (and still an error will be raised if the schema cannot be
applied).
2020-03-31 12:48:32 +02:00
Pierre de La Morinerie
4cb747fdb6 specs: always require rails_helper
Test helpers are separated between two files: spec_helper and
rails_helper. This separation is meant to allow tests that do not
require Rails (like testing standalone libs) to boot faster.

The spec_helper file is always loaded, through `--require spec_helper`
in the `.rspec` config file. When needed, the rails_helper file is
expected to be required manually.

This is fine, but:
- Many test files have a redundant `require 'spec_helper'` line;
- Many test files should require `rails_helper`, but don't.

Not requiring `rails_helper` will cause the Rails-concerned section of
the test environment not to be configured–which may cause subtle bugs
(like the test database not being properly initialized).

Moreover, Spring loads all the Rails files on preloading anyway. So the
gains from using only `spec_helper` are thin.

To streamline this process, this commit:
- Configures `.rspec` to require `rails_helper` by default;
- Remove all manual requires to spec_helper or rails_helper.

Reference: https://stackoverflow.com/questions/24145329/how-is-spec-rails-helper-rb-different-from-spec-spec-helper-rb-do-i-need-it
2020-03-31 12:48:32 +02:00
Pierre de La Morinerie
1b4a218b0e specs: remove useless chrome argument
The `options.add_argument('--headless')` above is sufficient.
2020-03-19 17:47:33 +01:00
Paul Chavard
4edc7b00cf Use geocoder 2020-01-15 15:04:04 +01:00
Paul Chavard
c6326bfa77 Fix tests involving attachment urls 2020-01-08 14:46:18 +01:00
Paul Chavard
efd03f0169 Use webdrivers gem to keep webdrivers updated 2019-11-06 11:20:40 +01:00
Paul Chavard
65e227c44b Migrate to flipper 2019-09-10 16:10:14 +02:00
Paul Chavard
7ffb98e616 Remove carrierwave uploaders 2019-09-10 10:49:12 +02:00
simon lehericey
fc7ce3fe61 Fix capybara on linux ubuntu
Otherwise, it appears fullscreen
2019-08-21 17:38:54 +02:00
Paul Chavard
25db21467d Stop using Flipflop as switch for Fog 2019-07-31 15:15:09 +02:00
Pierre de La Morinerie
65e7489b4f uploaders: remove PieceJustificativeUploader 2019-07-30 16:11:17 +02:00
Pierre de La Morinerie
b829d105d9 brouillon_spec: fix the slow use of have_select(locator, selected: …)
Capybara's `have_select` can be very slow for elemtns with many options
(see https://github.com/teamcapybara/capybara/issues/1527)

This is because Capybara asserts that no other elements than the
required ones are selected.

This faster version is not as complete, but helps when checking the
countries list or the years in a date picker.
2019-06-04 11:03:09 +02:00
Pierre de La Morinerie
c05dc38b95 specs: remove 'disable-gpu' from chromedriver options
This option as only ever needed on Windows [1] (which we don't use),
and it shouldn't be required anymore, as the underlying bug has been
fixed [2].

- [1] https://developers.google.com/web/updates/2017/04/headless-chrome
- [2] https://bugs.chromium.org/p/chromium/issues/detail?id=737678
2019-06-03 12:46:12 +02:00
Mathieu Magnin
44f28ec565 Remove feature flag for publish draft 2019-03-12 11:26:07 +01:00
gregoirenovel
873bf2fc0f Tell puma to STFU 2018-12-04 10:35:13 +01:00
Pierre de La Morinerie
35613992fe rspec: by default use the safer bisect runner for bisecting 2018-11-14 14:49:41 +01:00
Pierre de La Morinerie
acc6df2662 spec: fix Mina enabling Rails traces during tests
When requiring mina files, it automatically enables Rails traces. But
we don't want Rails traces during tests.

Fix this by disabling Rails traces before running tests.

Fix #2989
2018-11-14 11:55:21 +01:00
Pierre de La Morinerie
b0541fba79 users: sign-in after confirming an account within a short time 2018-11-06 18:24:34 +01:00
Pierre de La Morinerie
d4b2b04875 spec: clear deliveries before every example 2018-11-06 17:26:20 +01:00
gregoirenovel
f3caa8ef7f Remove apipie (and maruku) 2018-10-09 17:23:07 +02:00
gregoirenovel
6eeba14885 Enable Style/WordArray 2018-10-03 12:03:21 +02:00
Paul Chavard
f2139552c2 Reset Flipflop before each test 2018-09-20 16:13:34 +02:00
Paul Chavard
9abb3c7a5a [ENV] Pipedrive key config 2018-08-23 15:55:32 +02:00
Mathieu Magnin
db8e750f1a [ENV] Configure Api Entreprise token 2018-08-23 15:55:32 +02:00
Pierre de La Morinerie
9ec5befa09 specs: increase Capybara default timeout
Because CircleCI machines are slow, and tests sometimes timeout.
2018-08-07 14:28:52 +02:00
Pierre de La Morinerie
8af86fb110 specs: move config line where it makes more sense 2018-08-01 11:00:17 +02:00
Pierre de La Morinerie
1eb110ac7c specs: fix random seed being always the same when using Spring 2018-07-30 11:03:16 +02:00
Paul Chavard
bf7c023380 Add webpacker and use it for new_design 2018-07-25 15:14:06 +02:00
Pierre de La Morinerie
394019b70c specs: save a screenshot of failing integration tests 2018-07-04 09:43:22 +02:00
Pierre de La Morinerie
d1301762d4 pipedrive: fix deals when no deals are returned 2018-07-02 17:07:24 +02:00
Paul Chavard
d0a6957862 Remove old cerfa code 2018-06-28 15:16:20 +02:00
Pierre de La Morinerie
9f502c536b spec: only load tasks once
When a task is loaded several times, a single call of `task.invoke`
will run the task several times too.

This made `add_annotion_privee_to_procedure_spec` fail when it wasn't
the first task being tested.
2018-06-20 11:35:20 +02:00
Pierre de La Morinerie
790704ef58 tasks: silence output of tasks during tests
Currently, when running specs, the output of rake tasks is spamming
the tests results.

This PR configures Rake so that it runs in quiet mode during specs. This
disables the internal messages of rake during tests.

However our own `puts` also need to be conditionned to the verbosity of
rake. Using a simple `rake_puts` helper allows the info messages to be
displayed when running the rake task manually, but not during tests.

Before:

```
$ bin/rspec spec/lib/rake
Randomized with seed 6544
1 Mails::ClosedMail to clean
cleaning Mails::ClosedMail #1
1 Mails::InitiatedMail to clean
cleaning Mails::InitiatedMail #1
1 Mails::ReceivedMail to clean
cleaning Mails::ReceivedMail #1
1 Mails::RefusedMail to clean
cleaning Mails::RefusedMail #1
1 Mails::WithoutContinuationMail to clean
cleaning Mails::WithoutContinuationMail #1
.....Champ 0/1
.Champ 0/1
.
```

After:

```
$ bin/rspec spec/lib/rake

Randomized with seed 6544
.......
```
2018-06-13 11:05:15 +02:00
Paul Chavard
785fe3410e Clone procedure notice 2018-05-22 17:43:44 +02:00
Paul Chavard
45019ce75c Use Flipflop instead of Feature 2018-04-18 16:51:21 +02:00
gregoirenovel
0a9f442260 Enable some Rails cops 2018-03-06 17:18:44 +01:00
gregoirenovel
e26f4148ff Bump development gems
- brakeman
- rubocop
- scss_lint
2018-03-06 16:17:22 +01:00
gregoirenovel
fe7f8da636 Revert "Bump development gems"
This reverts commit d6ad3fc3fd.
2018-03-06 15:11:26 +01:00
gregoirenovel
d6ad3fc3fd Bump development gems
- brakeman
- rubocop
- scss_lint
2018-03-06 10:36:35 +01:00
Paul Chavard
8a55ac79f1 Remove global BROWSER and use browser helper 2018-02-05 10:35:51 +01:00
gregoirenovel
a2f4e8b283 factory_girl is now factory_bot 2018-01-23 17:15:42 +01:00