Skip to content
Snippets Groups Projects
Commit e02c3a18 authored by Guillaume (gdi)'s avatar Guillaume (gdi) Committed by Romain Derie
Browse files

[FIX] website: add a robust utility to enter in edit mode


This commit creates a new util which clicks on edit and waits for the
edit mode to be started. This way, we make sure that the edit mode is
enabled before testing the next step of the test. This avoids race
conditions during tests.

Note that we leave the old clickOnEdit util as it could be used in
custom codes and we don't want to break them.

task-3203820

closes odoo/odoo#116490

Signed-off-by: default avatarRomain Derie (rde) <rde@odoo.com>
parent fc720940
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment