[FIX] web_editor, website: increase stability of ace test tour

This is an attempt at fixing a runbot race condition.
It was executed succesfully without any error on Multi build around
200 times on runbot.

Since [1] the reset button could be clicked before the HTML editor was
reloaded.
The `MutationObserver` in `tour_service.js` is debounced. Because of
this the states used to detect tour steps triggers might differ between
executions.
With the Reset button of the HTML editor not being hidden in the
rendered template, it might be detected before it gets hidden during
the `start` of `ace.js`.

This commit makes sure the the editor is both closed then reopened with
the Reset button visible before clicking on it, and also makes sure the
Reset button is not visible by default upon rendering.

[1]: https://github.com/odoo/odoo/commit/d20468c3463927a54c34688769a22b3949c5c465

runbot-3674

closes odoo/odoo#90453

X-original-commit: b35f127c86c1d271a76dae7186a96190e8558c73
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Benoit Socias
2022-05-04 10:55:59 +02:00
committed by Romain Derie
parent d9608b1932
commit af5bf85d34
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -45,7 +45,7 @@
</div>
<div id="ace-view-id">
<div class="float-right mb-2">
<button data-action="reset" type="button" class="btn btn-sm btn-danger"><i class="fa fa-undo"/> Reset</button>
<button data-action="reset" type="button" class="btn btn-sm btn-danger d-none"><i class="fa fa-undo"/> Reset</button>
<button data-action="format" type="button" class="btn btn-sm btn-link">Format</button>
</div>
<span class="o_ace_editor_resource_info"/>
@@ -211,6 +211,11 @@ tour.register('test_html_editor_scss', {
extra_trigger: `div.ace_line:contains("${demoCssModif}")`,
trigger: ".o_ace_view_editor button[data-action=save]",
},
{
content: "wait for reload",
trigger: ":not(.o_ace_view_editor)",
run: function () {}, // it's a check
},
{
content: "reset view (after reload, html editor should have been reopened where it was)",
trigger: '#ace-view-id button[data-action="reset"]',