From cdc16116dce8a8854295b29403579fe1366f32c8 Mon Sep 17 00:00:00 2001 From: Rodolpho Lima Date: Tue, 14 Mar 2023 20:10:18 +0000 Subject: [PATCH] [FIX] mass_mailing: add missing tour for basic theme A mailing based on the "basic" theme is a particular case where there is no SnippetsMenu and the floating toolbar is present instead. This commit includes a tour for this previously untested case/flow. Part-of: odoo/odoo#117166 --- .../src/js/tours/mass_mailing_editor_tour.js | 97 +++++++++++++++++++ addons/mass_mailing/tests/test_mailing_ui.py | 3 + 2 files changed, 100 insertions(+) diff --git a/addons/mass_mailing/static/src/js/tours/mass_mailing_editor_tour.js b/addons/mass_mailing/static/src/js/tours/mass_mailing_editor_tour.js index cae88ec8f13..c567fa21f16 100644 --- a/addons/mass_mailing/static/src/js/tours/mass_mailing_editor_tour.js +++ b/addons/mass_mailing/static/src/js/tours/mass_mailing_editor_tour.js @@ -2,6 +2,7 @@ import { registry } from "@web/core/registry"; import { stepUtils } from "@web_tour/tour_service/tour_utils"; + import { boundariesIn, setSelection } from "@web_editor/js/editor/odoo-editor/src/utils/utils"; registry.category("web_tour.tours").add('mass_mailing_editor_tour', { url: '/web', @@ -56,3 +57,99 @@ trigger: 'iframe .o_editable', run: () => {}, }]}); + +registry.category("web_tour.tours").add('mass_mailing_basic_theme_toolbar', { + test: true, + url: '/web', + steps: [ + stepUtils.showAppsMenuItem(), + { + content: "Select the 'Email Marketing' app.", + trigger: '.o_app[data-menu-xmlid="mass_mailing.mass_mailing_menu_root"]', + }, + { + content: "Click on the create button to create a new mailing.", + trigger: 'button.o_list_button_add', + }, + { + content: "Wait for the theme selector to load and pick the basic theme.", + trigger: 'iframe #basic', + extra_trigger: 'iframe .o_mail_theme_selector_new', + }, + { + content: "Make sure the snippets menu is hidden", + trigger: 'iframe html:has(#oe_snippets.d-none)', + run: () => null, // no click, just check + }, + { + content: "Add some content to be selected afterwards", + trigger: 'iframe p', + run: 'text content', + }, + { + content: "Select text", + trigger: 'iframe p:contains(content)', + run() { + setSelection(...boundariesIn(this.$anchor[0]), false); + } + }, + { + content: "Make sure the floating toolbar is visible", + trigger: '#toolbar.oe-floating[style*="visible"]', + run: () => null, + }, + { + content: "Open the color picker", + trigger: '#toolbar #oe-text-color', + }, + { + content: "Pick a color", + trigger: '#toolbar button[data-color="o-color-1"]', + }, + { + content: "Check that color was applied", + trigger: 'iframe p font.text-o-color-1', + run: () => null, + }, + { + content: "Fill in Subject", + trigger: '[name="subject"] input', + run: 'text Test', + }, + { + content: "Fill in Mailing list", + trigger: '[name="contact_list_ids"] input', + run: 'text Newsletter', + }, + { + content: "Pick 'Newsletter' option", + trigger: '.o_input_dropdown a:contains(Newsletter)', + }, + { + content: "Save and go to 'Mailings' list view", + trigger: '.breadcrumb a:contains(Mailings)' + }, + { + content: "Open newly created mailing", + trigger: 'td:contains(Test)', + }, + { + content: "Make sure the snippets menu is hidden", + trigger: 'iframe html:has(#oe_snippets.d-none)', + run: () => null, + }, + { + content: "Select content", + trigger: 'iframe p:contains(content)', + run() { + setSelection(...boundariesIn(this.$anchor[0]), false); + } + }, + { + content: "Make sure the floating toolbar is visible", + trigger: '#toolbar.oe-floating[style*="visible"]', + run: () => null, + }, + ...stepUtils.discardForm(), + ] +}); diff --git a/addons/mass_mailing/tests/test_mailing_ui.py b/addons/mass_mailing/tests/test_mailing_ui.py index a02b1b52640..c484f03ce39 100644 --- a/addons/mass_mailing/tests/test_mailing_ui.py +++ b/addons/mass_mailing/tests/test_mailing_ui.py @@ -33,3 +33,6 @@ class TestUi(HttpCaseWithUserDemo): def test_04_mass_mailing_snippets_menu_hide(self): self.start_tour("/web", 'mass_mailing_snippets_menu_toolbar', login="demo") + + def test_05_mass_mailing_basic_theme_toolbar(self): + self.start_tour('/web', 'mass_mailing_basic_theme_toolbar', login="demo")