Commit Graph
120 Commits
Author SHA1 Message Date
Lucas Perais (lpe) 50e5f73b4e [FIX] fields, test_new_api: monetary related custom
This commit allows for not copying the currency_field attribute
of a monetary field when the monetary field is related,
and when the currency_field attribute is not explicit

Before this commit, the currency_field attribute on the related monetary
was set as the one on the distant model

After this commit, the currency_field attribute takes the field on the
current model

Though the test may appear like an incoherent use case,
it is on the contrary totally legit, as web_studio allows it

OPW 1903113

closes odoo/odoo#28144
2018-11-14 15:14:36 +00:00
Christophe Simonis 5e055a2afd [MERGE] forward port branch saas-11.4 up to f6ca72b3ce 2018-11-02 10:52:55 +01:00
Christophe Monniez 07b855fccf [FIX] tests: remove chrome sandboxing
It appears that chrome headless with sandboxing is failing when running
containerized because it tries to use Linux namespaces.

With this commit, the no-sanbox optional arg is used to avoid this
issue.

Closes #26456
Closes #28053
2018-10-26 11:26:18 +02:00
Xavier Morel 8c9174ff80 [FIX] base: handling of *_view_ref in SSF
The feature was not tested, and as it turns out completely broken:

* the non-raw string means the "backrefs" were really interpreted as
  octal literals
* the second backref was entirely wrong

Also add all loaded views to the field descriptor in case we might
have a use for it (and because inline sub-views are always stored on
the descriptor).

closes odoo/odoo#28194
2018-10-26 11:39:53 +00:00
Denis Ledoux 8f8060faae [FIX] tests: web tests, chromium fallback
On Ubuntu, the chromium executable is `chromium-browser`,
On other distributions, such as debian, it's `chromium`.

We therefore add another fallback
2018-10-18 11:59:44 +02:00
Denis Ledoux 0e388750c1 [FIX] tests: chromium executable is chromium-browser
When installing chromium using apt
e.g apt install chromium-browser
the executable is `chromium-browser`,
not just `chromium`
2018-10-18 11:59:44 +02:00
Christophe Monniez 2f63e1e973 [FIX] tests: detect coverage and adjust timeout
When computing coverage, the tests are slowed down and the timeout is
often exceeded.

With this commit, HttpCase headless Chrome tests timeout is increased if
coverage is detected.
2018-10-18 11:59:44 +02:00
Christophe Monniez 383ed26657 [FIX] tests: close Chrome and shutdown on SIGXCPU
When Odoo receive a SIGXCPU (CPU time limit reached), it shuts down
immediately. If a headless Chrome is running, it stays alive after the
Odoo shutdown.

With this commit, the signal is intercepeted and the Chrome browser is
properly closed before shutting down the Odoo server.
2018-10-18 11:59:43 +02:00
Christophe Monniez 5a523b06cd [FIX] tests: properly stop chrome when no tab found
In some situations, Chrome remote debugging is sending an empty list of
opened tabs. In that case, an orphan Chrome process stays alive.

With this commit, Chrome is stopped properly in those situations.
2018-10-18 11:59:43 +02:00
Christophe Monniez 0daf4536a6 [FIX] tests: disable screencast when no logfile
When an HttpCase browser_js test is started, the screencast is started
and is discarded at the end of the test if no logfile was provided by
the config.

This behavior can impact the performances.

With this commit, the screencast does not start at all if not needed.
2018-10-18 11:59:43 +02:00
Christophe Monniez 8a5e40b875 [FIX] tests: redirect chrome headless stdout and stderr to dev null
When executing a very long HttpCase browser_js test, it happens that one
of the chrome process PIPE is full (ie. clickEverywhere test).
In that case, the communication with Chrome is blocked.

With this commit the stdout and stderr of the Chrome process are
redirected to /dev/null.
2018-10-18 11:59:43 +02:00
XavierDo 22dc335803 [FIX] tests, web_tour: improve js error display in build details
Since chrome headless has been merged, js error messages are
difficult to read: some information was missing or only displayed in
full all log.

All console.error() will now be displayed in build details, and will
appear just before the python assertion.

XMO's improvement will also be used on all log: Using module and
classname of the class calling phantomJS.

Also: some small improvements on error messages to make them easier to read

Note: this commit also shown that some error were not detected:
now we will fail in any case if js log an error.
2018-10-18 11:59:43 +02:00
Christophe Simonis 42cfc72d5e [FIX] core: use actual chrome/chromium executable on macOs. 2018-10-18 11:59:42 +02:00
Christophe Monniez ecaa04ec82 [FIX] tests: increase browser_js ready code timeout
Before starting a JS test/tour the _wait_ready method evaluates if the
test is ready with a timeout of 10 sec. From times to times, it happens
that the page is not ready after this timeout but the problem is hidden.

In order to help fixing that kind of issue, the timeout is increased to
60 sec and a warning is logged to emphasis the fact that an
issue exists.

Also some unused imports are removed with this commit
2018-10-18 11:59:42 +02:00
Raphael Collet 614884928e [FIX] tests: clean up code
Closes #26467
2018-10-18 11:59:42 +02:00
Christophe Monniez 9973994660 [FIX] tests: clean the browser even on failure
When a Chrome headless test fails the browser is not cleaned and could
lead to a mix with other tests when the same method is called.

Also, the multiline assertions gives an unreadable message when the
assertion fails.
Finally, it happens that a thread does not have an 'url' attribute and lead to a crash when the logger tries to show the thread url.

With this commit, the browser is cleaned, even on failure and the
assertions are now one line.

Closes:  #26432
2018-10-18 11:59:42 +02:00
Christophe Monniez 9211121a57 [FIX] tests: avoid traceback when websocket-client is not installed
The account module needs to import Form from "tests.common" causing a
traceback when websocket-client module is not installed.

As this module is only required for the tests, there is no reason to add
it to the "requirements.txt" file.

With this commit, Odoo account can be installed even when
websocket-client is not installed, in that case, the HttpCase tests that
needs to run Chrome headless will be skipped with a warning.

Closes: #26404
2018-10-18 11:59:42 +02:00
antonylesuisse 1fe5145f0c [REF] tests: replace phantomjs by Chrome headless
As the phantomjs project was suspended[1], there was a need to change the js test
engine. Moreover, the engine was rather old and leading to non
deterministic crashes.

Chrome headless was choosen for simplicity and the long term vision of
the devtools protocol [2].

The 'phantom_js' method still exists but will be deprecated in
favor of 'browser_js' with the same parameters.

In order to communicate with the browser, the python websocket-client package
is needed.

[1] https://github.com/ariya/phantomjs/issues/15344
[2] https://chromedevtools.github.io/devtools-protocol/

closes #25991
2018-10-18 11:59:38 +02:00
Xavier Morel 35eaa523bd [IMP] tests logging
* Make phantomjs logging clearer by logging within the test case's
  module, not odoo.tests.common.

  This way, a tour in e.g. point of sale is clearly logged as that,
  rather than be logged as odoo.tests.common.phantomjs and require
  hunting which module/test we happen to be in.

* Clarify tagging causes for exclusion of selection of tests.
2018-10-18 11:59:08 +02:00
Christophe Simonis b81c2bce84 [MERGE] forward port branch saas-11.4 up to 3c108977c1 2018-10-22 16:59:51 +02:00
Thibault Delavallée 7429c61dfc [IMP] tests: add an helper in odoo tests in order to quickly create test users
Following great @odony review we decided to add a helper method allowing
to quickly create users in tests in a one-liner. It will allow to remove a
lot of duplicate code in various test classes and methods.

This method basically requires a login and a comma separated list of user
groups xml ids. Kwargs are supported to further customize the created
user. A custom context can be given to the creation as user creation in
odoo can support several options within standard addons, like mailing or
signup options.

Next commits will propagate the use of this helper in some test classes
notably in mail, hr and mass mailing.

This commit is linked to task ID 1889703 and PR #27526.
2018-10-18 13:56:56 +00:00
Jairo Llopis a362d0eb9f [FIX] tests: Make at_install and post_install backwards compatible
Fixes #27471 by just using `tagged()` behind the scenes.

calls to `tagged` were done in the wrong order

closes odoo/odoo#27531
2018-10-08 12:16:08 +00:00
Denis Ledoux 4fb5c57dc5 [FIX] tests: web tests, chromium fallback
On Ubuntu, the chromium executable is `chromium-browser`,
On other distributions, such as debian, it's `chromium`.

