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
closesodoo/odoo#28144
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#26456Closes#28053
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).
closesodoo/odoo#28194
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.
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.
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.
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.
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.
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.
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
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
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
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
* 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.
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.
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.
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.
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.
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.
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.
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.
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
-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
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
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
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
* 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.