Files
odoo_source/addons/website/static/tests/tours/snippet_countdown.js
T
99b50d18e2 [REF] test_website, *: adapt tours to new client action
*: website, website_blog, website_crm, website_event, website_forum,
   website_hr_recruitment, website_mass_mailing, website_sale,
   website_sale_loyalty, website_slides

This commit adds the current website displayed view xmlid outside of the
iframe, on its container, so that the tours registered with
registerThemeHomepageTour can continue to prepend their triggers with
the view xml id.

Introduce registerEditionTour: this function will allow tour maker to
more easily register a tour that needs to start in the iframe's backend
and go in edit mode.

See merge commit for more information.

task-2687506

Co-authored-by: Benjamin Vray <bvr@odoo.com>
Co-authored-by: Younn Olivier <yol@odoo.com>
2022-06-24 10:28:07 +02:00

57 lines
2.5 KiB
JavaScript

/** @odoo-module */
import wTourUtils from 'website.tour_utils';
wTourUtils.registerEditionTour('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
},
]);