Friday, December 20, 2019
2 changes
Resolved issues and error corrections
This fix adjusts an internal web testing helper so automated tests wait for screen updates in the correct order. It reduces random test failures, helping developers validate changes more reliably without affecting everyday users.
Original PR description
Revision on [1]. Commit above made changes to test helper `nextTick()`, so that it waits for `window.nextAnimationFrame()` (shorten, 'rAF'). This was useful to wait for OWL rendering, since OWL…
Revision on [1]. Commit above made changes to test helper `nextTick()`, so that it waits for `window.nextAnimationFrame()` (shorten, 'rAF'). This was useful to wait for OWL rendering, since OWL renders on next animation frame. From a theoretical standpoint, the helper should wait at least as much time as before, as it adds either no slowdown (rAF is readily available), or a few milliseconds wait (rAF waits for next available animation frame). However, some old tests show non-deterministic behaviours, resulting to crashes [2]. It suggested, for some reasons, that `nextTick()` did not wait long enough for re-render... Which is surprising considering explanation above! Some of these tests have been fixed, assuming it was caused by un- guaranteed order of successive `setTimeout(0)` [3]. Unfortunately, this does not explain why it never crashed before the change on `nextTick()`... After investigation, we think that this behaviour comes from rAFs having their own task queue, which no longer guarantees that queued tasks happen after queued micro-tasks: When the requested next animation frame is readily available, the callback of `requestAnimationFrame()` is immediately called and waits for `setTimeout(0)`. The `setTimeout(0)` await is resolved before any other queued async micro-tasks, so that `nextTick()` is resolved sooner than expected. This would explain how `nextTick()` does not wait long enough for rendering from the loads of resolved Promises, even though there is a promise resolution after `setTimeout(0)`. This commit fixes the issue by moving the await `setTimeout(0)` before the rAF call, so that it correctly waits render from chain of resolved promises (since the `setTimeout(0)` is awaited in the same main task queue). [1] https://github.com/odoo/odoo/commit/b0941d19a07b08fabc64a284b58e57edc46203dd [2] http://runbot.odoo.com/runbot/build/771505 and http://runbot.odoo.com/runbot/build/752855 [3] https://github.com/odoo/odoo/commit/6cbfdbce2d0f1b567b6a6d6f637fe2a476980acc
This fixes how Marketing Automation determines the mailing type linked to a campaign. It helps ensure campaigns use the correct mailing information, reducing errors or inconsistencies when managing automated mailings.
Original PR description
Oversight of cf06cabd9743d955cbf700fdee1dea28a7c65cae Task #2088158