diff --git a/addons/mail/static/tests/helpers/test_utils.js b/addons/mail/static/tests/helpers/test_utils.js index 5e94b2d7152..48c7f643e33 100644 --- a/addons/mail/static/tests/helpers/test_utils.js +++ b/addons/mail/static/tests/helpers/test_utils.js @@ -204,11 +204,6 @@ function getOpenFormView(afterEvent, openView) { * @param {Deferred|Promise} [param0.messagingBeforeCreationDeferred=Promise.resolve()] * Deferred that let tests block messaging creation and simulate resolution. * Useful for testing working components when messaging is not yet created. - * @param {Object} [param0.waitUntilEvent] - * @param {String} [param0.waitUntilEvent.eventName] - * @param {String} [param0.waitUntilEvent.message] - * @param {function} [param0.waitUntilEvent.predicate] - * @param {integer} [param0.waitUntilEvent.timeoutDelay] * @param {string} [param0.waitUntilMessagingCondition='initialized'] Determines * the condition of messaging when this function is resolved. * Supported values: ['none', 'created', 'initialized']. @@ -234,7 +229,6 @@ async function start(param0 = {}) { const { discuss = {}, hasTimeControl, - waitUntilEvent, waitUntilMessagingCondition = 'initialized', } = param0; const advanceTime = hasTimeControl ? getAdvanceTime() : undefined; @@ -244,15 +238,7 @@ async function start(param0 = {}) { throw Error(`Unknown parameter value ${waitUntilMessagingCondition} for 'waitUntilMessaging'.`); } const messagingBus = new EventBus(); - const testSetupDoneDeferred = makeDeferred(); const afterEvent = getAfterEvent({ messagingBus }); - let waitUntilEventPromise; - if (waitUntilEvent) { - waitUntilEventPromise = afterEvent({ func: () => testSetupDoneDeferred.resolve(), ...waitUntilEvent, }); - } else { - testSetupDoneDeferred.resolve(); - waitUntilEventPromise = Promise.resolve(); - } const pyEnv = await getPyEnv(); param0.serverData = param0.serverData || getActionManagerServerData(); @@ -260,7 +246,7 @@ async function start(param0 = {}) { param0.serverData.views = { ...pyEnv.getViews(), ...param0.serverData.views }; let webClient; await afterNextRender(async () => { - webClient = await getWebClientReady({ ...param0, messagingBus, testSetupDoneDeferred }); + webClient = await getWebClientReady({ ...param0, messagingBus }); if (waitUntilMessagingCondition === 'created') { await webClient.env.services.messaging.modelManager.messagingCreatedPromise; } @@ -282,7 +268,6 @@ async function start(param0 = {}) { action['type'] = action['type'] || 'ir.actions.act_window'; await afterNextRender(() => doAction(webClient, action, { props: options })); }; - await waitUntilEventPromise; return { advanceTime, afterEvent, diff --git a/addons/mail/static/tests/helpers/webclient_setup.js b/addons/mail/static/tests/helpers/webclient_setup.js index ea9dd212be4..0fc6a3f415a 100644 --- a/addons/mail/static/tests/helpers/webclient_setup.js +++ b/addons/mail/static/tests/helpers/webclient_setup.js @@ -26,7 +26,7 @@ const ROUTES_TO_IGNORE = [ const WEBCLIENT_PARAMETER_NAMES = new Set(['legacyParams', 'mockRPC', 'serverData', 'target', 'webClientClass']); const SERVICES_PARAMETER_NAMES = new Set([ 'legacyServices', 'loadingBaseDelayDuration', 'messagingBeforeCreationDeferred', - 'messagingBus', 'services', 'testSetupDoneDeferred', + 'messagingBus', 'services', ]); /** @@ -50,8 +50,6 @@ const SERVICES_PARAMETER_NAMES = new Set([ * Deferred that let tests block messaging creation and simulate resolution. * Useful for testing components behavior when messaging is not yet created. * @param {EventBus} [param0.messagingBus] - * @param {Promise} [param0.testSetupDoneDeferred] The Promise to whose revolution has to be - * waited before starting the messaging service. * @returns {LegacyRegistry} The registry containing all the legacy services that will be passed * to the webClient as a legacy parameter. */ @@ -60,14 +58,12 @@ function setupMessagingServiceRegistries({ messagingBeforeCreationDeferred = Promise.resolve(), messagingBus, services, - testSetupDoneDeferred, }) { const serviceRegistry = registry.category('services'); patchWithCleanup(messagingService, { async _startModelManager() { const _super = this._super.bind(this); - await testSetupDoneDeferred; await messagingBeforeCreationDeferred; return _super(...arguments); }, @@ -115,8 +111,6 @@ function setupMessagingServiceRegistries({ * @param {Object} [param0.services] * @param {Object} [param0.loadingBaseDelayDuration] * @param {Object} [param0.messagingBeforeCreationDeferred] - * @param {Promise} [param0.testSetupDoneDeferred] The Promise to whose revolution has to be - * waited before starting the messaging service. * @param {EventBus} [param0.messagingBus] The event bus to be used by messaging. * @returns {WebClient} */