[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
This commit is contained in:
Rodolpho Lima
2023-04-13 16:40:08 +02:00
parent 164df578fc
commit cdc16116dc
2 changed files with 100 additions and 0 deletions
@@ -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(),
]
});
@@ -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")