Skip to content

[IMP] website: adapt tours #4707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master-mysterious-egg
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions addons/website/static/tests/tours/snippet_popup_and_scrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const checkScrollbar = function (hasScrollbar) {
};
};

const toggleBackdrop = function () {
return changeOption('SnippetPopup', 'we-button[data-name="popup_backdrop_opt"] we-checkbox', 'backdrop');
function toggleBackdrop(snippet) {
return changeOption(`${snippet}`, "[data-action-id='setBackdrop'] .form-check-input");
};

registerWebsitePreviewTour("snippet_popup_and_scrollbar", {
Expand All @@ -49,17 +49,17 @@ registerWebsitePreviewTour("snippet_popup_and_scrollbar", {
trigger: ':iframe .s_popup .modal',
run: "click",
},
toggleBackdrop(), // hide Popup backdrop
toggleBackdrop("Popup"), // hide Popup backdrop
checkScrollbar(true),
goBackToBlocks(),
{
content: "Drag the Content snippet group and drop it at the bottom of the popup.",
trigger: '#oe_snippets .oe_snippet[name="Content"] .oe_snippet_thumbnail:not(.o_we_ongoing_insertion)',
trigger: '.o-snippets-menu .o_snippet[name="Content"] .o_snippet_thumbnail:not(.o_we_ongoing_insertion)',
run: "drag_and_drop :iframe #wrap .s_popup .oe_drop_zone:last",
},
{
content: "Click on the s_media_list snippet.",
trigger: ':iframe .o_snippet_preview_wrap[data-snippet-id="s_media_list"]',
trigger: ':iframe .o_add_snippets_preview [data-snippet="s_media_list"]',
run: "click",
},
checkScrollbar(false),
Expand All @@ -70,12 +70,11 @@ registerWebsitePreviewTour("snippet_popup_and_scrollbar", {
},
{
content: "Remove the Media List snippet in the Popup.",
trigger: ":iframe .oe_overlay.oe_active .oe_snippet_remove",
trigger: "body .o_overlay_options .oe_snippet_remove",
run: "click",
},
toggleBackdrop("Popup"), // show Popup backdrop
checkScrollbar(true),
toggleBackdrop(), // show Popup backdrop
checkScrollbar(false),
{
content: "Close the Popup that has now backdrop.",
trigger: ".o_we_invisible_el_panel .o_we_invisible_entry:first",
Expand All @@ -88,9 +87,8 @@ registerWebsitePreviewTour("snippet_popup_and_scrollbar", {
run: "click",
},
checkScrollbar(true),
toggleBackdrop(), // show Cookies Bar backdrop
checkScrollbar(false),
toggleBackdrop(), // hide Cookies Bar backdrop
toggleBackdrop("Cookies Bar"), // show Cookies Bar backdrop
toggleBackdrop("Cookies Bar"), // hide Cookies Bar backdrop
checkScrollbar(true),
{
content: "Open the Popup that has backdrop.",
Expand All @@ -103,12 +101,12 @@ registerWebsitePreviewTour("snippet_popup_and_scrollbar", {
goBackToBlocks(),
{
content: "Drag the Content snippet group and drop it at the bottom of the popup.",
trigger: '#oe_snippets .oe_snippet[name="Content"] .oe_snippet_thumbnail:not(.o_we_ongoing_insertion)',
trigger: '.o-snippets-menu .o_snippet[name="Content"] .o_snippet_thumbnail:not(.o_we_ongoing_insertion)',
run: "drag_and_drop :iframe #wrap .s_popup .oe_drop_zone:last",
},
{
content: "Click on the s_media_list snippet.",
trigger: ':iframe .o_snippet_preview_wrap[data-snippet-id="s_media_list"]',
trigger: ':iframe .o_add_snippets_preview [data-snippet="s_media_list"]',
run: "click",
},
/* task-4185877
Expand All @@ -121,7 +119,7 @@ registerWebsitePreviewTour("snippet_popup_and_scrollbar", {
},
{
content: "Remove the s_popup snippet",
trigger: ".o_we_customize_panel we-customizeblock-options:contains('Popup') we-button.oe_snippet_remove:first",
trigger: ".o_customize_tab .options-container[data-container-title='Popup'] .oe_snippet_remove",
async run(helpers) {
await helpers.click();
// TODO: remove the below setTimeout. Without it, goBackToBlocks() not works.
Expand All @@ -132,12 +130,12 @@ registerWebsitePreviewTour("snippet_popup_and_scrollbar", {
goBackToBlocks(),
{
content: "Drag the Content snippet group and drop it in the Cookies Bar.",
trigger: '#oe_snippets .oe_snippet[name="Content"] .oe_snippet_thumbnail:not(.o_we_ongoing_insertion)',
trigger: '.o-snippets-menu .o_snippet[name="Content"] .o_snippet_thumbnail:not(.o_we_ongoing_insertion)',
run: "drag_and_drop :iframe #website_cookies_bar .modal-content.oe_structure",
},
{
content: "Click on the s_media_list snippet.",
trigger: ':iframe .o_snippet_preview_wrap[data-snippet-id="s_media_list"]',
trigger: ':iframe .o_add_snippets_preview [data-snippet="s_media_list"]',
run: "click",
},
{
Expand All @@ -147,21 +145,17 @@ registerWebsitePreviewTour("snippet_popup_and_scrollbar", {
},
{
content: "Duplicate the Media List snippet",
trigger: ".o_we_customize_panel we-customizeblock-options:contains('Media List') we-button.oe_snippet_clone:first",
run() {
// TODO: use run: "click", instead
this.anchor.click();
}
trigger:".o_customize_tab .options-container[data-container-title='Media List'] button.oe_snippet_clone",
run: "click",
},
checkScrollbar(false),
{
content: "Remove the first Media List snippet in the Cookies Bar.",
trigger: ":iframe .oe_overlay.oe_active .oe_snippet_remove",
trigger: "body .o_overlay_options .oe_snippet_remove",
run: "click",
},
{
content: "Remove the second Media List snippet in the Cookies Bar.",
trigger: ":iframe .oe_overlay.oe_active .oe_snippet_remove",
trigger: "body .o_overlay_options .oe_snippet_remove",
run: "click",
},
checkScrollbar(true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const changeFirstAndSecondColumnsMobileOrder = (snippetRowSelector, snippetName)
run: "click",
}, {
content: "Change the orders of the 1st and 2nd columns",
trigger: ":iframe .o_overlay_move_options [data-name='move_right_opt']",
trigger: "body .o_overlay_options button[title='Move right']",
run: "click",
}];
};
Expand Down Expand Up @@ -176,7 +176,7 @@ registerWebsitePreviewTour("website_mobile_order_with_drag_and_drop", {
...toggleMobilePreview(false),
{
content: "Drag a 'Text-Image' column and drop it in the same snippet",
trigger: ":iframe .o_overlay_move_options .o_move_handle",
trigger: "body .o_overlay_options .o_move_handle",
run: `drag_and_drop ${textImageSnippetRow}`,
},
checkIfNoMobileOrder(textImageSnippetRow),
Expand All @@ -191,7 +191,7 @@ registerWebsitePreviewTour("website_mobile_order_with_drag_and_drop", {
run: "click",
}, {
content: "Drag the second column of 'Columns' and drop it in 'Text-Image'",
trigger: ":iframe .o_overlay_move_options .o_move_handle",
trigger: "body .o_overlay_options .o_move_handle",
run: `drag_and_drop ${textImageSnippetRow}`,
},
checkIfNoMobileOrder(textImageSnippetRow),
Expand Down
8 changes: 6 additions & 2 deletions addons/website/tests/test_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,16 @@ def test_12_snippet_images_wall(self):
self.start_tour('/', 'snippet_images_wall', login='admin')

@unittest.skip
def test_snippet_popup_with_scrollbar_and_animations(self):
def test_snippet_popup_with_animations(self):
website = self.env.ref('website.default_website')
website.cookies_bar = True
self.start_tour(self.env['website'].get_client_action_url('/'), 'snippet_popup_and_scrollbar', login='admin')
self.start_tour(self.env['website'].get_client_action_url('/'), 'snippet_popup_and_animations', login='admin', timeout=90)

def test_snippet_popup_with_scrollbar(self):
website = self.env.ref('website.default_website')
website.cookies_bar = True
self.start_tour(self.env['website'].get_client_action_url('/'), 'snippet_popup_and_scrollbar', login='admin')

@unittest.skip
def test_drag_and_drop_on_non_editable(self):
self.start_tour(self.env['website'].get_client_action_url('/'), 'test_drag_and_drop_on_non_editable', login='admin')
Expand Down
1 change: 0 additions & 1 deletion addons/website/tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,6 @@ def test_drop_404_ir_attachment_url(self):
})
self.start_tour(self.env['website'].get_client_action_url('/'), 'drop_404_ir_attachment_url', login='admin')

@unittest.skip
def test_mobile_order_with_drag_and_drop(self):
self.start_tour(self.env['website'].get_client_action_url('/'), 'website_mobile_order_with_drag_and_drop', login='admin')

Expand Down