This commit is a manual forward port of #62555. The tour test needed to be adapted because the navigation flow is slightly different: upon custom snippet creation, the editor page used to be saved and reloaded in 14.0 but this is not the case anymore. Before this commit the deletion of custom snippets failed because the button click event got intercepted by the drag'n'drop mechanism. The currentTarget of the event was used in an asynchronous call where it had already been replaced by the jQuery's event bubbling mechanism when invoking the other handler. After this commit the deletion of custom snippets works again and a test tour is introduced to make sure it does not get broken again task-2405854 closes odoo/odoo#63108 X-original-commit: 4de0519d5b54634604e22b32d91a099695378088 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com> Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
97 lines
2.9 KiB
JavaScript
97 lines
2.9 KiB
JavaScript
odoo.define('test_website.custom_snippets', function (require) {
|
|
'use strict';
|
|
|
|
var tour = require('web_tour.tour');
|
|
|
|
/**
|
|
* The purpose of this tour is to check the custom snippets flow:
|
|
*
|
|
* -> go to edit mode
|
|
* -> drag a banner into page content
|
|
* -> customize banner (set text)
|
|
* -> save banner as custom snippet
|
|
* -> confirm name (TODO: remove when implicit default name feature is implemented)
|
|
* -> go to blocks
|
|
* -> ensure custom snippet is available
|
|
* -> drag custom snippet
|
|
* -> ensure block appears as banner
|
|
* -> ensure block appears as custom banner
|
|
* -> delete custom snippet
|
|
* -> confirm delete
|
|
* -> ensure it was deleted
|
|
*/
|
|
|
|
tour.register('test_custom_snippet', {
|
|
url: '/',
|
|
test: true
|
|
}, [
|
|
{
|
|
content: "enter edit mode",
|
|
trigger: "a[data-action=edit]"
|
|
},
|
|
{
|
|
content: "drop a snippet",
|
|
trigger: "#oe_snippets .oe_snippet[name='Banner'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
|
|
extra_trigger: "body.editor_enable.editor_has_snippets",
|
|
moveTrigger: ".oe_drop_zone",
|
|
run: "drag_and_drop #wrap",
|
|
},
|
|
{
|
|
content: "customize snippet",
|
|
trigger: "#wrapwrap .s_banner h1",
|
|
run: "text",
|
|
consumeEvent: "input",
|
|
},
|
|
{
|
|
content: "save custom snippet",
|
|
trigger: ".snippet-option-SnippetSave we-button",
|
|
},
|
|
{
|
|
content: "confirm save name",
|
|
trigger: ".modal-dialog button span:contains('Save')",
|
|
},
|
|
{
|
|
content: "go to blocks",
|
|
trigger: ".o_we_add_snippet_btn",
|
|
},
|
|
{
|
|
content: "ensure custom snippet appeared",
|
|
trigger: "#oe_snippets .oe_snippet[name='Custom Banner']",
|
|
run: function() {}, // check
|
|
},
|
|
{
|
|
content: "drop custom snippet",
|
|
trigger: ".oe_snippet[name='Custom Banner'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
|
|
extra_trigger: "body.editor_enable.editor_has_snippets",
|
|
moveTrigger: ".oe_drop_zone",
|
|
run: "drag_and_drop #wrap",
|
|
},
|
|
{
|
|
content: "ensure banner section exists",
|
|
trigger: "#wrap section[data-name='Banner']",
|
|
run: function() {}, // check
|
|
},
|
|
{
|
|
content: "ensure custom banner section exists",
|
|
trigger: "#wrap section[data-name='Custom Banner']",
|
|
run: function() {}, // check
|
|
},
|
|
{
|
|
content: "delete custom snippet",
|
|
trigger: ".oe_snippet[name='Custom Banner'] we-button.o_delete_btn",
|
|
extra_trigger: ".oe_snippet[name='Custom Banner'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
|
|
},
|
|
{
|
|
content: "confirm delete",
|
|
trigger: ".modal-dialog button:has(span:contains('Yes'))",
|
|
},
|
|
{
|
|
content: "ensure custom snippet disappeared",
|
|
trigger: "#oe_snippets",
|
|
extra_trigger: "#oe_snippets:not(:has(.oe_snippet[name='Custom Banner']))",
|
|
run: function() {}, // check
|
|
},
|
|
]);
|
|
|
|
});
|