[FIX] website, *: add a robust utility to enter in edit mode
*: test_website, website_blog, website_crm, website_hr_recruitment, website_mass_mailing, website_sale, website_sale_wishlist, website_slides 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. This commit replaces all the uses of the old util with the new one, it also removes the steps that are waiting for the edit mode to start. Finally, from [this other commit], we can start a tour in edit mode. For these tests (which have `edition: true`), it is useless to check if the edit mode has started at the beginning of the test because this check is already done by default. This commit removes unnecessary / duplicated steps. [this other commit]: https://github.com/odoo/odoo/commit/99b50d18e220aedf14de806f4bf1b2d35c32de35#diff-c7720501ec33f5f92c907d8bb41de50edd832a4564317073e801a6915796a6bdR278 task-3203820 closes odoo/odoo#120481 X-original-commit: https://github.com/odoo/odoo/commit/9fd5d25f59578abc9c608578a7d2e2953880b582 Related: odoo/design-themes#656 Signed-off-by: Romain Derie (rde) <rde@odoo.com> Signed-off-by: Guillaume-gdi <gdi@odoo.com>
This commit is contained in:
@@ -28,8 +28,7 @@ wTourUtils.registerWebsitePreviewTour('test_custom_snippet', {
|
||||
}, [
|
||||
{
|
||||
content: "drop a snippet",
|
||||
trigger: "#oe_snippets.o_loaded .oe_snippet[name='Banner'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
|
||||
extra_trigger: "iframe body.editor_enable",
|
||||
trigger: ".oe_snippet[name='Banner'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
|
||||
moveTrigger: ".oe_drop_zone",
|
||||
run: "drag_and_drop iframe #wrap",
|
||||
},
|
||||
|
||||
@@ -12,10 +12,10 @@ const VIDEO_URL = 'https://www.youtube.com/watch?v=Dpq87YCHmJc';
|
||||
wTourUtils.registerWebsitePreviewTour('test_replace_media', {
|
||||
url: '/',
|
||||
test: true,
|
||||
edition: true,
|
||||
}, [
|
||||
wTourUtils.clickOnEdit(),
|
||||
{
|
||||
trigger: '.editor_enable.editor_has_snippets',
|
||||
trigger: "body",
|
||||
run: function () {
|
||||
// Patch the VideoDialog so that it does not do external calls
|
||||
// during the test (note that we don't unpatch but as the patch
|
||||
|
||||
@@ -21,7 +21,7 @@ wTourUtils.registerWebsitePreviewTour('test_reset_page_view_complete_flow_part1'
|
||||
[
|
||||
{
|
||||
content: "drop a snippet",
|
||||
trigger: "#oe_snippets.o_loaded .oe_snippet:has(.s_cover) .oe_snippet_thumbnail",
|
||||
trigger: ".oe_snippet:has(.s_cover) .oe_snippet_thumbnail",
|
||||
// id starting by 'oe_structure..' will actually create an inherited view
|
||||
run: "drag_and_drop iframe #oe_structure_test_website_page",
|
||||
},
|
||||
|
||||
@@ -139,20 +139,6 @@ function changePaddingSize(direction) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Click on the top right edit button
|
||||
* @param {*} position Where the purple arrow will show up
|
||||
*/
|
||||
function clickOnEdit(position = "bottom") {
|
||||
return {
|
||||
trigger: ".o_menu_systray .o_edit_website_container a",
|
||||
content: Markup(_t("<b>Click Edit</b> to start designing your homepage.")),
|
||||
extra_trigger: "body:not(.editor_has_snippets)",
|
||||
position: position,
|
||||
timeout: 30000,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple click on an element in the page.
|
||||
* @param {*} elementName
|
||||
@@ -166,6 +152,23 @@ function clickOnElement(elementName, selector) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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: ".o_menu_systray .o_edit_website_container a",
|
||||
position: position,
|
||||
}, {
|
||||
content: "Check that we are in edit mode",
|
||||
trigger: ".o_website_preview.editor_enable.editor_has_snippets",
|
||||
run: () => null, // it's a check
|
||||
}];
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple click on a snippet in the edition area
|
||||
* @param {*} snippet
|
||||
@@ -403,8 +406,8 @@ export default {
|
||||
changeImage,
|
||||
changeOption,
|
||||
changePaddingSize,
|
||||
clickOnEdit,
|
||||
clickOnElement,
|
||||
clickOnEditAndWaitEditMode,
|
||||
clickOnSave,
|
||||
clickOnSnippet,
|
||||
clickOnText,
|
||||
|
||||
@@ -44,10 +44,9 @@ wTourUtils.changeOption('ConditionalVisibility', 'we-toggler'),
|
||||
}
|
||||
},
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'Check if the element is visible as it should always be visible in edit view',
|
||||
extra_trigger: 'body.editor_has_snippets',
|
||||
trigger: 'iframe #wrap .s_text_image',
|
||||
run: function (actions) {
|
||||
const style = window.getComputedStyle((this.$anchor[0]));
|
||||
|
||||
@@ -22,7 +22,6 @@ wTourUtils.registerWebsitePreviewTour('edit_megamenu', {
|
||||
// Add a megamenu item to the top menu.
|
||||
{
|
||||
content: "Click on a menu item",
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
trigger: 'iframe #top_menu .nav-item a',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -42,11 +42,10 @@ wTourUtils.registerWebsitePreviewTour('edit_menus', {
|
||||
run: () => {}, // It's a check.
|
||||
},
|
||||
// Add a menu item in edit mode.
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "Click on a menu item",
|
||||
trigger: 'iframe #top_menu .nav-item a',
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
},
|
||||
{
|
||||
content: "Click on Edit Menu",
|
||||
@@ -117,10 +116,9 @@ wTourUtils.registerWebsitePreviewTour('edit_menus', {
|
||||
run: () => {}, // it's a check
|
||||
},
|
||||
// Edit the menu item from the "edit menu" popover button
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "Click on the 'Modnar' link",
|
||||
extra_trigger: "#oe_snippets.o_loaded",
|
||||
trigger: 'iframe #top_menu .nav-item a:contains("Modnar")',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import wTourUtils from "website.tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('edit_translated_page_redirect', {
|
||||
test: true,
|
||||
@@ -11,13 +12,14 @@ registry.category("web_tour.tours").add('edit_translated_page_redirect', {
|
||||
trigger: 'a.o_frontend_to_backend_edit_btn',
|
||||
},
|
||||
{
|
||||
content: "Enter edit mode",
|
||||
extra_trigger: 'iframe main:has([data-for="contactus_form"])',
|
||||
trigger: '.o_edit_website_container > a',
|
||||
},
|
||||
content: "Check the data-for attribute",
|
||||
trigger: 'iframe main:has([data-for="contactus_form"])',
|
||||
run: () => {}, // it's a check
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'check editor dashboard',
|
||||
trigger: '#oe_snippets.o_loaded',
|
||||
content: "Go to /nl",
|
||||
trigger: "body",
|
||||
run: () => {
|
||||
// After checking the presence of the editor dashboard, we visit a
|
||||
// translated version of the homepage. The homepage is a special
|
||||
@@ -29,14 +31,5 @@ registry.category("web_tour.tours").add('edit_translated_page_redirect', {
|
||||
content: "Enter backend",
|
||||
trigger: 'a.o_frontend_to_backend_edit_btn',
|
||||
},
|
||||
{
|
||||
content: "Enter edit mode",
|
||||
extra_trigger: 'iframe #wrapwrap',
|
||||
trigger: '.o_edit_website_container > a',
|
||||
},
|
||||
{
|
||||
content: 'check editor dashboard',
|
||||
trigger: '#oe_snippets.o_loaded',
|
||||
run: () => {},
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
]});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import wTourUtils from 'website.tour_utils';
|
||||
|
||||
const blockIDToData = {
|
||||
parent: {
|
||||
@@ -49,10 +49,11 @@ function clickAndCheck(blockID, expected) {
|
||||
|
||||
window.focusBlurSnippetsResult = [];
|
||||
|
||||
registry.category("web_tour.tours").add('focus_blur_snippets', {
|
||||
wTourUtils.registerWebsitePreviewTour("focus_blur_snippets", {
|
||||
test: true,
|
||||
url: '/?enable_editor=1',
|
||||
steps: [
|
||||
url: "/",
|
||||
edition: true,
|
||||
}, [
|
||||
{
|
||||
content: 'Drag the custom block into the page',
|
||||
trigger: '#snippet_structure .oe_snippet:has(.oe_snippet_body.s_focusblur) .oe_snippet_thumbnail',
|
||||
@@ -67,4 +68,4 @@ registry.category("web_tour.tours").add('focus_blur_snippets', {
|
||||
...clickAndCheck('child1', ['blur parent', 'focus parent', 'focus child1']),
|
||||
...clickAndCheck('child2', ['blur parent', 'blur child1', 'focus parent', 'focus child2']),
|
||||
...clickAndCheck('parent', ['blur parent', 'blur child2', 'focus parent']),
|
||||
]});
|
||||
]);
|
||||
|
||||
@@ -28,7 +28,6 @@ wTourUtils.registerWebsitePreviewTour('website_gray_color_palette', {
|
||||
{
|
||||
content: "Go to theme options",
|
||||
trigger: '.o_we_customize_theme_btn',
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
},
|
||||
{
|
||||
content: "Toggle gray color palette",
|
||||
|
||||
@@ -14,7 +14,7 @@ wTourUtils.registerWebsitePreviewTour('html_editor_multiple_templates', {
|
||||
[
|
||||
{
|
||||
content: "drop a snippet",
|
||||
trigger: '#oe_snippets.o_loaded .oe_snippet:has(.s_cover) .oe_snippet_thumbnail',
|
||||
trigger: ".oe_snippet:has(.s_cover) .oe_snippet_thumbnail",
|
||||
// id starting by 'oe_structure..' will actually create an inherited view
|
||||
run: "drag_and_drop iframe #oe_structure_test_ui",
|
||||
},
|
||||
|
||||
@@ -70,10 +70,9 @@ wTourUtils.registerWebsitePreviewTour('link_tools', {
|
||||
clickOnImgStep,
|
||||
...wTourUtils.clickOnSave(),
|
||||
// 3. Edit a link after saving the page.
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "The new link content should be odoo website and url odoo.be",
|
||||
extra_trigger: "#oe_snippets.o_loaded",
|
||||
trigger: 'iframe .s_text_image a[href="http://odoo.be"]:contains("odoo website")',
|
||||
},
|
||||
{
|
||||
@@ -101,11 +100,10 @@ wTourUtils.registerWebsitePreviewTour('link_tools', {
|
||||
run: () => {}, // It's a check.
|
||||
},
|
||||
// 4. Add link on image.
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "Click on image.",
|
||||
trigger: 'iframe .s_text_image img',
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
},
|
||||
{
|
||||
content: "Activate link.",
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import wTourUtils from 'website.tour_utils';
|
||||
|
||||
registry.category("web_tour.tours").add('website_media_dialog_undraw', {
|
||||
wTourUtils.registerWebsitePreviewTour("website_media_dialog_undraw", {
|
||||
test: true,
|
||||
url: '/',
|
||||
steps: [
|
||||
{
|
||||
trigger: 'a[data-action=edit]',
|
||||
},
|
||||
edition: true,
|
||||
}, [
|
||||
wTourUtils.dragNDrop({
|
||||
id: 's_text_image',
|
||||
name: 'Text - Image',
|
||||
@@ -21,7 +18,7 @@ wTourUtils.dragNDrop({
|
||||
{
|
||||
trigger: '.o_select_media_dialog:has(.o_we_search_select option[value="media-library"])',
|
||||
},
|
||||
]});
|
||||
]);
|
||||
|
||||
wTourUtils.registerWebsitePreviewTour('website_media_dialog_icons', {
|
||||
test: true,
|
||||
|
||||
@@ -5,10 +5,6 @@ import wTourUtils from "website.tour_utils";
|
||||
wTourUtils.registerWebsitePreviewTour("restricted_editor", {
|
||||
test: true,
|
||||
url: "/",
|
||||
}, [{
|
||||
trigger: '.o_edit_website_container a',
|
||||
content: "Click \"EDIT\" button of website as Restricted Editor",
|
||||
}, {
|
||||
trigger: '#oe_snippets.o_loaded',
|
||||
content: "Check that the snippets loaded properly",
|
||||
}]);
|
||||
}, [
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
]);
|
||||
|
||||
@@ -171,12 +171,13 @@ wTourUtils.registerWebsitePreviewTour('rte_translator', {
|
||||
content: "return to english version",
|
||||
trigger: 'iframe .js_language_selector a[data-url_code="en"]',
|
||||
}, {
|
||||
content: "edit english version",
|
||||
trigger: '.o_edit_website_container > a',
|
||||
extra_trigger: 'iframe body:not(:has(#wrap p font:first:containsExact(paragraphs <b>describing</b>)))',
|
||||
}, {
|
||||
content: "Check body",
|
||||
trigger: "iframe body:not(:has(#wrap p font:first:containsExact(paragraphs <b>describing</b>)))",
|
||||
run: function () {}, // it's a check
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "select text",
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
trigger: 'iframe #wrap p',
|
||||
run: function (actionHelper) {
|
||||
actionHelper.click();
|
||||
|
||||
@@ -29,7 +29,7 @@ wTourUtils.registerWebsitePreviewTour('snippet_cache_across_websites', {
|
||||
trigger: 'iframe html:not([data-website-id="1"])',
|
||||
run: () => null,
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "Check that the custom snippet is not here",
|
||||
extra_trigger: '#oe_snippets:not(:has(#snippet_custom_body span:contains("custom_snippet_test")))',
|
||||
|
||||
@@ -24,8 +24,8 @@ wTourUtils.registerWebsitePreviewTour('snippet_image_gallery', {
|
||||
wTourUtils.registerWebsitePreviewTour("snippet_image_gallery_remove", {
|
||||
test: true,
|
||||
url: "/",
|
||||
edition: true,
|
||||
}, [
|
||||
wTourUtils.clickOnEdit(),
|
||||
wTourUtils.dragNDrop({
|
||||
id: "s_image_gallery",
|
||||
name: "Image Gallery",
|
||||
|
||||
@@ -8,7 +8,7 @@ wTourUtils.registerWebsitePreviewTour('snippet_popup_add_remove', {
|
||||
edition: true,
|
||||
}, [{
|
||||
content: 'Drop s_popup snippet',
|
||||
trigger: '#oe_snippets.o_loaded .oe_snippet:has( > [data-snippet="s_popup"]) .oe_snippet_thumbnail',
|
||||
trigger: '.oe_snippet:has( > [data-snippet="s_popup"]) .oe_snippet_thumbnail',
|
||||
run: "drag_and_drop iframe #wrap",
|
||||
}, {
|
||||
content: 'Edit s_popup snippet',
|
||||
|
||||
@@ -38,14 +38,10 @@ wTourUtils.registerWebsitePreviewTour('snippet_table_of_content', {
|
||||
checkTOCNavBar(1, 0),
|
||||
scrollToHeading(3),
|
||||
checkTOCNavBar(1, 1),
|
||||
wTourUtils.clickOnEdit(),
|
||||
{
|
||||
trigger: "#oe_snippets.o_loaded",
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "Click on the first TOC's title",
|
||||
trigger: 'iframe .s_table_of_content:eq(0) h1',
|
||||
extra_trigger: "#oe_snippets.o_loaded",
|
||||
},
|
||||
{
|
||||
content: "Hide the first TOC on mobile",
|
||||
|
||||
@@ -40,19 +40,7 @@ wTourUtils.registerWebsitePreviewTour('snippet_translation_changing_lang', {
|
||||
trigger: '.modal-footer .btn-primary',
|
||||
},
|
||||
...wTourUtils.clickOnSave(),
|
||||
{
|
||||
trigger: '.o_website_preview:not(.editor_enable.editor_has_snippets)',
|
||||
run() {},
|
||||
},
|
||||
{
|
||||
content: "Click on edit in master",
|
||||
trigger: '.o_edit_website_container a',
|
||||
},
|
||||
{
|
||||
content: "Wait for edit mode to start",
|
||||
trigger: '.o_website_preview.editor_enable.editor_has_snippets',
|
||||
timeout: '30000',
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
wTourUtils.dragNDrop({name: 'Cover'}),
|
||||
{
|
||||
content: "Check that contact us contain Parseltongue",
|
||||
|
||||
@@ -32,15 +32,10 @@ wTourUtils.registerWebsitePreviewTour("snippet_version", {
|
||||
},
|
||||
},
|
||||
...wTourUtils.clickOnSave(),
|
||||
{
|
||||
trigger: ".o_edit_website_container a:has(span.fa-pencil)",
|
||||
run() {},
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "Modify the version of snippets",
|
||||
trigger: '#oe_snippets .o_panel_body > .oe_snippet',
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
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';
|
||||
|
||||
@@ -78,10 +78,10 @@ registry.category("web_tour.tours").add("snippets_all_drag_and_drop", {
|
||||
// tour here. There is currently an issue with tours which don't have an URL
|
||||
// url: '/?enable_editor=1&snippets_names=s_showcase,s_numbers,s_...',
|
||||
steps: [
|
||||
websiteTourUtils.clickOnEdit(),
|
||||
...websiteTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "Ensure snippets are actually passed at the test.",
|
||||
trigger: "#oe_snippets.o_loaded",
|
||||
trigger: "body",
|
||||
run: function () {
|
||||
// safety check, otherwise the test might "break" one day and
|
||||
// receive no steps. The test would then not test anything anymore
|
||||
|
||||
@@ -1,29 +1,27 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import wTourUtils from "website.tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('generic_website_editor', {
|
||||
wTourUtils.registerWebsitePreviewTour("generic_website_editor", {
|
||||
test: true,
|
||||
steps: [{
|
||||
content: 'Click edit button',
|
||||
trigger: '.o_edit_website_container > a',
|
||||
},
|
||||
{
|
||||
edition: true,
|
||||
}, [{
|
||||
trigger: 'iframe body:not([data-hello="world"])',
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
content: 'Check that the editor DOM matches its website-generic features',
|
||||
run: function () {}, // Simple check
|
||||
}]});
|
||||
}]);
|
||||
|
||||
// Good practice would have been to use `wTourUtils.registerWebsitePreviewTour`
|
||||
// for this tour with `edition: true` and remove the first step to enter edit
|
||||
// mode. Unfortunately this breaks the page and therefore the test fails for
|
||||
// unknown reason.
|
||||
registry.category("web_tour.tours").add('specific_website_editor', {
|
||||
test: true,
|
||||
steps: [{
|
||||
content: 'Click edit button',
|
||||
trigger: '.o_edit_website_container > a',
|
||||
},
|
||||
steps: [
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
trigger: 'iframe body[data-hello="world"]',
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
content: 'Check that the editor DOM matches its website-specific features',
|
||||
run: function () {}, // Simple check
|
||||
}]});
|
||||
|
||||
@@ -20,12 +20,7 @@ wTourUtils.registerWebsitePreviewTour('website_click_tour', {
|
||||
trigger: '.o_website_preview[data-view-xmlid="website.contactus"]',
|
||||
run: () => null, // it's a check
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
{
|
||||
content: "wait for edition to be started",
|
||||
trigger: 'iframe body.editor_enable',
|
||||
run: () => null, // it's a check
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "click on a link that would trigger navigation",
|
||||
trigger: 'iframe a[href="/"]',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** @odoo-module alias=website.tour.form_editor **/
|
||||
|
||||
|
||||
import wTourUtils from "website.tour_utils";
|
||||
|
||||
// Visibility possible values:
|
||||
@@ -359,15 +359,10 @@
|
||||
trigger: 'iframe .s_website_form_field input[data-fill-with="phone"]:propValue("+1 555-555-5555")',
|
||||
},
|
||||
// Check that if we edit again and save again the default value is not deleted.
|
||||
{
|
||||
content: 'Enter in edit mode again',
|
||||
trigger: '.o_edit_website_container > a',
|
||||
run: 'click',
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'Edit the form',
|
||||
trigger: 'iframe .s_website_form_field:eq(0) input',
|
||||
extra_trigger: 'button[data-action="save"]',
|
||||
run: 'click',
|
||||
},
|
||||
...addCustomField('many2one', 'select', 'Select Field', true),
|
||||
@@ -381,15 +376,10 @@
|
||||
extra_trigger: 'iframe body:not(.editor_enable)',
|
||||
trigger: 'iframe .s_website_form_field:eq(0) input[value="John Smith"]',
|
||||
},
|
||||
{
|
||||
trigger: ".o_edit_website_container a:has(span.fa-pencil)",
|
||||
run() {},
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'Click on the submit button',
|
||||
trigger: 'iframe .s_website_form_send',
|
||||
extra_trigger: '.o_website_preview.editor_enable',
|
||||
run: 'click',
|
||||
},
|
||||
{
|
||||
@@ -456,15 +446,13 @@
|
||||
wTourUtils.registerWebsitePreviewTour('website_form_conditional_required_checkboxes', {
|
||||
test: true,
|
||||
url: '/',
|
||||
edition: true,
|
||||
}, [
|
||||
// Create a form with two checkboxes: the second one required but
|
||||
// invisible when the first one is checked. Basically this should allow
|
||||
// to have: both checkboxes are visible by default but the form can
|
||||
// only be sent if one of the checkbox is checked.
|
||||
{
|
||||
content: "Enter edit mode",
|
||||
trigger: '.o_edit_website_container > a',
|
||||
}, {
|
||||
content: "Add the form snippet",
|
||||
trigger: '#oe_snippets .oe_snippet:has(.s_website_form) .oe_snippet_thumbnail',
|
||||
run: 'drag_and_drop iframe #wrap',
|
||||
|
||||
@@ -19,7 +19,7 @@ wTourUtils.registerWebsitePreviewTour('website_page_options', {
|
||||
trigger: 'iframe #wrapwrap.o_header_overlay',
|
||||
run: () => null, // it's a check
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
wTourUtils.clickOnSnippet({id: 'o_header_standard', name: 'Header'}),
|
||||
wTourUtils.changeOption('topMenuColor', 'we-select.o_we_so_color_palette'),
|
||||
wTourUtils.changeOption('topMenuColor', 'button[data-color="black-50"]', 'background color', 'bottom', true),
|
||||
@@ -29,7 +29,7 @@ wTourUtils.registerWebsitePreviewTour('website_page_options', {
|
||||
trigger: 'iframe header#top.bg-black-50',
|
||||
run: () => null, // it's a check
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
wTourUtils.clickOnSnippet({id: 'o_header_standard', name: 'Header'}),
|
||||
wTourUtils.changeOption('TopMenuVisibility', 'we-select:has([data-visibility]) we-toggler'),
|
||||
wTourUtils.changeOption('TopMenuVisibility', 'we-button[data-visibility="hidden"]'),
|
||||
@@ -39,10 +39,9 @@ wTourUtils.registerWebsitePreviewTour('website_page_options', {
|
||||
trigger: 'iframe #wrapwrap:has(header#top.d-none.o_snippet_invisible)',
|
||||
run: () => null, // it's a check
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "Click on 'header' in the invisible elements list",
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
trigger: '.o_we_invisible_el_panel .o_we_invisible_entry',
|
||||
},
|
||||
wTourUtils.clickOnSnippet({id: 'o_footer', name: 'Footer'}),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import wTourUtils from 'website.tour_utils';
|
||||
|
||||
registry.category("web_tour.tours").add("website_snippets_menu_tabs", {
|
||||
wTourUtils.registerWebsitePreviewTour("website_snippets_menu_tabs", {
|
||||
test: true,
|
||||
url: "/?enable_editor=1",
|
||||
steps: [
|
||||
url: "/",
|
||||
edition: true,
|
||||
}, [
|
||||
wTourUtils.goToTheme(),
|
||||
{
|
||||
content: "Click on the empty 'DRAG BUILDING BLOCKS HERE' area.",
|
||||
@@ -30,4 +30,4 @@ registry.category("web_tour.tours").add("website_snippets_menu_tabs", {
|
||||
trigger: '.o_we_customize_panel > we-customizeblock-options',
|
||||
run: () => null, // it's a check
|
||||
},
|
||||
]});
|
||||
]);
|
||||
|
||||
@@ -17,7 +17,6 @@ wTourUtils.registerWebsitePreviewTour("website_style_edition", {
|
||||
edition: true,
|
||||
}, [{
|
||||
content: "Go to theme options",
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
trigger: '.o_we_customize_theme_btn',
|
||||
}, {
|
||||
content: "Change font size",
|
||||
@@ -37,7 +36,7 @@ wTourUtils.registerWebsitePreviewTour("website_style_edition", {
|
||||
trigger: 'iframe body:not(.editor_enable) #wrapwrap',
|
||||
run: checkFontSize,
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
wTourUtils.goToTheme(),
|
||||
{
|
||||
content: "Click on the Background Image selection",
|
||||
|
||||
@@ -17,7 +17,7 @@ class TestSnippets(HttpCase):
|
||||
self.start_tour(self.env['website'].get_client_action_url('/'), 'snippet_empty_parent_autoremove', login='admin')
|
||||
|
||||
def test_02_default_shape_gets_palette_colors(self):
|
||||
self.start_tour('/@/?enable_editor=1', "default_shape_gets_palette_colors", login='admin')
|
||||
self.start_tour('/@/', 'default_shape_gets_palette_colors', login='admin')
|
||||
|
||||
def test_03_snippets_all_drag_and_drop(self):
|
||||
with MockRequest(self.env, website=self.env['website'].browse(1)):
|
||||
|
||||
@@ -283,7 +283,7 @@ class TestUi(odoo.tests.HttpCase):
|
||||
self.start_tour(self.env['website'].get_client_action_url('/'), 'website_style_edition', login='admin')
|
||||
|
||||
def test_09_website_edit_link_popover(self):
|
||||
self.start_tour('/@/?enable_editor=1', "edit_link_popover", login="admin")
|
||||
self.start_tour('/@/', 'edit_link_popover', login='admin')
|
||||
|
||||
def test_10_website_conditional_visibility(self):
|
||||
self.start_tour(self.env['website'].get_client_action_url('/'), 'conditional_visibility_1', login='admin')
|
||||
@@ -353,7 +353,7 @@ class TestUi(odoo.tests.HttpCase):
|
||||
""",
|
||||
}])
|
||||
|
||||
self.start_tour("/?enable_editor=1", "focus_blur_snippets", login="admin")
|
||||
self.start_tour('/', 'focus_blur_snippets', login='admin')
|
||||
|
||||
def test_14_carousel_snippet_content_removal(self):
|
||||
self.start_tour(self.env['website'].get_client_action_url('/'), 'carousel_content_removal', login='admin')
|
||||
@@ -368,13 +368,13 @@ class TestUi(odoo.tests.HttpCase):
|
||||
self.start_tour(self.env['website'].get_client_action_url('/'), 'edit_menus', login='admin')
|
||||
|
||||
def test_18_website_snippets_menu_tabs(self):
|
||||
self.start_tour("/?enable_editor=1", "website_snippets_menu_tabs", login="admin")
|
||||
self.start_tour('/', 'website_snippets_menu_tabs', login='admin')
|
||||
|
||||
def test_19_website_page_options(self):
|
||||
self.start_tour("/web", "website_page_options", login="admin")
|
||||
|
||||
def test_20_snippet_editor_panel_options(self):
|
||||
self.start_tour("/@/?enable_editor=1", "snippet_editor_panel_options", login="admin")
|
||||
self.start_tour('/@/', 'snippet_editor_panel_options', login='admin')
|
||||
|
||||
def test_21_website_start_cloned_snippet(self):
|
||||
self.start_tour('/web', 'website_start_cloned_snippet', login='admin')
|
||||
@@ -383,7 +383,7 @@ class TestUi(odoo.tests.HttpCase):
|
||||
self.start_tour('/web', 'website_gray_color_palette', login='admin')
|
||||
|
||||
def test_23_website_multi_edition(self):
|
||||
self.start_tour('/@?enable_editor=1', 'website_multi_edition', login='admin')
|
||||
self.start_tour('/@/', 'website_multi_edition', login='admin')
|
||||
|
||||
def test_24_snippet_cache_across_websites(self):
|
||||
default_website = self.env.ref('website.default_website')
|
||||
|
||||
@@ -13,7 +13,7 @@ wTourUtils.registerWebsitePreviewTour('blog_tags', {
|
||||
content: "Go to first blog",
|
||||
trigger: "iframe article[name=blog_post] a",
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
wTourUtils.clickOnSnippet('#o_wblog_post_top .o_wblog_post_page_cover'),
|
||||
{
|
||||
content: "Open tag dropdown",
|
||||
@@ -36,7 +36,7 @@ wTourUtils.registerWebsitePreviewTour('blog_tags', {
|
||||
trigger: "iframe #o_wblog_post_content .badge:contains(testtag)",
|
||||
isCheck: true,
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
wTourUtils.clickOnSnippet('#o_wblog_post_top .o_wblog_post_page_cover'),
|
||||
{
|
||||
content: "Remove tag",
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
}, [{
|
||||
content: "Select contact form",
|
||||
trigger: "iframe #wrap.o_editable section.s_website_form",
|
||||
extra_trigger: "iframe body.editor_enable",
|
||||
}, {
|
||||
content: "Open action select",
|
||||
trigger: "we-select:has(we-button:contains('Create an Opportunity')) we-toggler",
|
||||
|
||||
@@ -72,12 +72,11 @@
|
||||
}, {
|
||||
content: 'Check if the Guru form is present',
|
||||
trigger: 'iframe form'
|
||||
}, {
|
||||
content: 'Enter in edit mode',
|
||||
trigger: '.o_edit_website_container > a',
|
||||
}, {
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'Add a fake default value for the job_id field',
|
||||
trigger: '#oe_snippets.o_loaded',
|
||||
trigger: "body",
|
||||
run: () => {
|
||||
// It must be done in this way because the editor does not allow to
|
||||
// put a default value on a field with type="hidden".
|
||||
@@ -86,7 +85,6 @@
|
||||
}, {
|
||||
content: 'Edit the form',
|
||||
trigger: 'iframe input[type="file"]',
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
}, {
|
||||
content: 'Add a new field',
|
||||
trigger: 'we-button[data-add-field]',
|
||||
@@ -115,12 +113,11 @@
|
||||
console.error('The job_id field has a wrong value');
|
||||
}
|
||||
}
|
||||
}, {
|
||||
content: 'Enter in edit mode',
|
||||
trigger: '.o_edit_website_container > a',
|
||||
}, {
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'Verify that the job_id field has kept its default value',
|
||||
trigger: '#oe_snippets.o_loaded',
|
||||
trigger: "body",
|
||||
run: () => {
|
||||
if (!document.querySelector('.o_iframe:not(.o_ignore_in_tour)').contentDocument.querySelector('input[name="job_id"][value="FAKE_JOB_ID_DEFAULT_VAL"]')) {
|
||||
console.error('The job_id field has lost its default value');
|
||||
|
||||
@@ -25,7 +25,7 @@ wTourUtils.registerWebsitePreviewTour('newsletter_block_edition', {
|
||||
extra_trigger: 'iframe .s_newsletter_block input:propValue(admin@yourcompany.example.com)',
|
||||
},
|
||||
// Change the link style.
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'Click on the Subscribe button',
|
||||
trigger: 'iframe .s_newsletter_block .js_subscribe_btn',
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import wTourUtils from "website.tour_utils";
|
||||
import newsletterPopupUseTour from "website_mass_mailing.tour.newsletter_popup_use";
|
||||
|
||||
registry.category("web_tour.tours").add('newsletter_popup_edition', {
|
||||
wTourUtils.registerWebsitePreviewTour("newsletter_popup_edition", {
|
||||
test: true,
|
||||
url: '/?enable_editor=1',
|
||||
steps: [
|
||||
url: "/",
|
||||
edition: true,
|
||||
}, [
|
||||
wTourUtils.dragNDrop({
|
||||
id: 's_newsletter_subscribe_popup',
|
||||
name: 'Newsletter Popup',
|
||||
@@ -25,4 +25,4 @@ registry.category("web_tour.tours").add('newsletter_popup_edition', {
|
||||
extra_trigger: 'iframe body:not(.editor_enable)',
|
||||
run: newsletterPopupUseTour.ensurePopupNotVisible,
|
||||
}
|
||||
]});
|
||||
]);
|
||||
|
||||
@@ -9,7 +9,7 @@ import odoo.tests
|
||||
class TestSnippets(odoo.tests.HttpCase):
|
||||
|
||||
def test_01_newsletter_popup(self):
|
||||
self.start_tour("/?enable_editor=1", "newsletter_popup_edition", login='admin')
|
||||
self.start_tour('/', 'newsletter_popup_edition', login='admin')
|
||||
self.start_tour("/", "newsletter_popup_use", login=None)
|
||||
mailing_list = self.env['mailing.list'].search([], limit=1)
|
||||
emails = mailing_list.contact_ids.mapped('email')
|
||||
|
||||
@@ -5,7 +5,7 @@ import wTourUtils from 'website.tour_utils';
|
||||
|
||||
function editAddToCartSnippet() {
|
||||
return [
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
wTourUtils.clickOnSnippet({id: 's_add_to_cart'})
|
||||
]
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ wTourUtils.registerWebsitePreviewTour('website_sale_tour_backend', {
|
||||
}, [
|
||||
{
|
||||
content: "open customize tab",
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
trigger: '.o_we_customize_snippet_btn',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -31,13 +31,9 @@ wTourUtils.registerWebsitePreviewTour('shop_customize', {
|
||||
trigger: 'iframe body:not(:has(.js_product_change))',
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
content: "enter edit mode",
|
||||
trigger: '.o_edit_website_container > a',
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "open customize tab",
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
trigger: '.o_we_customize_snippet_btn',
|
||||
},
|
||||
{
|
||||
@@ -70,13 +66,9 @@ wTourUtils.registerWebsitePreviewTour('shop_customize', {
|
||||
trigger: "iframe .product_price .oe_price .oe_currency_value:containsExact(800.40)",
|
||||
run: function () {},
|
||||
},
|
||||
{
|
||||
content: "enter edit mode",
|
||||
trigger: '.o_edit_website_container > a',
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "open customize tab",
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
trigger: '.o_we_customize_snippet_btn',
|
||||
},
|
||||
{
|
||||
@@ -133,13 +125,9 @@ wTourUtils.registerWebsitePreviewTour('shop_customize', {
|
||||
trigger: "iframe a:contains(Continue Shopping)",
|
||||
extra_trigger: 'iframe body:not(:has(#products_grid_before .js_attributes))',
|
||||
},
|
||||
{
|
||||
content: "enter edit mode",
|
||||
trigger: '.o_edit_website_container > a',
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "open customize tab",
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
trigger: '.o_we_customize_snippet_btn',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import wTourUtils from "website.tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('shop_editor', {
|
||||
wTourUtils.registerWebsitePreviewTour("shop_editor", {
|
||||
test: true,
|
||||
url: '/shop?enable_editor=1',
|
||||
steps: [{
|
||||
trigger: '#oe_snippets.o_loaded',
|
||||
content: "Wait for the editor to be loaded"
|
||||
}, {
|
||||
url: "/shop",
|
||||
edition: true,
|
||||
}, [{
|
||||
content: "Click on pricelist dropdown",
|
||||
trigger: "iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown]",
|
||||
}, {
|
||||
@@ -19,4 +17,4 @@ registry.category("web_tour.tours").add('shop_editor', {
|
||||
trigger: "iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown]",
|
||||
extra_trigger: "iframe div.o_pricelist_dropdown a[data-bs-toggle=dropdown][aria-expanded=false]",
|
||||
content: "Click on the pricelist again.",
|
||||
}]});
|
||||
}]);
|
||||
|
||||
@@ -23,13 +23,9 @@ wTourUtils.registerWebsitePreviewTour('shop_list_view_b2c', {
|
||||
extra_trigger: 'iframe #product_details',
|
||||
run: () => {}, // It's a check.
|
||||
},
|
||||
{
|
||||
content: "go to edit mode",
|
||||
trigger: '.o_edit_website_container > a',
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "open customize tab",
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
trigger: '.o_we_customize_snippet_btn',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -16,10 +16,9 @@ wTourUtils.registerWebsitePreviewTour('shop_wishlist_admin', {
|
||||
trigger: 'iframe body:not(:has(.js_product_change))',
|
||||
extra_trigger: 'iframe #product_details',
|
||||
},
|
||||
wTourUtils.clickOnEdit(),
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: "open customize tab",
|
||||
extra_trigger: '#oe_snippets.o_loaded',
|
||||
trigger: '.o_we_customize_snippet_btn',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -41,12 +41,10 @@ wTourUtils.registerWebsitePreviewTour('course_publisher_standard', {
|
||||
}, {
|
||||
content: 'eLearning: seems cool, create it',
|
||||
trigger: 'button:contains("Save")',
|
||||
}, {
|
||||
content: 'eLearning: launch course edition',
|
||||
trigger: '.o_edit_website_container a',
|
||||
}, {
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'eLearning: double click image to edit it',
|
||||
extra_trigger: 'iframe body.editor_enable',
|
||||
trigger: 'iframe img.o_wslides_course_pict',
|
||||
run: 'dblclick',
|
||||
}, {
|
||||
|
||||
@@ -45,12 +45,10 @@ wTourUtils.registerWebsitePreviewTour('course_publisher', {
|
||||
}, {
|
||||
content: 'eLearning: seems cool, create it',
|
||||
trigger: 'button:contains("Save")',
|
||||
}, {
|
||||
content: 'eLearning: launch course edition',
|
||||
trigger: '.o_edit_website_container a',
|
||||
}, {
|
||||
},
|
||||
...wTourUtils.clickOnEditAndWaitEditMode(),
|
||||
{
|
||||
content: 'eLearning: double click image to edit it',
|
||||
extra_trigger: 'iframe body.editor_enable',
|
||||
trigger: 'iframe img.o_wslides_course_pict',
|
||||
run: 'dblclick',
|
||||
}, {
|
||||
|
||||
@@ -25,11 +25,8 @@ import wTourUtils from 'website.tour_utils';
|
||||
trigger: 'iframe .o_wslides_fs_main',
|
||||
run: function () {} // check we land on the fullscreen view
|
||||
},
|
||||
wTourUtils.clickOnEdit()
|
||||
...wTourUtils.clickOnEditAndWaitEditMode()
|
||||
, {
|
||||
trigger: 'iframe .o_wslides_lesson_main',
|
||||
run: function () {} // check we are redirected on the detailed view
|
||||
}, {
|
||||
trigger: 'body.editor_has_snippets',
|
||||
run: function () {} // check the editor is automatically opened on the detailed view
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user