Files
odoo_source/addons/website/static/tests/tours/snippet_countdown.js
T
qsm-odoo accb4b3245 [IMP] website, *: review website tour utils
*: test_website, website_blog, website_crm, website_event,
   website_forum, website_hr_recruitment, website_mass_mailing,
   website_sale, website_sale_wishlist, website_slides

- Make sure that all website tours reaching the website preview before
  their first step use the related website util to register their tour.

- Rename the website util to register a tour starting on the website
  preview from `registerEditionTour` to `registerWebsitePreviewTour`.
  Having a method using "Edition" in its name and having a boolean
  parameter named `edition` was a bit... strange.

- For both non edit mode and edit mode as a first step, ensure the util
  sets a high timeout for the first step. Indeed loading both the
  backend and the frontend (in the iframe) and potentially starting the
  edit mode can take a long time in automatic tests. We'll try and
  decrease the need for this high timeout of course.

- Review the implementation of those utils to be more consistent and
  also fix one or two mistakes in them.

closes odoo/odoo#100024

Related: odoo/design-themes#588
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-12 17:33:39 +02:00

57 lines
2.5 KiB
JavaScript

/** @odoo-module */
import wTourUtils from 'website.tour_utils';
wTourUtils.registerWebsitePreviewTour('snippet_countdown', {
test: true,
url: '/',
edition: true,
}, [
wTourUtils.dragNDrop({id: 's_countdown', name: 'Countdown'}),
wTourUtils.clickOnSnippet({id: 's_countdown', name: 'Countdown'}),
wTourUtils.changeOption('countdown', 'we-select:has([data-end-action]) we-toggler', 'end action'),
wTourUtils.changeOption('countdown', 'we-button[data-end-action="message"]', 'end action'),
wTourUtils.changeOption('countdown', 'we-button.toggle-edit-message', 'message preview'),
// The next two steps check that the end message does not disappear when a
// widgets_start_request is triggered.
{
content: "Hover an option which has a preview",
trigger: '[data-select-class="o_half_screen_height"]',
run: function (actions) {
this.$anchor.trigger('mouseover');
this.$anchor.trigger('mouseenter');
},
},
{
content: "Check that the countdown message is still displayed",
trigger: 'iframe .s_countdown .s_picture',
run: () => {
// Just a visibility check
// Also make sure the mouseout and mouseleave are triggered so that
// next steps make sense.
// TODO the next steps are not actually testing anything without
// it and the mouseout and mouseleave make sense but really it
// should not be *necessary* to simulate those for the editor flow
// to make some sense.
const $previousAnchor = $('[data-select-class="o_half_screen_height"]');
$previousAnchor.trigger('mouseout');
$previousAnchor.trigger('mouseleave');
},
},
// Next, we change the end action to message and no countdown while the edit
// message toggle is still activated. It should hide the countdown
wTourUtils.changeOption('countdown', 'we-select:has([data-end-action]) we-toggler', 'end action'),
wTourUtils.changeOption('countdown', 'we-button[data-end-action="message_no_countdown"]', 'end action'),
{
content: "Check that the countdown is not displayed",
trigger: 'iframe .s_countdown:has(.s_countdown_canvas_wrapper:not(:visible))',
run: () => null, // Just a visibility check
},
{
content: "Check that the message is still displayed",
trigger: 'iframe .s_countdown .s_picture',
run: () => null, // Just a visibility check
},
]);