Skip to content
Snippets Groups Projects
Commit 1224345a 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#118836

X-original-commit: e02c3a18
Signed-off-by: default avatarRomain Derie (rde) <rde@odoo.com>
parent 486498dd
Branches
Tags
No related merge requests found
......@@ -113,7 +113,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 {
......@@ -124,6 +125,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
......@@ -274,6 +292,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.
Please register or to comment