Commit Graph

11 Commits

Author SHA1 Message Date
Javi Martín
f68553dc00 Extract method to fill in markdown editor in specs 2020-08-05 14:10:22 +02:00
Javi Martín
8408bfdcf0 Don't use ckeditor.setData in specs
After upgrading to chromedriver 80, tests checking CKEditor's content
were causing chromedriver to hang. That's why we were configuring
webdrivers to use an older chromedriver.

Version 80 of chromedriver introduced several issues regarding frames.
Debugging shows in this case chromedriver froze when we used `setData`
and then `within_frame`. Since adding a `sleep` call made it work, we
think `within_frame` was being executed before `setData` had finished.
The fact that `setData` causes the browser to enter the frame having
CKEditor is probably the reason.

Even though the `setData` method provides a callback when it's finished,
configuring it so the rest of the Ruby code isn't executed until that
happens leads to complex code. Using Capybara's `set` to fill in the
editor is IMHO a bit easier to understand.

After this change, since we're using a method provided by Capybara
instead of executing asynchronous JavaScript code, we don't have to
check CKEditor has been filled anymore. The "Admin Active polls add"
test, which failed on my machine without that check, now passes.
2020-06-09 13:29:56 +02:00
Javi Martín
a103b5392e Use more consistent parameter names
I incorrectly used "text" as variable name in commit 2cdc6a1b. In
similar places, we use `label`. We also use named parameters when only
`with:` is provided.
2020-04-24 15:43:54 +02:00
Javi Martín
5b97b20f96 Wait for CKEditor to load in specs
Some specs involving CKEditor were failing sometimes in the Rails 5.1
branch. The reason why these specs pass with Rails 5.0 but fail with
Rails 5.1 are unknown. On my machine the tests pass when precompiling
the assets, which makes me think it's related to the way Rails handles
them, but it might have nothing to do with it.

The only (apparently) 100% reliable solution I've found is to wait for
CKEditor to load before trying to fill it in. After running the tests on
my machine hundreds of time, I didn't get a single failure.
2020-04-24 15:43:54 +02:00
Javi Martín
2cdc6a1b1b Check CKEditor is filled properly in tests
It looks like sometimes, particularly when the first thing we do after
loading a page is filling the CKEditor fields and submitting the form,
CKEditor doesn't have enough time to format the text, and so it's sent
as plain text instead of HTML. This behaviour can be reproduced on my
local machine after upgrading to Rails 5.1, with the test "Admin Active
polls Add" failing 100% of the time.

Checking CKEditor has been filled in correctly solves the issue.
2020-04-10 17:11:56 +02:00
Javi Martín
a0ea1f6ecb Simplify CKEditor translatable fields in specs
We've simplified the way CKEditor is handled in tests; probably due to
that, we don't need this method anymore.
2020-04-10 15:14:15 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Julian Herrero
7b8f8f0f74 Add spec helper to fill translatable ckeditor fields 2019-02-13 11:44:34 +01:00
Javi Martín
e34a827c48 Add translations for rails date order
Not doing so caused crashes on applications which don't fall back to
English when a translation is missing.

We're adding them in a separate file so we can exclude it from crowdin
and so translators don't translate symbols as if they were words which
need translation.
2018-12-21 19:31:15 +01:00
Adan Amarillas
9210d8928e Clean up newly created modules 2018-06-04 08:55:53 -07:00
Adan Amarillas
ee877888b3 Split spec common actions support helper 2018-06-04 08:55:53 -07:00