diff --git a/addons/web_editor/static/tests/field_html_tests.js b/addons/web_editor/static/tests/field_html_tests.js index ac0b8d3a695..ebb54a47f53 100644 --- a/addons/web_editor/static/tests/field_html_tests.js +++ b/addons/web_editor/static/tests/field_html_tests.js @@ -271,14 +271,14 @@ QUnit.module('web_editor', {}, function () { '' + '', res_id: 1, - mockRPC: function (route, args) { + mockRPC: async function (route, args) { if (args.method === "write") { assert.strictEqual(args.args[1].body, '

toto toto toto

tata

', "should save the content"); } - return this._super.apply(this, arguments); + return await this._super.apply(this, arguments); }, }); await testUtils.form.clickEdit(form); @@ -297,7 +297,12 @@ QUnit.module('web_editor', {}, function () { } await testUtils.nextTick(); + // Fake an editor command to force the QUnit test scenario to wait + // until all the mutex are processed in the JW editor await new Promise((resolve) => wysiwyg.execCommand(resolve)); + // Add a small delay to ensure the FollowRange menu is available in the DOM + // before the openColorPicker() method will try to click on a buton inside the menu + await new Promise(resolve => setTimeout(resolve, 100)); await openColorpicker(); await testUtils.nextTick(); @@ -308,8 +313,9 @@ QUnit.module('web_editor', {}, function () { await new Promise((resolve) => wysiwyg.execCommand(resolve)); await testUtils.form.clickSave(form); - await wysiwyg.isEditorStoppedPromise; + await testUtils.nextTick(); form.destroy(); + await wysiwyg.isEditorStoppedPromise; }); QUnit.test('media dialog: image', async function (assert) { assert.expect(1);