summaryrefslogtreecommitdiff
path: root/addons/web/static/tests
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2020-09-16 12:36:30 +0000
committerLucas Perais (lpe) <lpe@odoo.com>2020-09-28 13:29:56 +0000
commit4344d50a74b04ffed7a7113e8af2b8ad6800693e (patch)
tree1c29c8f8f8ccca81226803a06b83a3ae45af8407 /addons/web/static/tests
parente497fa0f6de6ae3c0ab3ffe3c3dec43037944d17 (diff)
[FIX] web: action_manager_tests: concurrency doAction: relax rpc assert
In general, the last actionManager's operation has priority over hanging previous ones. This means that the order of the RPC's done by the actionManager is deterministic. i.e. load_action, load_views However, when testing the concurrency, some RPC of an hanging actionManager operation (in this case a switchView to a form triggers a 'read'), may be fired anyway. Those are superfluous but irrelevant as long as the last displayed item is the one last asked by the user. This commit fixes the test 'execute a new action while switching to another controller' to not be bothered with an irrelevant controller's RPC messing with the orders of RPC. This is admittedly brutal, but justified with the current implementation of actionManager. closes odoo/odoo#57849 Related: odoo/enterprise#13280 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Diffstat (limited to 'addons/web/static/tests')
-rw-r--r--addons/web/static/tests/chrome/action_manager_tests.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js
index 6a0c4a7fad9..d2c1e45e791 100644
--- a/addons/web/static/tests/chrome/action_manager_tests.js
+++ b/addons/web/static/tests/chrome/action_manager_tests.js
@@ -1571,6 +1571,16 @@ QUnit.module('ActionManager', {
QUnit.test('execute a new action while switching to another controller', async function (assert) {
assert.expect(15);
+ /*
+ * This test's bottom line is that a doAction always has priority
+ * over a switch controller (clicking on a record row to go to form view).
+ * In general, the last actionManager's operation has priority because we want
+ * to allow the user to make mistakes, or to rapidly reconsider her next action.
+ * Here we assert that the actionManager's RPC are in order, but a 'read' operation
+ * is expected, with the current implementation, to take place when switching to the form view.
+ * Ultimately the form view's 'read' is superfluous, but can happen at any point of the flow,
+ * except at the very end, which should always be the final action's list's 'search_read'.
+ */
var def;
var actionManager = await createActionManager({
actions: this.actions,
@@ -1578,10 +1588,11 @@ QUnit.module('ActionManager', {
data: this.data,
mockRPC: function (route, args) {
var result = this._super.apply(this, arguments);
- assert.step(args.method || route);
if (args.method === 'read') {
+ assert.ok(true, "A 'read' should have been done. Check test's comment though.");
return Promise.resolve(def).then(_.constant(result));
}
+ assert.step(args.method || route);
return result;
},
});
@@ -1612,7 +1623,6 @@ QUnit.module('ActionManager', {
'load_views', // action 3
'/web/dataset/search_read', // search read of list view of action 3
'/web/action/load', // action 4
- 'read', // read the opened record of action 3 (this request is blocked)
'load_views', // action 4
'/web/dataset/search_read', // search read action 4
]);