From 3985edd5daad9f8f9185a8d097a729cd942f81da Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 21 Jun 2021 10:21:54 +0000 Subject: [PATCH] [FIX] web: missing action id warnings * Add test name when logging missing action ids, makes finding out which test causes the issue much simpler. * Suppress the warning emission in the one remaining test which triggers it, as testing invalid action IDs is exactly the purpose of the test. --- addons/web/static/tests/helpers/mock_server.js | 2 +- addons/web/static/tests/legacy/helpers/mock_server.js | 2 +- addons/web/static/tests/webclient/actions/misc_tests.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/web/static/tests/helpers/mock_server.js b/addons/web/static/tests/helpers/mock_server.js index f677b3e7298..318c48103cf 100644 --- a/addons/web/static/tests/helpers/mock_server.js +++ b/addons/web/static/tests/helpers/mock_server.js @@ -498,7 +498,7 @@ export class MockServer { if (!action) { // when the action doesn't exist, the real server doesn't crash, it // simply returns false - console.warn("No action found for ID " + kwargs.action_id); + console.warn(`No action found for ID ${kwargs.action_id} during test ${QUnit.config.current.testName}`); } return action || false; } diff --git a/addons/web/static/tests/legacy/helpers/mock_server.js b/addons/web/static/tests/legacy/helpers/mock_server.js index 0cea8e11fbf..2ce6392b56b 100644 --- a/addons/web/static/tests/legacy/helpers/mock_server.js +++ b/addons/web/static/tests/legacy/helpers/mock_server.js @@ -1160,7 +1160,7 @@ var MockServer = Class.extend({ if (!action) { // when the action doesn't exist, the real server doesn't crash, it // simply returns false - console.warn("No action found for ID " + kwargs.action_id); + console.warn(`No action found for ID ${kwargs.action_id} during test ${QUnit.config.current.testName} (legacy)`); } return action || false; }, diff --git a/addons/web/static/tests/webclient/actions/misc_tests.js b/addons/web/static/tests/webclient/actions/misc_tests.js index 3cde098f53d..578854c4a11 100644 --- a/addons/web/static/tests/webclient/actions/misc_tests.js +++ b/addons/web/static/tests/webclient/actions/misc_tests.js @@ -6,7 +6,7 @@ import core from "web.core"; import testUtils from "web.test_utils"; import Widget from "web.Widget"; import { makeTestEnv } from "../../helpers/mock_env"; -import { legacyExtraNextTick, patchWithCleanup } from "../../helpers/utils"; +import {hushConsole, legacyExtraNextTick, patchWithCleanup} from "../../helpers/utils"; import { createWebClient, doAction, @@ -97,6 +97,7 @@ QUnit.module("ActionManager", (hooks) => { QUnit.test("properly handle case when action id does not exist", async (assert) => { assert.expect(2); const webClient = await createWebClient({ serverData }); + patchWithCleanup(window, {console: hushConsole}, {pure: true}); patchWithCleanup(webClient.env.services.notification, { add(message) { assert.strictEqual(message, "No action with id '4448' could be found");