From 2cfafbbcaad98d1c9e9098cc7c7d442a5e709d0b Mon Sep 17 00:00:00 2001 From: tsm-odoo Date: Wed, 23 Aug 2023 08:59:41 +0000 Subject: [PATCH] [FIX] bus: keep user log in debug mode tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, the current user was cleared after every test. This is an issue since we can still interract with the page after the test is done when in debug mode. This commit fixes the issue by clearing the current user at the beginning of each test instead of the end. closes odoo/odoo#132801 Signed-off-by: Alexandre Kühn (aku) --- addons/bus/static/tests/helpers/mock_python_environment.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/bus/static/tests/helpers/mock_python_environment.js b/addons/bus/static/tests/helpers/mock_python_environment.js index 3f15404d24c..615469a5f17 100644 --- a/addons/bus/static/tests/helpers/mock_python_environment.js +++ b/addons/bus/static/tests/helpers/mock_python_environment.js @@ -76,7 +76,6 @@ async function getModelDefinitions() { } let _cookie = {}; -QUnit.testDone(() => (_cookie = {})); export const pyEnvTarget = { cookie: { get(key) { @@ -323,7 +322,10 @@ export async function startServer({ actions, views = {} } = {}) { }); pyEnv["mockServer"] = await makeMockServer({ actions, models, views }); pyEnv["mockServer"].pyEnv = pyEnv; - registerCleanup(() => (pyEnv = undefined)); + registerCleanup(() => { + pyEnv = undefined; + _cookie = {}; + }); if ("res.users" in pyEnv.mockServer.models) { const adminUser = pyEnv["res.users"].searchRead([["id", "=", pyEnv.adminUserId]])[0]; pyEnv.authenticate(adminUser.login, adminUser.password);