[MOV] (website_)mass_mailing: reorder, rename and link UI tests / tours
Rename tours, reorder tests and test files, perform a quick linting of UI or tours related tests. Purpose is to prepare files to add some new tests in mass mailing. Each tour now belongs to a single file to ease maintenance and update as well as seeing feature coverage. No real change should occur with this commit except some test data (setup, test input). Prepares Task-2150462 (Mass Mailing: Improve subscription management) Part-of: odoo/odoo#122106
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { stepUtils } from "@web_tour/tour_service/tour_utils";
|
||||
|
||||
registry.category('web_tour.tours').add('mailing_campaign', {
|
||||
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: 'Select "Campaings" Navbar item',
|
||||
trigger: '.o_nav_entry[data-menu-xmlid="mass_mailing.menu_email_campaigns"]',
|
||||
},
|
||||
{
|
||||
content: 'Select "Newsletter" campaign',
|
||||
trigger: '.oe_kanban_card:contains("Newsletter")',
|
||||
},
|
||||
{
|
||||
content: 'Add a line (create new mailing)',
|
||||
trigger: '.o_field_x2many_list_row_add a',
|
||||
},
|
||||
{
|
||||
content: 'Pick the basic theme',
|
||||
trigger: 'iframe',
|
||||
run(actions) {
|
||||
// For some reason the selectors inside the iframe cannot be triggered.
|
||||
const link = this.$anchor[0].contentDocument.querySelector('#basic');
|
||||
actions.click(link);
|
||||
}
|
||||
},
|
||||
{
|
||||
content: 'Fill in Subject',
|
||||
trigger: '#subject_0',
|
||||
run: 'text TestFromTour',
|
||||
},
|
||||
{
|
||||
content: 'Fill in Mailing list',
|
||||
trigger: '#contact_list_ids_0',
|
||||
run: 'text Newsletter',
|
||||
},
|
||||
{
|
||||
content: 'Pick "Newsletter" option',
|
||||
trigger: '.o_input_dropdown a:contains(Newsletter)',
|
||||
},
|
||||
{
|
||||
content: 'Save form',
|
||||
trigger: '.o_form_button_save',
|
||||
},
|
||||
{
|
||||
content: 'Check that newly created record is on the list',
|
||||
trigger: '[name="mailing_mail_ids"] td[name="subject"]:contains("TestFromTour")',
|
||||
run: () => null,
|
||||
},
|
||||
...stepUtils.saveForm(),
|
||||
]
|
||||
});
|
||||
@@ -0,0 +1,58 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { stepUtils } from "@web_tour/tour_service/tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('mailing_editor', {
|
||||
url: '/web',
|
||||
test: true,
|
||||
steps: [stepUtils.showAppsMenuItem(), {
|
||||
trigger: '.o_app[data-menu-xmlid="mass_mailing.mass_mailing_menu_root"]',
|
||||
}, {
|
||||
trigger: 'button.o_list_button_add',
|
||||
}, {
|
||||
trigger: 'div[name="contact_list_ids"] .o_input_dropdown input[type="text"]',
|
||||
}, {
|
||||
trigger: 'div[name="contact_list_ids"] .ui-state-active'
|
||||
}, {
|
||||
content: 'choose the theme "empty" to edit the mailing with snippets',
|
||||
trigger: '[name="body_arch"] iframe #empty',
|
||||
}, {
|
||||
content: 'wait for the editor to be rendered',
|
||||
trigger: '[name="body_arch"] iframe .o_editable[data-editor-message="DRAG BUILDING BLOCKS HERE"]',
|
||||
run: () => {},
|
||||
}, {
|
||||
content: 'drag the "Title" snippet from the design panel and drop it in the editor',
|
||||
trigger: '[name="body_arch"] iframe #email_designer_default_body [name="Title"] .ui-draggable-handle',
|
||||
run: function (actions) {
|
||||
actions.drag_and_drop('[name="body_arch"] iframe .o_editable', this.$anchor);
|
||||
}
|
||||
}, {
|
||||
content: 'wait for the snippet menu to finish the drop process',
|
||||
trigger: '[name="body_arch"] iframe #email_designer_header_elements:not(:has(.o_we_already_dragging))',
|
||||
run: () => {}
|
||||
}, {
|
||||
content: 'verify that the title was inserted properly in the editor',
|
||||
trigger: '[name="body_arch"] iframe .o_editable h1',
|
||||
run: () => {},
|
||||
}, {
|
||||
trigger: 'button.o_form_button_save',
|
||||
}, {
|
||||
content: 'verify that the save failed (since the field "subject" was not set and it is required)',
|
||||
trigger: 'label.o_field_invalid',
|
||||
run: () => {},
|
||||
}, {
|
||||
content: 'verify that the edited mailing body was not lost during the failed save',
|
||||
trigger: '[name="body_arch"] iframe .o_editable h1',
|
||||
run: () => {},
|
||||
}, {
|
||||
trigger: 'input#subject_0',
|
||||
run: 'text TestFromTour',
|
||||
}, {
|
||||
trigger: '.o_form_view', // blur previous input
|
||||
},
|
||||
...stepUtils.saveForm(),
|
||||
{
|
||||
trigger: 'iframe .o_editable',
|
||||
run: () => {},
|
||||
}]});
|
||||
@@ -0,0 +1,101 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
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('mailing_editor_theme', {
|
||||
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 TestFromTour',
|
||||
},
|
||||
{
|
||||
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(TestFromTour)',
|
||||
},
|
||||
{
|
||||
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(),
|
||||
]
|
||||
});
|
||||
@@ -1,212 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
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',
|
||||
test: true,
|
||||
steps: [stepUtils.showAppsMenuItem(), {
|
||||
trigger: '.o_app[data-menu-xmlid="mass_mailing.mass_mailing_menu_root"]',
|
||||
}, {
|
||||
trigger: 'button.o_list_button_add',
|
||||
}, {
|
||||
trigger: 'div[name="contact_list_ids"] .o_input_dropdown input[type="text"]',
|
||||
}, {
|
||||
trigger: 'div[name="contact_list_ids"] .ui-state-active'
|
||||
}, {
|
||||
content: 'choose the theme "empty" to edit the mailing with snippets',
|
||||
trigger: '[name="body_arch"] iframe #empty',
|
||||
}, {
|
||||
content: 'wait for the editor to be rendered',
|
||||
trigger: '[name="body_arch"] iframe .o_editable[data-editor-message="DRAG BUILDING BLOCKS HERE"]',
|
||||
run: () => {},
|
||||
}, {
|
||||
content: 'drag the "Title" snippet from the design panel and drop it in the editor',
|
||||
trigger: '[name="body_arch"] iframe #email_designer_default_body [name="Title"] .ui-draggable-handle',
|
||||
run: function (actions) {
|
||||
actions.drag_and_drop('[name="body_arch"] iframe .o_editable', this.$anchor);
|
||||
}
|
||||
}, {
|
||||
content: 'wait for the snippet menu to finish the drop process',
|
||||
trigger: '[name="body_arch"] iframe #email_designer_header_elements:not(:has(.o_we_already_dragging))',
|
||||
run: () => {}
|
||||
}, {
|
||||
content: 'verify that the title was inserted properly in the editor',
|
||||
trigger: '[name="body_arch"] iframe .o_editable h1',
|
||||
run: () => {},
|
||||
}, {
|
||||
trigger: 'button.o_form_button_save',
|
||||
}, {
|
||||
content: 'verify that the save failed (since the field "subject" was not set and it is required)',
|
||||
trigger: 'label.o_field_invalid',
|
||||
run: () => {},
|
||||
}, {
|
||||
content: 'verify that the edited mailing body was not lost during the failed save',
|
||||
trigger: '[name="body_arch"] iframe .o_editable h1',
|
||||
run: () => {},
|
||||
}, {
|
||||
trigger: 'input#subject_0',
|
||||
run: 'text Test',
|
||||
}, {
|
||||
trigger: '.o_form_view', // blur previous input
|
||||
},
|
||||
...stepUtils.saveForm(),
|
||||
{
|
||||
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(),
|
||||
]
|
||||
});
|
||||
|
||||
registry.category('web_tour.tours').add('mass_mailing_campaing_new_mailing', {
|
||||
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: 'Select "Campaings" Navbar item',
|
||||
trigger: '.o_nav_entry[data-menu-xmlid="mass_mailing.menu_email_campaigns"]',
|
||||
},
|
||||
{
|
||||
content: 'Select "Newsletter" campaign',
|
||||
trigger: '.oe_kanban_card:contains("Newsletter")',
|
||||
},
|
||||
{
|
||||
content: 'Add a line (create new mailing)',
|
||||
trigger: '.o_field_x2many_list_row_add a',
|
||||
},
|
||||
{
|
||||
content: 'Pick the basic theme',
|
||||
trigger: 'iframe',
|
||||
run(actions) {
|
||||
// For some reason the selectors inside the iframe cannot be triggered.
|
||||
const link = this.$anchor[0].contentDocument.querySelector('#basic');
|
||||
actions.click(link);
|
||||
}
|
||||
},
|
||||
{
|
||||
content: 'Fill in Subject',
|
||||
trigger: '#subject_0',
|
||||
run: 'text Test',
|
||||
},
|
||||
{
|
||||
content: 'Fill in Mailing list',
|
||||
trigger: '#contact_list_ids_0',
|
||||
run: 'text Newsletter',
|
||||
},
|
||||
{
|
||||
content: 'Pick "Newsletter" option',
|
||||
trigger: '.o_input_dropdown a:contains(Newsletter)',
|
||||
},
|
||||
{
|
||||
content: 'Save form',
|
||||
trigger: '.o_form_button_save',
|
||||
},
|
||||
{
|
||||
content: 'Check that newly created record is on the list',
|
||||
trigger: '[name="mailing_mail_ids"] td[name="subject"]:contains("Test")',
|
||||
run: () => null,
|
||||
},
|
||||
...stepUtils.saveForm(),
|
||||
]
|
||||
});
|
||||
@@ -1,194 +0,0 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { stepUtils } from "@web_tour/tour_service/tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('mass_mailing_snippets_menu_tabs', {
|
||||
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: "Click on the 'Start From Scratch' template.",
|
||||
trigger: 'iframe #empty',
|
||||
},
|
||||
{
|
||||
content: "Click on the 'Design' tab.",
|
||||
trigger: 'iframe .o_we_customize_design_btn',
|
||||
},
|
||||
{
|
||||
content: "Click on the empty 'DRAG BUILDING BLOCKS HERE' area.",
|
||||
trigger: 'iframe .oe_structure.o_mail_no_options',
|
||||
},
|
||||
{
|
||||
content: "Click on the 'Design' tab.",
|
||||
trigger: 'iframe .o_we_customize_design_btn',
|
||||
},
|
||||
{
|
||||
content: "Verify that the customize panel is not empty.",
|
||||
trigger: 'iframe .o_we_customize_panel .snippet-option-DesignTab',
|
||||
run: () => null, // it's a check
|
||||
},
|
||||
{
|
||||
content: "Click on the style tab.",
|
||||
trigger: 'iframe .o_we_customize_snippet_btn',
|
||||
},
|
||||
{
|
||||
content: "Click on the 'Design' tab.",
|
||||
trigger: 'iframe .o_we_customize_design_btn',
|
||||
},
|
||||
{
|
||||
content: "Verify that the customize panel is not empty.",
|
||||
trigger: 'iframe .o_we_customize_panel .snippet-option-DesignTab',
|
||||
run: () => null, // it's a check
|
||||
},
|
||||
...stepUtils.discardForm(),
|
||||
]});
|
||||
|
||||
|
||||
|
||||
registry.category("web_tour.tours").add('mass_mailing_snippets_menu_toolbar_new_mailing_mobile', {
|
||||
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',
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Check templates available in theme selector",
|
||||
trigger: 'iframe .o_mail_theme_selector_new',
|
||||
run: function () {
|
||||
if (this.$anchor[0].querySelector('#empty')) {
|
||||
console.error('The empty template should not be visible on mobile.');
|
||||
}
|
||||
},
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Make sure the toolbar isn't floating",
|
||||
trigger: 'iframe',
|
||||
run: function () {
|
||||
const iframeDocument = this.$anchor[0].contentDocument;
|
||||
if (iframeDocument.querySelector('#toolbar.oe-floating')) {
|
||||
console.error('There should not be a floating toolbar in the iframe');
|
||||
}
|
||||
},
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Click on the 'Start From Scratch' template.",
|
||||
trigger: 'iframe #default',
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Select an editable element",
|
||||
trigger: 'iframe .s_text_block',
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Make sure the snippets menu is hidden",
|
||||
trigger: 'iframe',
|
||||
run: function () {
|
||||
const iframeDocument = this.$anchor[0].contentDocument;
|
||||
if (!iframeDocument.querySelector('#oe_snippets.d-none')) {
|
||||
console.error('The snippet menu should be hidden');
|
||||
}
|
||||
},
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Make sure the toolbar is there",
|
||||
trigger: 'iframe #toolbar.oe-floating',
|
||||
run: () => null, // it's a check
|
||||
mobile: true,
|
||||
},
|
||||
...stepUtils.discardForm().map(command => ({...command, mobile: true})),
|
||||
]
|
||||
});
|
||||
|
||||
registry.category("web_tour.tours").add('mass_mailing_snippets_menu_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.",
|
||||
trigger: 'iframe .o_mail_theme_selector_new',
|
||||
},
|
||||
{
|
||||
content: "Make sure there does not exist a floating toolbar",
|
||||
trigger: 'iframe',
|
||||
run: function () {
|
||||
const iframeDocument = this.$anchor[0].contentDocument;
|
||||
if (iframeDocument.querySelector('#toolbar.oe-floating')) {
|
||||
console.error('There should not be a floating toolbar in the iframe');
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
content: "Make sure the empty template is an option on non-mobile devices.",
|
||||
trigger: 'iframe #empty',
|
||||
run: () => null,
|
||||
},
|
||||
{
|
||||
content: "Click on the default 'welcome' template.",
|
||||
trigger: 'iframe #default',
|
||||
},
|
||||
{ // necessary to wait for the cursor to be placed in the first p
|
||||
// and to avoid leaving the page before the selection is added
|
||||
content: "Wait for template selection event to be over.",
|
||||
trigger: 'iframe .o_editable.theme_selection_done',
|
||||
},
|
||||
{
|
||||
content: "Make sure the snippets menu is not hidden",
|
||||
trigger: 'iframe #oe_snippets:not(.d-none)',
|
||||
run: () => null,
|
||||
},
|
||||
{
|
||||
content: "Wait for .s_text_block to be populated",
|
||||
trigger: 'iframe .s_text_block p',
|
||||
run: () => null,
|
||||
},
|
||||
{
|
||||
content: "Click and select p block inside the editor",
|
||||
trigger: 'iframe',
|
||||
run: function () {
|
||||
const iframeWindow = this.$anchor[0].contentWindow;
|
||||
const iframeDocument = iframeWindow.document;
|
||||
const p = iframeDocument.querySelector('.s_text_block p');
|
||||
p.click();
|
||||
const selection = iframeWindow.getSelection();
|
||||
const range = iframeDocument.createRange();
|
||||
range.selectNodeContents(p);
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
},
|
||||
},
|
||||
{
|
||||
content: "Make sure the toolbar is there",
|
||||
trigger: 'iframe #oe_snippets .o_we_customize_panel #toolbar',
|
||||
run: () => null,
|
||||
},
|
||||
...stepUtils.discardForm(),
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { stepUtils } from "@web_tour/tour_service/tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('snippets_mailing_menu_tabs', {
|
||||
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: "Click on the 'Start From Scratch' template.",
|
||||
trigger: 'iframe #empty',
|
||||
},
|
||||
{
|
||||
content: "Click on the 'Design' tab.",
|
||||
trigger: 'iframe .o_we_customize_design_btn',
|
||||
},
|
||||
{
|
||||
content: "Click on the empty 'DRAG BUILDING BLOCKS HERE' area.",
|
||||
trigger: 'iframe .oe_structure.o_mail_no_options',
|
||||
},
|
||||
{
|
||||
content: "Click on the 'Design' tab.",
|
||||
trigger: 'iframe .o_we_customize_design_btn',
|
||||
},
|
||||
{
|
||||
content: "Verify that the customize panel is not empty.",
|
||||
trigger: 'iframe .o_we_customize_panel .snippet-option-DesignTab',
|
||||
run: () => null, // it's a check
|
||||
},
|
||||
{
|
||||
content: "Click on the style tab.",
|
||||
trigger: 'iframe .o_we_customize_snippet_btn',
|
||||
},
|
||||
{
|
||||
content: "Click on the 'Design' tab.",
|
||||
trigger: 'iframe .o_we_customize_design_btn',
|
||||
},
|
||||
{
|
||||
content: "Verify that the customize panel is not empty.",
|
||||
trigger: 'iframe .o_we_customize_panel .snippet-option-DesignTab',
|
||||
run: () => null, // it's a check
|
||||
},
|
||||
...stepUtils.discardForm(),
|
||||
]});
|
||||
@@ -0,0 +1,78 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { stepUtils } from "@web_tour/tour_service/tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('snippets_mailing_menu_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.",
|
||||
trigger: 'iframe .o_mail_theme_selector_new',
|
||||
},
|
||||
{
|
||||
content: "Make sure there does not exist a floating toolbar",
|
||||
trigger: 'iframe',
|
||||
run: function () {
|
||||
const iframeDocument = this.$anchor[0].contentDocument;
|
||||
if (iframeDocument.querySelector('#toolbar.oe-floating')) {
|
||||
console.error('There should not be a floating toolbar in the iframe');
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
content: "Make sure the empty template is an option on non-mobile devices.",
|
||||
trigger: 'iframe #empty',
|
||||
run: () => null,
|
||||
},
|
||||
{
|
||||
content: "Click on the default 'welcome' template.",
|
||||
trigger: 'iframe #default',
|
||||
},
|
||||
{ // necessary to wait for the cursor to be placed in the first p
|
||||
// and to avoid leaving the page before the selection is added
|
||||
content: "Wait for template selection event to be over.",
|
||||
trigger: 'iframe .o_editable.theme_selection_done',
|
||||
},
|
||||
{
|
||||
content: "Make sure the snippets menu is not hidden",
|
||||
trigger: 'iframe #oe_snippets:not(.d-none)',
|
||||
run: () => null,
|
||||
},
|
||||
{
|
||||
content: "Wait for .s_text_block to be populated",
|
||||
trigger: 'iframe .s_text_block p',
|
||||
run: () => null,
|
||||
},
|
||||
{
|
||||
content: "Click and select p block inside the editor",
|
||||
trigger: 'iframe',
|
||||
run: function () {
|
||||
const iframeWindow = this.$anchor[0].contentWindow;
|
||||
const iframeDocument = iframeWindow.document;
|
||||
const p = iframeDocument.querySelector('.s_text_block p');
|
||||
p.click();
|
||||
const selection = iframeWindow.getSelection();
|
||||
const range = iframeDocument.createRange();
|
||||
range.selectNodeContents(p);
|
||||
selection.removeAllRanges();
|
||||
selection.addRange(range);
|
||||
},
|
||||
},
|
||||
{
|
||||
content: "Make sure the toolbar is there",
|
||||
trigger: 'iframe #oe_snippets .o_we_customize_panel #toolbar',
|
||||
run: () => null,
|
||||
},
|
||||
...stepUtils.discardForm(),
|
||||
],
|
||||
});
|
||||
@@ -0,0 +1,69 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { stepUtils } from "@web_tour/tour_service/tour_utils";
|
||||
|
||||
registry.category("web_tour.tours").add('snippets_mailing_menu_toolbar_mobile', {
|
||||
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',
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Check templates available in theme selector",
|
||||
trigger: 'iframe .o_mail_theme_selector_new',
|
||||
run: function () {
|
||||
if (this.$anchor[0].querySelector('#empty')) {
|
||||
console.error('The empty template should not be visible on mobile.');
|
||||
}
|
||||
},
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Make sure the toolbar isn't floating",
|
||||
trigger: 'iframe',
|
||||
run: function () {
|
||||
const iframeDocument = this.$anchor[0].contentDocument;
|
||||
if (iframeDocument.querySelector('#toolbar.oe-floating')) {
|
||||
console.error('There should not be a floating toolbar in the iframe');
|
||||
}
|
||||
},
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Click on the 'Start From Scratch' template.",
|
||||
trigger: 'iframe #default',
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Select an editable element",
|
||||
trigger: 'iframe .s_text_block',
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Make sure the snippets menu is hidden",
|
||||
trigger: 'iframe',
|
||||
run: function () {
|
||||
const iframeDocument = this.$anchor[0].contentDocument;
|
||||
if (!iframeDocument.querySelector('#oe_snippets.d-none')) {
|
||||
console.error('The snippet menu should be hidden');
|
||||
}
|
||||
},
|
||||
mobile: true,
|
||||
},
|
||||
{
|
||||
content: "Make sure the toolbar is there",
|
||||
trigger: 'iframe #toolbar.oe-floating',
|
||||
run: () => null, // it's a check
|
||||
mobile: true,
|
||||
},
|
||||
...stepUtils.discardForm().map(command => ({...command, mobile: true})),
|
||||
]
|
||||
});
|
||||
@@ -243,9 +243,12 @@ class MassMailCommon(MailCommon, MassMailCase):
|
||||
super(MassMailCommon, cls).setUpClass()
|
||||
|
||||
cls.user_marketing = mail_new_test_user(
|
||||
cls.env, login='user_marketing',
|
||||
cls.env,
|
||||
groups='base.group_user,base.group_partner_manager,mass_mailing.group_mass_mailing_user',
|
||||
name='Martial Marketing', signature='--\nMartial')
|
||||
login='user_marketing',
|
||||
name='Martial Marketing',
|
||||
signature='--\nMartial',
|
||||
)
|
||||
|
||||
cls.email_reply_to = 'MyCompany SomehowAlias <test.alias@test.mycompany.com>'
|
||||
|
||||
|
||||
@@ -1,42 +1,56 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import odoo.tests
|
||||
from odoo.addons.base.tests.common import HttpCaseWithUserDemo
|
||||
from odoo.addons.mass_mailing.tests.common import MassMailCommon
|
||||
from odoo.tests import HttpCase, tagged
|
||||
|
||||
|
||||
@odoo.tests.tagged('-at_install', 'post_install')
|
||||
class TestUi(HttpCaseWithUserDemo):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.user_demo.groups_id |= self.env.ref('mass_mailing.group_mass_mailing_user')
|
||||
self.user_demo.groups_id |= self.env.ref('mail.group_mail_template_editor')
|
||||
self.user_demo.groups_id |= self.env.ref('mass_mailing.group_mass_mailing_campaign')
|
||||
@tagged('-at_install', 'post_install')
|
||||
class TestMailingUi(MassMailCommon, HttpCase):
|
||||
|
||||
def test_01_mass_mailing_editor_tour(self):
|
||||
self.start_tour("/web", 'mass_mailing_editor_tour', login="demo")
|
||||
mail = self.env['mailing.mailing'].search([('subject', '=', 'Test')])[0]
|
||||
# The tour created and saved an email. The edited version should be
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestMailingUi, cls).setUpClass()
|
||||
|
||||
cls.user_marketing.write({
|
||||
'groups_id': [
|
||||
(4, cls.env.ref('mail.group_mail_template_editor').id),
|
||||
],
|
||||
})
|
||||
|
||||
def test_mailing_campaign_tour(self):
|
||||
self.user_marketing.write({
|
||||
'groups_id': [
|
||||
(4, self.env.ref('mass_mailing.group_mass_mailing_campaign').id),
|
||||
],
|
||||
})
|
||||
self.start_tour("/web", 'mailing_campaign', login="user_marketing")
|
||||
|
||||
def test_mailing_editor_tour(self):
|
||||
mailing = self.env['mailing.mailing'].search([('subject', '=', 'TestFromTour')], limit=1)
|
||||
self.assertFalse(mailing)
|
||||
self.start_tour("/web", 'mailing_editor', login="user_marketing")
|
||||
|
||||
# The tour created and saved a mailing. The edited version should be
|
||||
# saved in body_arch, and its transpiled version (see convert_inline)
|
||||
# for email client compatibility should be saved in body_html. This
|
||||
# ensures both fields have different values (the mailing body should
|
||||
# have been converted to a table in body_html).
|
||||
self.assertIn('data-snippet="s_title"', mail.body_arch)
|
||||
self.assertTrue(mail.body_arch.startswith('<div'))
|
||||
self.assertIn('data-snippet="s_title"', mail.body_html)
|
||||
self.assertTrue(mail.body_html.startswith('<table'))
|
||||
mailing = self.env['mailing.mailing'].search([('subject', '=', 'TestFromTour')], limit=1)
|
||||
self.assertTrue(mailing)
|
||||
self.assertIn('data-snippet="s_title"', mailing.body_arch)
|
||||
self.assertTrue(mailing.body_arch.startswith('<div'))
|
||||
self.assertIn('data-snippet="s_title"', mailing.body_html)
|
||||
self.assertTrue(mailing.body_html.startswith('<table'))
|
||||
|
||||
def test_02_mass_mailing_snippets_menu_tabs(self):
|
||||
self.start_tour("/web", 'mass_mailing_snippets_menu_tabs', login="demo")
|
||||
def test_mailing_editor_theme_tour(self):
|
||||
self.start_tour('/web', 'mailing_editor_theme', login="demo")
|
||||
|
||||
def test_03_mass_mailing_snippets_toolbar_mobile_hide(self):
|
||||
self.start_tour("/web", 'mass_mailing_snippets_menu_toolbar_new_mailing_mobile', login="demo")
|
||||
def test_snippets_mailing_menu_tabs_tour(self):
|
||||
self.start_tour("/web", 'snippets_mailing_menu_tabs', login="demo")
|
||||
|
||||
def test_04_mass_mailing_snippets_menu_hide(self):
|
||||
self.start_tour("/web", 'mass_mailing_snippets_menu_toolbar', login="demo")
|
||||
def test_snippets_mailing_menu_toolbar_tour(self):
|
||||
self.start_tour("/web", 'snippets_mailing_menu_toolbar', login="demo")
|
||||
|
||||
def test_05_mass_mailing_basic_theme_toolbar(self):
|
||||
self.start_tour('/web', 'mass_mailing_basic_theme_toolbar', login="demo")
|
||||
|
||||
def test_06_mass_mailing_campaign_new_mailing(self):
|
||||
self.start_tour("/web", 'mass_mailing_campaing_new_mailing', login="demo")
|
||||
def test_snippets_mailing_menu_toolbar_mobile_tour(self):
|
||||
self.start_tour("/web", 'snippets_mailing_menu_toolbar_mobile', login="demo")
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
import wTourUtils from 'website.tour_utils';
|
||||
|
||||
wTourUtils.registerWebsitePreviewTour('newsletter_block_edition', {
|
||||
wTourUtils.registerWebsitePreviewTour('snippet_newsletter_block_with_edit', {
|
||||
test: true,
|
||||
url: '/',
|
||||
edition: true,
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import wTourUtils from "website.tour_utils";
|
||||
import newsletterPopupUseTour from "website_mass_mailing.tour.newsletter_popup_use";
|
||||
import snippetNewsletterPopupUseTour from "website_mass_mailing.tour.snippet_newsletter_popup_use";
|
||||
|
||||
wTourUtils.registerWebsitePreviewTour("newsletter_popup_edition", {
|
||||
wTourUtils.registerWebsitePreviewTour("snippet_newsletter_popup_edition", {
|
||||
test: true,
|
||||
url: "/",
|
||||
edition: true,
|
||||
@@ -23,6 +23,6 @@ wTourUtils.registerWebsitePreviewTour("newsletter_popup_edition", {
|
||||
content: "Check the modal has been saved, closed",
|
||||
trigger: 'iframe body:has(.o_newsletter_popup)',
|
||||
extra_trigger: 'iframe body:not(.editor_enable)',
|
||||
run: newsletterPopupUseTour.ensurePopupNotVisible,
|
||||
run: snippetNewsletterPopupUseTour.ensurePopupNotVisible,
|
||||
}
|
||||
]);
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
/** @odoo-module alias=website_mass_mailing.tour.newsletter_popup_use **/
|
||||
/** @odoo-module alias=website_mass_mailing.tour.snippet_newsletter_popup_use **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
|
||||
@@ -17,7 +17,7 @@ function ensurePopupNotVisible() {
|
||||
}
|
||||
}
|
||||
|
||||
registry.category("web_tour.tours").add('newsletter_popup_use', {
|
||||
registry.category("web_tour.tours").add('snippet_newsletter_popup_use', {
|
||||
test: true,
|
||||
url: '/',
|
||||
steps: [
|
||||
@@ -1,21 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import odoo
|
||||
import odoo.tests
|
||||
from odoo.tests import HttpCase, tagged
|
||||
|
||||
|
||||
@odoo.tests.common.tagged('post_install', '-at_install')
|
||||
class TestSnippets(odoo.tests.HttpCase):
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestSnippets(HttpCase):
|
||||
|
||||
def test_snippet_newsletter_popup(self):
|
||||
self.start_tour("/", "snippet_newsletter_popup_edition", login='admin')
|
||||
self.start_tour("/", "snippet_newsletter_popup_use", login=None)
|
||||
|
||||
def test_01_newsletter_popup(self):
|
||||
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')
|
||||
self.assertIn("hello@world.com", emails)
|
||||
|
||||
def test_02_newsletter_block_edition(self):
|
||||
def test_snippet_newsletter_block_witih_edit(self):
|
||||
admin_email = self.env.ref('base.user_admin').email
|
||||
# Get contacts with this email
|
||||
mass_mailing_contacts = self.env['mailing.contact'].search([('email', '=', admin_email)])
|
||||
@@ -23,6 +23,10 @@ class TestSnippets(odoo.tests.HttpCase):
|
||||
# Unsubscribe the admin's email from every mailing list to ensure the
|
||||
# tour can subscribe the admin again
|
||||
mailing_list.write({
|
||||
'contact_ids': [odoo.Command.unlink(id) for id in mass_mailing_contacts.ids]
|
||||
'contact_ids': [(3, contact_id) for contact_id in mass_mailing_contacts.ids],
|
||||
})
|
||||
self.start_tour(self.env['website'].get_client_action_url('/'), 'newsletter_block_edition', login='admin')
|
||||
self.start_tour(
|
||||
self.env['website'].get_client_action_url('/'),
|
||||
"snippet_newsletter_block_with_edit",
|
||||
login='admin'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user