19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:32:39 +01:00
parent 38c6088dcc
commit d9452d2060
243 changed files with 30797 additions and 10815 deletions

View file

@ -1,19 +1,20 @@
/** @odoo-module **/
import { patch } from '@web/core/utils/patch';
import { VideoSelector } from '@web_editor/components/media_dialog/video_selector';
import wTourUtils from 'website.tour_utils';
import { patch } from "@web/core/utils/patch";
import { VideoSelector } from "@html_editor/main/media/media_dialog/video_selector";
import {
changeOption,
insertSnippet,
registerWebsitePreviewTour,
} from '@website/js/tours/tour_utils';
const VIDEO_URL = 'https://www.youtube.com/watch?v=Dpq87YCHmJc';
/**
* The purpose of this tour is to check the media replacement flow.
*/
wTourUtils.registerWebsitePreviewTour('test_replace_media', {
registerWebsitePreviewTour('test_replace_media', {
url: '/',
test: true,
edition: true,
}, [
}, () => [
{
trigger: "body",
run: function () {
@ -23,138 +24,148 @@ wTourUtils.registerWebsitePreviewTour('test_replace_media', {
// specific to an URL only, it is acceptable).
// TODO if we ever give the possibility to upload its own videos,
// this won't be necessary anymore.
patch(VideoSelector.prototype, "Video selector patch", {
patch(VideoSelector.prototype, {
async _getVideoURLData(src, options) {
if (src === VIDEO_URL || src === 'about:blank') {
return {platform: 'youtube', embed_url: 'about:blank'};
}
return this._super(...arguments);
return super._getVideoURLData(...arguments);
},
});
},
},
{
content: "drop picture snippet",
trigger: "#oe_snippets .oe_snippet[name='Picture'] .oe_snippet_thumbnail:not(.o_we_already_dragging)",
moveTrigger: "iframe .oe_drop_zone",
run: "drag_and_drop iframe #wrap",
},
...insertSnippet({
name: 'Title - Image',
id: 's_picture',
groupName: "Images",
}),
{
content: "select image",
trigger: "iframe .s_picture figure img",
trigger: ":iframe .s_picture figure img",
run: "click",
},
{
content: "ensure image size is displayed",
trigger: "#oe_snippets we-title:contains('Image') .o_we_image_weight:contains('kb')",
run: function () {}, // check
trigger: ".o_customize_tab [data-container-title='Image'] .options-container-header:contains('kb')",
},
wTourUtils.changeOption("ImageTools", 'we-select[data-name="shape_img_opt"] we-toggler'),
wTourUtils.changeOption("ImageTools", "we-button[data-set-img-shape]"),
changeOption("Image", "[data-label='Shape'] .dropdown-toggle"),
{
content: "replace image",
trigger: "#oe_snippets we-button[data-replace-media]",
content: "Click on the first image shape",
trigger: "button[data-action-id='setImageShape']",
run: "click",
},
{
content: "Open MediaDialog from an image",
trigger: "button[data-action-id='replaceMedia']",
run: "click",
},
{
content: "select svg",
trigger: ".o_select_media_dialog img[title='sample.svg']",
trigger: ".o_select_media_dialog .o_button_area[aria-label='sample.svg']",
run: "click",
},
{
content: "ensure the svg doesn't have a shape",
trigger: "iframe .s_picture figure img:not([data-shape])",
run: function () {}, // check
content: "ensure the svg does have a shape",
trigger: ":iframe .s_picture figure img[data-shape]",
},
{
content: "ensure image size is not displayed",
trigger: "#oe_snippets we-title:contains('Image'):not(:has(.o_we_image_weight:visible))",
run: function () {}, // check
content: "ensure image size is displayed",
trigger: ".o_customize_tab [data-container-title='Image'] span[title='Size']",
},
{
content: "replace image",
trigger: "#oe_snippets we-button[data-replace-media]",
trigger: "button[data-action-id='replaceMedia']",
run: "click",
},
{
content: "go to pictogram tab",
trigger: ".o_select_media_dialog .nav-link:contains('Icons')",
run: "click",
},
{
content: "select an icon",
trigger: ".o_select_media_dialog:has(.nav-link.active:contains('Icons')) .tab-content span.fa-lemon-o",
trigger: ".o_select_media_dialog:has(.nav-link.active:contains('Icons')) .tab-content span.fa-heart",
run: "click",
},
{
content: "ensure icon block is displayed",
trigger: "#oe_snippets we-customizeblock-options we-title:contains('Icon')",
run: function () {}, // check
trigger: ".o_customize_tab [data-container-title='Icon']",
},
{
content: "select footer",
trigger: "iframe footer",
trigger: ":iframe footer",
run: "click",
},
{
content: "select icon",
trigger: "iframe .s_picture figure span.fa-lemon-o",
trigger: ":iframe .s_picture figure span.fa-heart",
run: "click",
},
{
content: "ensure icon block is still displayed",
trigger: "#oe_snippets we-customizeblock-options we-title:contains('Icon')",
run: function () {}, // check
trigger: ".o_customize_tab [data-container-title='Icon']",
},
{
content: "replace icon",
trigger: "#oe_snippets we-button[data-replace-media]",
trigger: "button[data-action-id='replaceMedia']",
run: "click",
},
{
content: "go to video tab",
trigger: ".o_select_media_dialog .nav-link:contains('Video')",
run: "click",
},
{
content: "enter a video URL",
trigger: ".o_select_media_dialog #o_video_text",
// Design your first web page.
run: `text ${VIDEO_URL}`,
run: `edit ${VIDEO_URL}`,
},
{
content: "wait for preview to appear",
// "about:blank" because the VideoWidget was patched at the start of this tour
trigger: ".o_select_media_dialog div.media_iframe_video iframe[src='about:blank']",
run: function () {}, // check
trigger: ".o_select_media_dialog div.media_iframe_video [src='about:blank']:iframe body",
},
{
content: "confirm selection",
trigger: ".o_select_media_dialog .modal-footer .btn-primary",
run: "click",
},
{
content: "ensure video option block is displayed",
trigger: "#oe_snippets we-customizeblock-options we-title:contains('Video')",
run: function () {}, // check
trigger: ".o_customize_tab [data-container-title='Video']",
},
{
content: "replace image",
trigger: "#oe_snippets we-button[data-replace-media]",
trigger: ".btn-success[data-action-id='replaceMedia']",
run: "click",
},
{
content: "go to pictogram tab",
trigger: ".o_select_media_dialog .nav-link:contains('Icons')",
run: "click",
},
{
content: "select an icon",
trigger: ".o_select_media_dialog:has(.nav-link.active:contains('Icons')) .tab-content span.fa-lemon-o",
trigger: ".o_select_media_dialog:has(.nav-link.active:contains('Icons')) .tab-content span.fa-heart",
run: "click",
},
{
content: "ensure icon block is displayed",
trigger: "#oe_snippets we-customizeblock-options we-title:contains('Icon')",
run: function () {}, // check
trigger: ".o_customize_tab [data-container-title='Icon']",
},
{
content: "select footer",
trigger: "iframe footer",
trigger: ":iframe footer",
run: "click",
},
{
content: "select icon",
trigger: "iframe .s_picture figure span.fa-lemon-o",
trigger: ":iframe .s_picture figure span.fa-heart",
run: "click",
},
{
content: "ensure icon block is still displayed",
trigger: "#oe_snippets we-customizeblock-options we-title:contains('Icon')",
run: function () {}, // check
trigger: ".o_customize_tab [data-container-title='Icon']",
},
]);