[FIX] web_editor: fix non-deterministic error in QUnit wysiwyg tests
Another try at fixing the non-deterministic error in the `field_html_test > save` QUnit test which use the JW wysiwyg editor. closes odoo/odoo#63409 X-original-commit: e3ff253e433397b05a809f1267083475b53c7fb5 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -271,14 +271,14 @@ QUnit.module('web_editor', {}, function () {
|
||||
'<field name="body" widget="html" style="height: 100px"/>' +
|
||||
'</form>',
|
||||
res_id: 1,
|
||||
mockRPC: function (route, args) {
|
||||
mockRPC: async function (route, args) {
|
||||
if (args.method === "write") {
|
||||
assert.strictEqual(args.args[1].body,
|
||||
'<p>t<span style="background-color:#00FFFF;">oto toto </span>toto</p><p>tata</p>',
|
||||
"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);
|
||||
|
||||
Reference in New Issue
Block a user