Before this commit:
When using the native ResizeObserver, we might get "ResizeObserver loop
limit exceeded" errors but these can ignore, see [ResizeObserver Errors](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver#observation_errors).
This error was wrongly handled and would cause another when running tests
involving the ResizeObserver.
After this commit:
The error is now properly detected and ignored when running tests.
Part-of: odoo/odoo#117782
This commit adds an information in the topbar (thus always visible) to
indicate the number of QUnit.todo tests that have been completed and the
number of QUnit.todo tests that are uncompleted.
closesodoo/odoo#118402
Signed-off-by: Nicolas Seinlet (nse) <nse@odoo.com>
Python tests that run chrome headless wait for "test successful"
to be printed in the console to end the test with green status.
Tours and qunit suites logs that message when their work is done.
Commit [1] reworked the tour system and introduced some qunit
tests of the tour engine. However, running fake tours in qunit
tests produced the "test successful" message, which caused the end
of the suite. As a consequence, only a small part of the WebSuite
test suite was really executed.
This commit mocks console.log in those tour qunit tests, s.t. the
suite is now fully executed again.
[1] 3a798039d6
Part-of: odoo/odoo#115841
Before this commit, some QUnit asserts and test helpers taking a
"target" param (or equivalent) would try to evaluate it, among other
possibilites, as an HTMLElement.
This is too restrictive however, as all these helpers can also be
performed on 'Element' instances (querySelector, classList, etc.), which
covers other sub-classes than HTMLElement, such as the whole range of
SVG Elements.
This commit changes the checks for `instanceof HTMLElement` to
`instanceof Element` instead to allow the helpers to be used on the
whole range of native Elements.
Part-of: odoo/odoo#110819
Co-authored-by: Julien Mougenot <jum@odoo.com>
Here is a way to reproduce the problematic situation: with CRM
installed, go to Contacts, open one, clicks on its Opportunities
stat button, open one in form view, click on the "Customer" field
internal link to open again the contact in form view, delete the
record, and finally click on the first occurence of the contact
in the breadcrumbs.
Before this commit, it crashed because we ended up in an error
handler (formSaveErrorHandler) that doesn't deal with the fact
that originalError could be falsy. This is handled by the
legacyRejectPromiseHandler, but due to the low sequence of the
faulty handler, this one was executed after.
Same error would occur if you tried to open an url of a record
that doesn't exist.
This commit fixes the error handler sequences s.t. the crash no
longer occurs.
Issue reported in the feedback pad after migrating odoo.com to 16.0.
closesodoo/odoo#110545
X-original-commit: 8e78efa3dda2484b34422a66d3963c7b20915036
Signed-off-by: Samuel Degueldre <sad@odoo.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
A previous version tried to log qunit by module but it is still possible
to have multiple random errors in the same test occuring with different
combination. This will help to avoid duplicating automatically
parsed errors in this case.
Also skips the message if it is emppty/undefined.
Part-of: odoo/odoo#100238
This allows easier parsing of the logs for indeterministic errors, so
that when the same error happens in different build, it has the same
error message, as the stack trace contains the file name of the assets
which get generated with a different hash every time, while also
preserving the existence of potentially useful tracebacks to debug
indeterministic issues.
closesodoo/odoo#100028
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Since owl now uses error chains/causes when errors happen in the owl
lifecycle, when an error happens in the owl lifecycle, the displayed
tracebacks generally only contain the stack trace of where owl called
the corresponding lifecycle hook.
This commit modifies the error service and the error utils so that now,
when completing/annotating a traceback, we also add the tracebacks
(annotated when appropriate) of the error cause chain, as it contains
valuable debugging information.
This commit also makes it so that the QUnit suite logs the source of
each test failure (which may be an error with a chained stack trace)
closesodoo/odoo#98157
Signed-off-by: Géry Debongnie <ged@odoo.com>
Right now the qunit will log all results at the end.
This means that the runbot may wait for all qunit before detecting the
failure.
This also mean that all failure are in one ir.logging on runbot, making
the automated parsing difficult if multiple modules fails during the
same build.
We could also log all failure immediately, but grouping them my qunit
module will avoid duplicating logs for linked causes (one failure
leading to a `Expected %s assertions, but %s were run` message)
closesodoo/odoo#99912
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Before this commit, the isVisible helper would most of the time work as
expected, except if an element has display: contents. In that case, it
has no bounding box, but it may still be visible if one of its child
is visible.
This is particularly important since we want to set the display property
of all field components to "contents".
Part-of: odoo/odoo#96865
This function helped us managing the transition from the legacy
/web codebase to owl, and we don't need it anymore as there's no
test using it.
Part-of: odoo/odoo#97415
The new list and form views were merged recently [1], but they
weren't activated because they weren't 100% ready yet. This is now
the case. This commit adds those views to the view registry. As a
consequence, a lot of qunit tests and tours needed to be adapted,
mostly for selector changes.
We also add legacy list and form views to the view registry, with
keys 'legacy_list' and 'legacy_form'. This allows to force those
legacy views when necessary. For instance, we did it in views
using complex custom legacy x2many field widgets that haven't been
converted yet (we have a compatibility layer but it isn't complete
and doesn't support every advanced usecases).
[1] odoo/odoo#92475
Part-of: odoo/odoo#78221
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>
Co-authored-by: luvi <luvi@odoo.com>
Added debugTestId url searchParam that executes that test in debug mode.
While in debug mode, one can fully interact with it, and the console logs
the test's internal state.
closesodoo/odoo#92770
Signed-off-by: Géry Debongnie <ged@odoo.com>
Since Chromium 97, folded `<details>` content has non-zero computed
width and height which returns false-positive QUnit
`assert.isNotVisible()` calls.
In a nutshell, this was introduced in https://bugs.chromium.org/p/chromium/issues/detail?id=1185950
when Chromium implemented the ability for "Find in page" to search in folded
`<details>`. To do so, the `content-visibility` rule was used instead of
`display: none` which, even if functionally similar, has an impact on the
values returned by `getBoundingClientRect()` (i.e. used in
`assert.isNotVisible()`.
A regression report was filled in https://bugs.chromium.org/p/chromium/issues/detail?id=1276028
to highlight this change of behavior. What emerged from this report's
discussion is that Chromium has no intent to revert this change and
instead put the emphasis on avoiding to use `getBoundingClientRect()`
and similar methods for visibility check (even pushing a proposal for a
`Element.isVisible()` API; cf. https://github.com/w3c/csswg-drafts/issues/6850).
This commit works around this issue by forcing the content to `display:
none`, like in the previous Chromium versions.
closesodoo/odoo#91833
X-original-commit: b718e7eb5ceb827f59ac395577408b7bc54aa3f9
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
This commit adds an information in the topbar (thus always visible)
to indicate the number of tests that have passed, failed and the
number of tests that have been skipped.
closesodoo/odoo#87713
Signed-off-by: Samuel Degueldre <sad@odoo.com>
By default, dialogs are hidden in tests, s.t. we don't see them
flicker when running the test suite. There is a css rule to hide
them, only if there's no "debug" classname on the body.
This commit toggles this classname when a test is run with
QUnit.debug.
closesodoo/odoo#84694
Signed-off-by: Mathieu Duckerts-Antoine <dam@odoo.com>
In the next version of Owl, all exported terms are directly available
from the top level `owl` object. This commit aims to adapt existing
imports to this new system. This is done by importing any Owl property
used in files at the top, right after the `import` or `require`
statements.
closesodoo/odoo#82736
Related: odoo/enterprise#23609
Signed-off-by: Géry Debongnie <ged@odoo.com>
By delaying the check of `didLogInfo` until run end, it becomes
possible for the test suite to start running before all the test
modules have loaded, which leads to some of the modules loading after
the test suite "ends" and start running at that point, leading to
multiple teardowns of the test suite.
This would occur in the POS test suite, leading to the `QUnit.done`
callbacks running multiple times, and multiple `"test successful"` to
be emitted.
This has historically not been an issue (hence having remained
undiscovered), but with the "success state" being a `Future` it now
breaks the corresponding test, as a resolved future can not be
re-resolved.
Part-of: odoo/odoo#77735
The error is (apparently) benign and already suppressed in some parts
of the system, however it can (apparently) trigger locally during some
tests, causing the test to fail as the error is caught and converted
to a failure by QUnit.
Sadly QUnit does not offer a proper hook for this, so it has to be
suppressed by wrapping the existing handler and only calling it for
other errors.
- Error handlers have been simplified, handlers don't returns functions
anymore and take 3 params: env, uncaughtError and originalError.
- Source maps have been reintroduced.
- The original error message and name are now concatenated to
the "wrapper" error ones.
closesodoo-dev/odoo#895
Related: odoo-dev/enterprise#154
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
This commit is the first phase of the conversion of the web/ JS
codebase to the owl framework. The impact of this commit is two-fold.
First, it rewrites the framework part of web with a new system of
services and registries. Services allow to execute code (e.g. do rpcs,
setup things) before launching the application. They can also expose
an API to be used by other parts of the application (e.g. a notification
service would expose a function to display notifications). Services are
often a good extension point for external modules that want to execute
code at webclient startup. Registries offer another way to extend the
application. They provide well designed extension points to add
elements/behaviors from the outside (for instance, to add a systray item,
an error handler...).
Second, this commit initiates the conversion of the webclient to owl
with a top-down approach, around those notions of services and registries.
The root of the web application is now an owl application. Among others,
the WebClient, ActionManager, Navbar, UserMenu, DebugManager, Dialogs,
services (e.g. notification, ajax...) have been converted to the new
framework/architecture.
Legacy views and client actions are still supported (and used). They
will be converted in the next months, and at some point, the support
will be dropped.
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
Co-authored-by: Géry Debongnie <ged@odoo.com>
Co-authored-by: Samuel Degueldre <sad@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
Co-authored-by: Francois (fge) <fge@odoo.com>
Co-authored-by: Michael Mattiello (mcm) <mcm@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Co-authored-by: Lucas Perais (lpe) <lpe@odoo.com>
Co-authored-by: Jorge Pinna Puissant <jpp@odoo.com>