-
Notifications
You must be signed in to change notification settings - Fork 29.7k
PRHOOT 28 #189710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
PRHOOT 28 #189710
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fa67fac
to
9ec2d34
Compare
0fa2171
to
a5185cb
Compare
1db3b13
to
50d47bd
Compare
Closed
Closed
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
This commit allows the `mockService` test helper to patch services having an async `start` method. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
This commit ensures that the time values used to determine whether an interaction is a long touch in the Hoot interactions use the publicly available `Date.now()` value. This has been done for consistency's sake, as most interaction environment variables are taken from the global scope and not the protected one, to allow tests to affect these global variables. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
Before this commit, the red banner indicating module loader failures would simply be added to the head of the document (without waiting for it to load) and its reference would essentially be lost. This is an issue as several tests do spawn that banner, and it remains for the duration of the test run as the head is not systematically cleaned up. This commit adds a class name to this tag to identify such banners and prevent them from being added in tests spawning one. It also handles the wait for the document to be ready, and improves error message assertions robustness. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
This commit allows the `defineMenus` test helper to accept a flat list of objects instead of a hierarchy of parent/child menus when defining mock menus. Additionally, it allows to override previously defined menu items by defining a menu with the same ID. For consistency, the same has been done to actions in `defineActions` (instead of throwing an error). Finally, it adds error handling in case a given child menu ID is missing from the `load_menus` call. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
This commit intents on reducing the memory footprint of a full test run. To achieve this, the following fixes have been introduced: - completely removing CSS transitions ("animation" & "transition" properties) by default, and allowing to also remove JS transitions ( `animate` & "smooth" scrolls); - no more reliance on trusted events in tests dispatched by native element methods, such as `scroll()`, `focus()`, etc., and dispatch "programmatic" events instead (this allows to ensure consistent event timing and properties); - explicitly cleaning up the fixture after each test requiring one, as well as the event handlers that may have been attached to it; - explicitly cleaning up all global mocked objects extending the 'EventTarget' class, effectively taking more objects into account (like SharedWorkers, WebSockets, etc.). Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
This commit refactors the test results in Hoot to display more informations about test "events" (interactions, querries, assertions, etc.). It also allows tests to pass with "query" events (i.e. `waitFor` or `contains`) without "assertion" events (i.e. `expect().to...`). Additionnaly, the 'expect.errors' API was broken because it allowed tests to end without calling 'expect.verifyError'. This has been fixed and affected tests have been adapted. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
This commit allows tests to be properly displayed with the `multi` modifier, i.e. showing the amount of times a test/suite has been run, as well as the duration of each individual test result. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
This commit improves 2 expect matchers in Hoot: - `toHaveClass`: can now take an `exact` option, to assert that the element(s) class list only contains the given class names (regardless of the order); - `toHaveStyle`: can now take an `inline` option to only take into account the element(s) inline style, instead of the computed style. It also accepts an `exact` option (similar to `toHaveClass`), to assert that the inline style only contains the desired properties. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
This commit properly sets the `mock_module_loader` file as an IIFE to avoid confusion when using it, as it was considered as an odoo module and worked "by accident" simply because all other modules loaded before it were libs and would be executed anyway; now, it is still loaded in the same order, but will be marked as an IIFE to ensure its immediate execution. This commit also renames the `mock_module_loader` file to `hoot_module_loader` to better reflect what it actually does (i.e. loading ".hoot" files). It also isolates the call to the `runTests` function (initiating unit tests) in a separate file, to make it re-usable and clarify the initiating steps of a test run. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
This commit handles a few things: - it introduces a `mockMatchMedia` helper to easily match any media query property querried from the JS side (not CSS); - it allows `mockTouch` to be properly cleaned up between tests, instead of being set permanently from the time it is called; - it fixes & unskips a few tests. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
This commit ensures that, should a suite be automatically selected & unfolded in the sidebar due to it being the only one matching the current filters, it will be also scrolled to. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
Before this commit, the mock response objects generated from mock requests in Hoot would only consider text payloads (event JSON objects were interpreted as text as per the XHR specification). However, this shouldn't be the case for "blob://" responses, as the `response` property should return the parsed array buffer instead of the text value of the payload. This commit adds an exception for "blob://" requests to return the correct response type. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
Before this commit, "data:..." shaped URLs would be treated the same as any other URL that should be mocked. This shouldn't be the case since these URLs are used to produce images from base64-encoded strings, so using fetch with such URLs won't call the server. This commit adds an exclusion for these URLs in the mocked fetch function. Part-of: odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
gamarino
pushed a commit
to numaes/numa-public-odoo
that referenced
this pull request
Mar 7, 2025
Before this commit, a global cache ensured that actual fetch requests' responses could be cached and re-used between tests. The issue is that a response object's body can only be read one time. This commit now returns clones of these cached responses so that their body can be used once per call. closes odoo/odoo#189710 Related: odoo/enterprise#78636 Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request HOOT (PRHOOT) 28
This pull requests brings various improvements and fixes to Hoot and the Odoo unit test ecosystem. See the different commit messages for more details.
Note: these changes are made in stable to avoid having to support multiple versions of the HOOT API. As such, these changes are intended to be strictly limited to unit tests as to not put the rest of the code base at risk.
Enterprise: https://github.com/odoo/enterprise/pull/78636
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr