diff --git a/addons/website/static/src/js/tours/tour_utils.js b/addons/website/static/src/js/tours/tour_utils.js index dbfc3f1bfc9fab17cc5a47597e45e1c70a714702..9b8e2ae9629416c1205cdfab215f253637b0474c 100644 --- a/addons/website/static/src/js/tours/tour_utils.js +++ b/addons/website/static/src/js/tours/tour_utils.js @@ -143,7 +143,8 @@ function changePaddingSize(direction) { /** * Click on the top right edit button - * @param {*} position Where the purple arrow will show up + * + * @deprecated use `clickOnEditAndWaitEditMode` instead to avoid race condition */ function clickOnEdit(position = "bottom") { return { @@ -154,6 +155,23 @@ function clickOnEdit(position = "bottom") { }; } +/** + * Click on the top right edit button and wait for the edit mode + * + * @param {string} position Where the purple arrow will show up + */ +function clickOnEditAndWaitEditMode(position = "bottom") { + return [{ + content: _t("<b>Click Edit</b> to start designing your homepage."), + trigger: "a[data-action=edit]", + position: position, + }, { + content: "Check that we are in edit mode", + trigger: '#oe_snippets.o_loaded', + run: () => null, // it's a check + }]; +} + /** * Simple click on a snippet in the edition area * @param {*} snippet @@ -278,6 +296,7 @@ return { changeOption, changePaddingSize, clickOnEdit, + clickOnEditAndWaitEditMode, clickOnSave, clickOnSnippet, clickOnText, diff --git a/addons/website/static/tests/tours/snippet_image_gallery.js b/addons/website/static/tests/tours/snippet_image_gallery.js index 0d390fa4aa38f70c0d02e0f52b3901fa3f38f7f1..d2fea7c12159db511936a579a7e21953ea44c358 100644 --- a/addons/website/static/tests/tours/snippet_image_gallery.js +++ b/addons/website/static/tests/tours/snippet_image_gallery.js @@ -8,7 +8,7 @@ tour.register("snippet_image_gallery", { test: true, url: "/", }, [ - wTourUtils.clickOnEdit(), + ...wTourUtils.clickOnEditAndWaitEditMode(), wTourUtils.dragNDrop({ id: "s_image_gallery", name: "Image Gallery",