From f20adc19d2728f72e0fcfe5082b2356b7446fd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Fri, 4 Sep 2020 08:07:52 +0000 Subject: [PATCH] [FIX] mail:tests: "Timeout: the render didn't stop." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These tests assert that some user interactions didn't do something. The user interactions were mistakenly expecting to trigger some re-render. Task-2333810 closes odoo/odoo#57091 X-original-commit: b4c4086104d815442ff6f2e92f80513f2ffad5ab Signed-off-by: Sébastien Theys (seb) --- .../src/components/chatter/chatter_tests.js | 8 ++++---- .../src/components/discuss/tests/discuss_tests.js | 15 +++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/addons/mail/static/src/components/chatter/chatter_tests.js b/addons/mail/static/src/components/chatter/chatter_tests.js index d5c2932a6d7..e44ccd81115 100644 --- a/addons/mail/static/src/components/chatter/chatter_tests.js +++ b/addons/mail/static/src/components/chatter/chatter_tests.js @@ -9,6 +9,7 @@ const { afterNextRender, beforeEach, createRootComponent, + nextAnimationFrame, start, } = require('mail/static/src/utils/test_utils.js'); @@ -436,10 +437,9 @@ QUnit.test('do not post message with "Enter" keyboard shortcut', async function document.querySelector(`.o_ComposerTextInput_textarea`).focus(); document.execCommand('insertText', false, "Test"); }); - await afterNextRender(() => { - const kevt = new window.KeyboardEvent('keydown', { key: "Enter" }); - document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); - }); + const kevt = new window.KeyboardEvent('keydown', { key: "Enter" }); + document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); + await nextAnimationFrame(); assert.containsNone( document.body, '.o_Message', diff --git a/addons/mail/static/src/components/discuss/tests/discuss_tests.js b/addons/mail/static/src/components/discuss/tests/discuss_tests.js index 2983fcc11b2..c12e47f02cf 100644 --- a/addons/mail/static/src/components/discuss/tests/discuss_tests.js +++ b/addons/mail/static/src/components/discuss/tests/discuss_tests.js @@ -7,6 +7,7 @@ const { afterEach, afterNextRender, beforeEach, + nextAnimationFrame, start, } = require('mail/static/src/utils/test_utils.js'); @@ -2950,10 +2951,9 @@ QUnit.test('do not post message on non-mailing channel with "SHIFT-Enter" keyboa document.querySelector(`.o_ComposerTextInput_textarea`).focus(); document.execCommand('insertText', false, "Test"); }); - await afterNextRender(() => { - const kevt = new window.KeyboardEvent('keydown', { key: "Enter", shiftKey: true }); - document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); - }); + const kevt = new window.KeyboardEvent('keydown', { key: "Enter", shiftKey: true }); + document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); + await nextAnimationFrame(); assert.containsNone( document.body, '.o_Message', @@ -3058,10 +3058,9 @@ QUnit.test('do not post message on mailing channel with "Enter" keyboard shortcu document.querySelector(`.o_ComposerTextInput_textarea`).focus(); document.execCommand('insertText', false, "Test"); }); - await afterNextRender(() => { - const kevt = new window.KeyboardEvent('keydown', { key: "Enter" }); - document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); - }); + const kevt = new window.KeyboardEvent('keydown', { key: "Enter" }); + document.querySelector('.o_ComposerTextInput_textarea').dispatchEvent(kevt); + await nextAnimationFrame(); assert.containsNone( document.body, '.o_Message',