[FIX] web_editor: wait editor loading in tests

In a undeterministic circumnstance, the editor has not enough
time to be loaded after `testUtils.nextTick()`.

By using a 100ms timeout instead, it will give more time for
the editor to be loaded and therfore reduce the risk of a false
negative to appear.

closes odoo/odoo#76980

X-original-commit: 190ddf08b8bb6c4750f1d0ad1c57f19b936794de
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
This commit is contained in:
Nicolas Bayet
2021-09-22 18:13:49 +00:00
parent 1bdfdae121
commit 5b7151e0ef
@@ -168,7 +168,7 @@ QUnit.module('web_editor', {}, function () {
"should have applied the style correctly");
await testUtils.form.clickEdit(form);
await testUtils.nextTick();
await new Promise((resolve)=>setTimeout(resolve, 100));
$field = form.$('.oe_form_field[name="body"]');
assert.strictEqual($field.find('.note-editable').html(),
'<p>toto toto toto</p><p>tata</p>',
@@ -191,7 +191,7 @@ QUnit.module('web_editor', {}, function () {
});
// check that there is no error on clicking Edit
await testUtils.form.clickEdit(form);
await testUtils.nextTick();
await new Promise((resolve)=>setTimeout(resolve, 100));
assert.containsOnce(form, '.o_form_editable');
form.destroy();
@@ -222,7 +222,7 @@ QUnit.module('web_editor', {}, function () {
}, true);
await testUtils.form.clickEdit(form);
await testUtils.nextTick();
await new Promise((resolve)=>setTimeout(resolve, 100));
await testUtils.dom.click(form.$('.o_form_button_save'));
form.destroy();
@@ -440,7 +440,7 @@ QUnit.module('web_editor', {}, function () {
"should have rendered a div with correct content in readonly");
await testUtils.form.clickEdit(form);
await testUtils.nextTick();
await new Promise((resolve)=>setTimeout(resolve, 100));
$field = form.$('.oe_form_field[name="body"]');
// the dialog load some xml assets
const defLinkDialog = testUtils.makeTestPromise();
@@ -488,7 +488,7 @@ QUnit.module('web_editor', {}, function () {
"should have rendered a div with correct content in readonly");
await testUtils.form.clickEdit(form);
await testUtils.nextTick();
await new Promise((resolve)=>setTimeout(resolve, 100));
$field = form.$('.oe_form_field[name="body"]');
// the dialog load some xml assets
const defLinkDialog = testUtils.makeTestPromise();
@@ -536,7 +536,7 @@ QUnit.module('web_editor', {}, function () {
"should have rendered a div with correct content in readonly");
await testUtils.form.clickEdit(form);
await testUtils.nextTick();
await new Promise((resolve)=>setTimeout(resolve, 100));
$field = form.$('.oe_form_field[name="body"]');
// the dialog load some xml assets
const defLinkDialog = testUtils.makeTestPromise();
@@ -585,7 +585,7 @@ QUnit.module('web_editor', {}, function () {
"should have rendered a div with correct content in readonly");
await testUtils.form.clickEdit(form);
await testUtils.nextTick();
await new Promise((resolve)=>setTimeout(resolve, 100));
$field = form.$('.oe_form_field[name="body"]');
// the dialog load some xml assets
const defLinkDialog = testUtils.makeTestPromise();
@@ -615,7 +615,7 @@ QUnit.module('web_editor', {}, function () {
"the link should be created with the right format");
await testUtils.form.clickEdit(form);
await testUtils.nextTick();
await new Promise((resolve)=>setTimeout(resolve, 100));
$field = form.$('.oe_form_field[name="body"]');
pText = $field.find('.note-editable a').eq(0).contents()[0];