We therefore add another fallback
2018-09-14 11:28:56 +02:00
Denis Ledoux 6e3e195324 [FIX] tests: chromium executable is chromium-browser
When installing chromium using apt
e.g apt install chromium-browser
the executable is `chromium-browser`,
not just `chromium`
2018-09-14 10:43:28 +02:00
Christophe Simonis 68d36512ef [MERGE] forward port branch saas-11.4 up to d78f23df84 2018-09-07 20:20:45 +02:00
Christophe Simonis 49c3264ce0 [MERGE] forward port branch saas-11.3 up to 4850fb0838 2018-09-07 14:43:48 +02:00
Christophe Simonis f19e6ce561 [MERGE] forward port branch 11.0 up to 213759b03e 2018-09-05 18:52:27 +02:00
Christophe Monniez e312ec71dd [FIX] tests: detect coverage and adjust timeout
When computing coverage, the tests are slowed down and the timeout is
often exceeded.

With this commit, HttpCase headless Chrome tests timeout is increased if
coverage is detected.
2018-09-05 15:30:49 +02:00
Christophe Monniez 69a24eb84b [FIX] tests: close Chrome and shutdown on SIGXCPU
When Odoo receive a SIGXCPU (CPU time limit reached), it shuts down
immediately. If a headless Chrome is running, it stays alive after the
Odoo shutdown.

With this commit, the signal is intercepeted and the Chrome browser is
properly closed before shutting down the Odoo server.
2018-09-05 15:30:49 +02:00
Christophe Monniez f468023bd9 [FIX] tests: properly stop chrome when no tab found
In some situations, Chrome remote debugging is sending an empty list of
opened tabs. In that case, an orphan Chrome process stays alive.

With this commit, Chrome is stopped properly in those situations.
2018-09-05 15:30:49 +02:00
Christophe Monniez c6ed80e1b6 [FIX] tests: disable screencast when no logfile
When an HttpCase browser_js test is started, the screencast is started
and is discarded at the end of the test if no logfile was provided by
the config.

This behavior can impact the performances.

With this commit, the screencast does not start at all if not needed.
2018-09-04 19:17:01 +02:00
Martin Trigaux a9cd97f58e [MOV] tests: move test to be executed
The test was in a folder not checked by the runbot
The test, as it, is actually failing and it will be corrected in the next commit
2018-09-03 11:02:55 +02:00
Christophe Monniez 580a0b2ef7 [FIX] tests: redirect chrome headless stdout and stderr to dev null
When executing a very long HttpCase browser_js test, it happens that one
of the chrome process PIPE is full (ie. clickEverywhere test).
In that case, the communication with Chrome is blocked.

With this commit the stdout and stderr of the Chrome process are
redirected to /dev/null.
2018-08-31 15:03:11 +02:00
XavierDo 73f1d59096 [FIX] tests, web_tour: improve js error display in build details
Since chrome headless has been merged, js error messages are
difficult to read: some information was missing or only displayed in
full all log.

All console.error() will now be displayed in build details, and will
appear just before the python assertion.

XMO's improvement will also be used on all log: Using module and
classname of the class calling phantomJS.

Also: some small improvements on error messages to make them easier to read

Note: this commit also shown that some error were not detected:
now we will fail in any case if js log an error.
2018-08-30 15:11:38 +02:00
Raphael Collet 2f7c03d9ca [IMP] base: add regular user admin as uid 2
User 1 simply becomes a technical user (inactive, no password).
2018-08-23 21:38:57 +02:00
Christophe Simonis 6fd68c28cd [FIX] core: use actual chrome/chromium executable on macOs. 2018-08-23 16:37:17 +02:00
Christophe Monniez 334804347a [FIX] tests: increase browser_js ready code timeout
Before starting a JS test/tour the _wait_ready method evaluates if the
test is ready with a timeout of 10 sec. From times to times, it happens
that the page is not ready after this timeout but the problem is hidden.

In order to help fixing that kind of issue, the timeout is increased to
60 sec and a warning is logged to emphasis the fact that an
issue exists.

Also some unused imports are removed with this commit
2018-08-22 16:17:38 +02:00
XavierDo 2831fa7926 [IMP] core, test_mail: improve query count assertions
-remove margin
With the spirit of making tests determinists,
we can remove margins to have a real test of query count.

