[FIX] website: the rte tour was undeterministic

The tour try to click on the language dropdown before the reloading of the
page if the server is slow.
To fix it, we avoid the reloading by the rte, and trigger the reload
in '_reload' method of editor menu who add the class 'o_wait_reload'.
We add a selector and trigger in the test to avoid undeterministic error.

closes odoo/odoo#36098

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Gorash
2019-09-04 14:45:31 +00:00
committed by David Monjoie
parent 66a0836974
commit 35829f2031
3 changed files with 7 additions and 4 deletions
@@ -113,7 +113,7 @@ var EditorMenu = Widget.extend({
save: function (reload) {
var self = this;
this.trigger_up('edition_will_stopped');
return this.wysiwyg.save(true).then(function (result) {
return this.wysiwyg.save(false).then(function (result) {
var $wrapwrap = $('#wrapwrap');
self.editable($wrapwrap).removeClass('o_editable');
if (result.isDirty && reload !== false) {
@@ -91,7 +91,7 @@ var WysiwygMultizone = Wysiwyg.extend({
save: function () {
if (this.isDirty()) {
return this._restoreMegaMenus()
.then(() => this.editor.save())
.then(() => this.editor.save(false))
.then(() => ({isDirty: true}));
} else {
return {isDirty: false};
+5 -2
View File
@@ -70,7 +70,7 @@ tour.register('rte_translator', {
}, {
content : "click language dropdown",
trigger : '.js_language_selector .dropdown-toggle',
extra_trigger: 'body:not(.o_wait_reload):not(:has(.note-editor))',
extra_trigger: 'body:not(.o_wait_reload):not(:has(.note-editor)) a[data-action="edit"]',
}, {
content: "click on french version",
trigger: '.js_language_selector a[data-url_code="fr_BE"]',
@@ -91,6 +91,7 @@ tour.register('rte_translator', {
action_helper.text('translated french text');
Wysiwyg.setRange(this.$anchor.contents()[0], 22);
this.$anchor.trigger($.Event( "keyup", {key: '_', keyCode: 95}));
this.$anchor.trigger('input');
},
}, {
content: "translate text with special char",
@@ -100,6 +101,7 @@ tour.register('rte_translator', {
this.$anchor.prepend('&lt;{translated}&gt;');
Wysiwyg.setRange(this.$anchor.contents()[0], 0);
this.$anchor.trigger($.Event( "keyup", {key: '_', keyCode: 95}));
this.$anchor.trigger('input');
},
}, {
content: "click on input",
@@ -120,6 +122,7 @@ tour.register('rte_translator', {
}, {
content: "check: content is translated",
trigger: '#wrap p font:first:contains(translated french text)',
extra_trigger: 'body:not(.o_wait_reload):not(:has(.note-editor)) a[data-action="edit_master"]',
run: function () {}, // it's a check
}, {
content: "check: content with special char is translated",
@@ -168,7 +171,7 @@ tour.register('rte_translator', {
}, {
content : "click language dropdown",
trigger : '.js_language_selector .dropdown-toggle',
extra_trigger: 'body:not(.o_wait_reload):not(:has(.note-editor))',
extra_trigger: 'body:not(.o_wait_reload):not(:has(.note-editor)) a[data-action="edit"]',
}, {
content: "return in french",
trigger : 'html[lang="en-US"] .js_language_selector .js_change_lang[data-url_code="fr_BE"]',