*: test_website, website_blog, website_crm, website_event, website_forum, website_hr_recruitment, website_mass_mailing, website_sale, website_sale_wishlist, website_slides - Make sure that all website tours reaching the website preview before their first step use the related website util to register their tour. - Rename the website util to register a tour starting on the website preview from `registerEditionTour` to `registerWebsitePreviewTour`. Having a method using "Edition" in its name and having a boolean parameter named `edition` was a bit... strange. - For both non edit mode and edit mode as a first step, ensure the util sets a high timeout for the first step. Indeed loading both the backend and the frontend (in the iframe) and potentially starting the edit mode can take a long time in automatic tests. We'll try and decrease the need for this high timeout of course. - Review the implementation of those utils to be more consistent and also fix one or two mistakes in them. closes odoo/odoo#100024 Related: odoo/design-themes#588 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
62 lines
2.8 KiB
JavaScript
62 lines
2.8 KiB
JavaScript
odoo.define("website.tour.snippet_version", function (require) {
|
|
"use strict";
|
|
|
|
const wTourUtils = require('website.tour_utils');
|
|
|
|
wTourUtils.registerWebsitePreviewTour("snippet_version", {
|
|
edition: true,
|
|
url: "/",
|
|
test: true,
|
|
}, [{
|
|
content: "Drop s_test_snip snippet",
|
|
trigger: '#oe_snippets .oe_snippet:has(.s_test_snip) .oe_snippet_thumbnail',
|
|
run: "drag_and_drop iframe #wrap",
|
|
}, {
|
|
content: "Drop s_text_image snippet",
|
|
trigger: '#oe_snippets .oe_snippet:has(.s_text_image) .oe_snippet_thumbnail:not(.o_we_already_dragging)',
|
|
run: "drag_and_drop iframe #wrap",
|
|
}, {
|
|
content: "Test t-snippet and t-snippet-call: snippets have data-snippet set",
|
|
trigger: '#oe_snippets .o_panel_body > .oe_snippet.ui-draggable',
|
|
run: function () {
|
|
// Tests done here as all these are not visible on the page
|
|
const draggableSnippets = document.querySelectorAll('#oe_snippets .o_panel_body > .oe_snippet.ui-draggable > :nth-child(2)');
|
|
if (![...draggableSnippets].every(el => el.dataset.snippet)) {
|
|
console.error("error Some t-snippet are missing their template name");
|
|
}
|
|
if (!document.querySelector('#oe_snippets [data-snippet="s_test_snip"] [data-snippet="s_share"]')) {
|
|
console.error("error s_share t-called inside s_test_snip is missing template name");
|
|
}
|
|
if (!document.querySelector('iframe:not(.o_ignore_in_tour)').contentDocument.querySelector('#wrap [data-snippet="s_test_snip"] [data-snippet="s_share"]')) {
|
|
console.error("error Dropped a s_test_snip snippet but missing s_share template name in it");
|
|
}
|
|
},
|
|
},
|
|
...wTourUtils.clickOnSave(),
|
|
wTourUtils.clickOnEdit(),
|
|
{
|
|
content: "Modify the version of snippets",
|
|
trigger: '#oe_snippets .o_panel_body > .oe_snippet',
|
|
run: function () {
|
|
document.querySelector('#oe_snippets .oe_snippet > [data-snippet="s_test_snip"]').dataset.vjs = '999';
|
|
document.querySelector('#oe_snippets .oe_snippet > [data-snippet="s_share"]').dataset.vcss = '999';
|
|
document.querySelector('#oe_snippets .oe_snippet > [data-snippet="s_text_image"]').dataset.vxml = '999';
|
|
},
|
|
}, {
|
|
content: "Edit s_test_snip",
|
|
trigger: 'iframe #wrap.o_editable .s_test_snip',
|
|
}, {
|
|
content: "Edit text_image",
|
|
extra_trigger: 'we-customizeblock-options:contains(Test snip) .snippet-option-VersionControl > we-alert',
|
|
trigger: 'iframe #wrap.o_editable .s_text_image',
|
|
}, {
|
|
content: "Edit s_share",
|
|
extra_trigger: 'we-customizeblock-options:contains(Text - Image) .snippet-option-VersionControl > we-alert',
|
|
trigger: 'iframe #wrap.o_editable .s_share',
|
|
}, {
|
|
content: "s_share is outdated",
|
|
extra_trigger: 'we-customizeblock-options:contains(Share) .snippet-option-VersionControl > we-alert',
|
|
trigger: 'iframe body',
|
|
}]);
|
|
});
|