-mock random on assert query count
bus gc is triggered using random. Therefore, when send_many is called,
we have 1% chance to have more query. Mocking random.random to 1
will disable gc during query count tests (not during warmup).
Could be interresting to put gc collection in a cron latter

-add more info on querycount
Adding file and line number on query count failure/info will help to update
the query counts.

-update query count based on enterprise
Update all query count with enterprise values (exactly)

-normalize query counts with enterprise
voip module add a read on activity type (during create) in enterprise,
leading to one more query but also more information in cache.
Therefore, the next assertion will need one more query to access this data
in community.
Adding an access to activity type in the first assertion will allow
to have the same cache state in community and enterprise.

Task: #1878588
PR: #26476
2018-08-21 16:56:54 +02:00
Raphael Collet b1cc28be00 [FIX] tests: clean up code
Closes #26467
2018-08-21 09:21:11 +02:00
Christophe Monniez c6fa1796af [FIX] tests: clean the browser even on failure
When a Chrome headless test fails the browser is not cleaned and could
lead to a mix with other tests when the same method is called.

Also, the multiline assertions gives an unreadable message when the
assertion fails.
Finally, it happens that a thread does not have an 'url' attribute and lead to a crash when the logger tries to show the thread url.

With this commit, the browser is cleaned, even on failure and the
assertions are now one line.

Closes:  #26432
2018-08-17 14:49:53 +02:00
Christophe Monniez 49fb7a4682 [FIX] tests: avoid traceback when websocket-client is not installed
The account module needs to import Form from "tests.common" causing a
traceback when websocket-client module is not installed.

As this module is only required for the tests, there is no reason to add
it to the "requirements.txt" file.

With this commit, Odoo account can be installed even when
websocket-client is not installed, in that case, the HttpCase tests that
needs to run Chrome headless will be skipped with a warning.

Closes: #26404
2018-08-16 15:07:43 +02:00
antonylesuisse de84ad9c1f [REF] tests: replace phantomjs by Chrome headless
As the phantomjs project was suspended[1], there was a need to change the js test
engine. Moreover, the engine was rather old and leading to non
deterministic crashes.

Chrome headless was choosen for simplicity and the long term vision of
the devtools protocol [2].

The 'phantom_js' method still exists but will be deprecated in
favor of 'browser_js' with the same parameters.

In order to communicate with the browser, the python websocket-client package
is needed.

[1] https://github.com/ariya/phantomjs/issues/15344
[2] https://chromedevtools.github.io/devtools-protocol/

#closes 25991
2018-08-16 11:45:43 +02:00
Xavier Morel 61a6347c54 [IMP] tests logging
* Make phantomjs logging clearer by logging within the test case's
  module, not odoo.tests.common.

  This way, a tour in e.g. point of sale is clearly logged as that,
  rather than be logged as odoo.tests.common.phantomjs and require
  hunting which module/test we happen to be in.

* Clarify tagging causes for exclusion of selection of tests.
2018-08-14 15:37:26 +02:00
Christophe Simonis 4797627259 [MERGE] forward port branch saas-11.4 up to 8d9366197e 2018-08-01 18:02:29 +02:00
Christophe Simonis a719cf2563 [MERGE] forward port branch saas-11.3 up to b4555df336 2018-07-30 17:02:28 +02:00
xmo-odoo abc1289a4c [ADD] pagebreak to core qweb 2018-07-25 16:53:11 +02:00
Christophe Simonis ba202dbe63 [MERGE] forward port branch saas-11.2 up to 3c521f6d05 2018-07-24 18:10:32 +02:00
Laurent Smet 45cde5ff38 [IMP] tests: added assertRecordValues() in BaseCase
This method will help to compare a recordset with their expected values, in the form of a list of dict

Was task: 1856976
Was PR #25129
2018-07-23 11:13:39 +02:00
Christophe Monniez 23d840ddce [DOC] cmdline,testing: add documentation for test-tags
Closes #25789
2018-07-20 08:17:21 +02:00
Christophe Simonis 73652a0b19 [MERGE] forward port branch saas-11.3 up to 50860317cc
Note: 1aacc96262 has been ignored and will
be forward-ported later
2018-06-15 13:27:27 +02:00