diff --git a/addons/account/static/src/js/tours/account.js b/addons/account/static/src/js/tours/account.js index 671a13b5e5d..76572ff5b37 100644 --- a/addons/account/static/src/js/tours/account.js +++ b/addons/account/static/src/js/tours/account.js @@ -11,7 +11,7 @@ var _t = core._t; registry.category("web_tour.tours").add('account_tour', { url: "/web", sequence: 60, - steps: [ + steps: () => [ ...stepUtils.goToAppSteps('account.menu_finance', _t('Send invoices to your customers in no time with the Invoicing app.')), { trigger: "a.o_onboarding_step_action[data-method=action_open_step_company_data]", diff --git a/addons/account/static/tests/tours/account_dashboard_setup_bar_tests.js b/addons/account/static/tests/tours/account_dashboard_setup_bar_tests.js index 205922b26e6..5f30c00d0a3 100644 --- a/addons/account/static/tests/tours/account_dashboard_setup_bar_tests.js +++ b/addons/account/static/tests/tours/account_dashboard_setup_bar_tests.js @@ -10,7 +10,7 @@ registry.category("web_tour.tours").add('account_render_report', { test: true, url: '/web', - steps: [stepUtils.showAppsMenuItem(), + steps: () => [stepUtils.showAppsMenuItem(), { id: 'account_menu_click', trigger: '.o_app[data-menu-xmlid="account.menu_finance"]', diff --git a/addons/account/static/tests/tours/tax_group_tests.js b/addons/account/static/tests/tours/tax_group_tests.js index 279be69c783..57086ff6649 100644 --- a/addons/account/static/tests/tours/tax_group_tests.js +++ b/addons/account/static/tests/tours/tax_group_tests.js @@ -7,7 +7,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('account_tax_group', { test: true, url: "/web", - steps: [stepUtils.showAppsMenuItem(), + steps: () => [stepUtils.showAppsMenuItem(), { id: 'account_menu_click', content: "Go to Invoicing", diff --git a/addons/auth_password_policy_signup/static/src/js/password_meter.js b/addons/auth_password_policy_signup/static/src/js/password_meter.js index 509063186fa..7f6a0eee3a8 100644 --- a/addons/auth_password_policy_signup/static/src/js/password_meter.js +++ b/addons/auth_password_policy_signup/static/src/js/password_meter.js @@ -4,6 +4,7 @@ import { _t } from "web.core"; import Widget from "web.Widget"; import { computeScore } from "@auth_password_policy/password_policy"; import { sprintf } from "@web/core/utils/strings"; +import { translationIsReady } from "@web/core/l10n/translation"; export default Widget.extend({ tagName: "meter", @@ -22,6 +23,9 @@ export default Widget.extend({ this._required = required; this._recommended = recommended; }, + willStart() { + return translationIsReady + }, start() { var helpMessage = _t( "Required: %s.\n\nHint: increase length, use multiple words and use non-letter characters to increase your password's strength." diff --git a/addons/auth_totp/static/tests/totp_flow.js b/addons/auth_totp/static/tests/totp_flow.js index 416f85262b2..d5b9cd270b2 100644 --- a/addons/auth_totp/static/tests/totp_flow.js +++ b/addons/auth_totp/static/tests/totp_flow.js @@ -76,7 +76,7 @@ function closeProfileDialog({content, totp_state}) { registry.category("web_tour.tours").add('totp_tour_setup', { test: true, url: '/web', - steps: [...openUserProfileAtSecurityTab(), { + steps: () => [...openUserProfileAtSecurityTab(), { content: "Open totp wizard", trigger: 'button[name=action_totp_enable_wizard]', }, { @@ -121,7 +121,7 @@ registry.category("web_tour.tours").add('totp_tour_setup', { registry.category("web_tour.tours").add('totp_login_enabled', { test: true, url: '/', - steps: [{ + steps: () => [{ content: "check that we're on the login page or go to it", trigger: 'input#login, a:contains(Sign in)' }, { @@ -161,7 +161,7 @@ registry.category("web_tour.tours").add('totp_login_enabled', { registry.category("web_tour.tours").add('totp_login_device', { test: true, url: '/', - steps: [{ + steps: () => [{ content: "check that we're on the login page or go to it", trigger: 'input#login, a:contains(Sign in)' }, { @@ -242,7 +242,7 @@ registry.category("web_tour.tours").add('totp_login_device', { registry.category("web_tour.tours").add('totp_login_disabled', { test: true, url: '/', - steps: [{ + steps: () => [{ content: "check that we're on the login page or go to it", trigger: 'input#login, a:contains(Sign in)' }, { @@ -270,7 +270,7 @@ const columns = {}; registry.category("web_tour.tours").add('totp_admin_disables', { test: true, url: '/web', - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { content: 'Go to settings', trigger: '[data-menu-xmlid="base.menu_administration"]' }, { diff --git a/addons/auth_totp_mail/static/tests/totp_flow.js b/addons/auth_totp_mail/static/tests/totp_flow.js index 7c9682db600..620544de12a 100644 --- a/addons/auth_totp_mail/static/tests/totp_flow.js +++ b/addons/auth_totp_mail/static/tests/totp_flow.js @@ -39,7 +39,7 @@ function openAccountSettingsTab() { registry.category("web_tour.tours").add('totp_admin_self_invite', { test: true, url: '/web', - steps: [stepUtils.showAppsMenuItem(), ...openAccountSettingsTab(), { + steps: () => [stepUtils.showAppsMenuItem(), ...openAccountSettingsTab(), { content: "open the user's form", trigger: "td.o_data_cell:contains(admin)", }, { @@ -62,7 +62,7 @@ registry.category("web_tour.tours").add('totp_admin_self_invite', { registry.category("web_tour.tours").add('totp_admin_invite', { test: true, url: '/web', - steps: [stepUtils.showAppsMenuItem(), ...openAccountSettingsTab(), { + steps: () => [stepUtils.showAppsMenuItem(), ...openAccountSettingsTab(), { content: "open the user's form", trigger: "td.o_data_cell:contains(demo)", }, { diff --git a/addons/auth_totp_portal/static/tests/totp_portal.js b/addons/auth_totp_portal/static/tests/totp_portal.js index f38c4da1155..a1c4b30f8f1 100644 --- a/addons/auth_totp_portal/static/tests/totp_portal.js +++ b/addons/auth_totp_portal/static/tests/totp_portal.js @@ -6,7 +6,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('totportal_tour_setup', { test: true, url: '/my/security', - steps: [{ + steps: () => [{ content: "Open totp wizard", trigger: 'button#auth_totp_portal_enable', }, { @@ -44,7 +44,7 @@ registry.category("web_tour.tours").add('totportal_tour_setup', { registry.category("web_tour.tours").add('totportal_login_enabled', { test: true, url: '/', - steps: [{ + steps: () => [{ content: "check that we're on the login page or go to it", trigger: 'input#login, a:contains(Sign in)' }, { @@ -101,7 +101,7 @@ registry.category("web_tour.tours").add('totportal_login_enabled', { registry.category("web_tour.tours").add('totportal_login_disabled', { test: true, url: '/', - steps: [{ + steps: () => [{ content: "check that we're on the login page or go to it", trigger: 'input#login, a:contains(Sign in)' }, { diff --git a/addons/calendar/static/tests/tours/calendar_tour.js b/addons/calendar/static/tests/tours/calendar_tour.js index 899060fe660..8068a70de16 100644 --- a/addons/calendar/static/tests/tours/calendar_tour.js +++ b/addons/calendar/static/tests/tours/calendar_tour.js @@ -15,7 +15,7 @@ registry.category("web_tour.tours").add('calendar_appointments_hour_tour', { url: '/web', test: true, - steps: [stepUtils.showAppsMenuItem(), + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="calendar.mail_menu_calendar"]', content: 'Open Calendar', diff --git a/addons/contacts/static/tests/tours/debug_menu_set_defaults.js b/addons/contacts/static/tests/tours/debug_menu_set_defaults.js index 255ce474136..bb2b5a0718e 100644 --- a/addons/contacts/static/tests/tours/debug_menu_set_defaults.js +++ b/addons/contacts/static/tests/tours/debug_menu_set_defaults.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add('debug_menu_set_defaults', { test: true, url: '/web?debug=1', - steps: [ + steps: () => [ ...stepUtils.goToAppSteps('contacts.menu_contacts', "Open the contacts menu"), { content: "Create a new contact", diff --git a/addons/crm/static/src/js/tours/crm.js b/addons/crm/static/src/js/tours/crm.js index a18eb191fdd..9a8a1bb5b7d 100644 --- a/addons/crm/static/src/js/tours/crm.js +++ b/addons/crm/static/src/js/tours/crm.js @@ -11,7 +11,7 @@ registry.category("web_tour.tours").add('crm_tour', { url: "/web", rainbowManMessage: _t("Congrats, best of luck catching such big fish! :)"), sequence: 10, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="crm.crm_menu_root"]', content: Markup(_t('Ready to boost your sales? Let\'s have a look at your Pipeline.')), position: 'bottom', diff --git a/addons/crm/static/tests/tours/create_crm_team_tour.js b/addons/crm/static/tests/tours/create_crm_team_tour.js index dd9f4826ed9..a358c360118 100644 --- a/addons/crm/static/tests/tours/create_crm_team_tour.js +++ b/addons/crm/static/tests/tours/create_crm_team_tour.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('create_crm_team_tour', { url: "/web", test: true, - steps: [ + steps: () => [ ...stepUtils.goToAppSteps('crm.crm_menu_root'), { trigger: 'button[data-menu-xmlid="crm.crm_menu_config"]', diff --git a/addons/crm/static/tests/tours/crm_email_and_phone_propagation.js b/addons/crm/static/tests/tours/crm_email_and_phone_propagation.js index eabc25f43f5..a76b646cc83 100644 --- a/addons/crm/static/tests/tours/crm_email_and_phone_propagation.js +++ b/addons/crm/static/tests/tours/crm_email_and_phone_propagation.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add('crm_email_and_phone_propagation_edit_save', { test: true, url: '/web', - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="crm.crm_menu_root"]', @@ -26,7 +26,7 @@ registry.category("web_tour.tours").add('crm_email_and_phone_propagation_remove_email_and_phone', { test: true, url: '/web', - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="crm.crm_menu_root"]', diff --git a/addons/crm/static/tests/tours/crm_forecast_tour.js b/addons/crm/static/tests/tours/crm_forecast_tour.js index 396813635cb..93a25a02533 100644 --- a/addons/crm/static/tests/tours/crm_forecast_tour.js +++ b/addons/crm/static/tests/tours/crm_forecast_tour.js @@ -6,7 +6,7 @@ const today = luxon.DateTime.now(); registry.category("web_tour.tours").add('crm_forecast', { test: true, url: "/web", - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { trigger: ".o_app[data-menu-xmlid='crm.crm_menu_root']", diff --git a/addons/crm/static/tests/tours/crm_rainbowman.js b/addons/crm/static/tests/tours/crm_rainbowman.js index 79c5ecc38b1..2057314ba1b 100644 --- a/addons/crm/static/tests/tours/crm_rainbowman.js +++ b/addons/crm/static/tests/tours/crm_rainbowman.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add('crm_rainbowman', { test: true, url: "/web", - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { trigger: ".o_app[data-menu-xmlid='crm.crm_menu_root']", diff --git a/addons/crm_iap_mine/static/src/js/tours/crm_iap_lead.js b/addons/crm_iap_mine/static/src/js/tours/crm_iap_lead.js index 618925cc104..6f551e1fb38 100644 --- a/addons/crm_iap_mine/static/src/js/tours/crm_iap_lead.js +++ b/addons/crm_iap_mine/static/src/js/tours/crm_iap_lead.js @@ -1,40 +1,51 @@ /** @odoo-module **/ import { registry } from "@web/core/registry"; -import {Markup} from "web.utils"; +import { Markup } from "web.utils"; import core from "web.core"; import "web.legacy_tranlations_loaded"; import "@crm/js/tours/crm"; +import { patch } from "@web/core/utils/patch"; var _t = core._t; -var DragOppToWonStepIndex = registry.category("web_tour.tours").get("crm_tour").steps.findIndex(step => { - return (step.id === 'drag_opportunity_to_won_step'); -}); - -registry.category("web_tour.tours").get("crm_tour").steps.splice(DragOppToWonStepIndex + 1, 0, { - /** - * Add some steps between "Drag your opportunity to Won when you get - * the deal. Congrats!" and "Let’s have a look at an Opportunity." to - * include the steps related to the lead generation (crm_iap_mine). - * This eases the on boarding for the Lead Generation process. - * - */ - trigger: ".o_button_generate_leads", - content: Markup(_t("Looking for more opportunities?
Try the Lead Generation tool.")), - position: "bottom", - run: function (actions) { - actions.auto('.o_button_generate_leads'); +patch(registry.category("web_tour.tours").get("crm_tour"), "patch_crm_tour", { + steps() { + const originalSteps = this._super(); + const DragOppToWonStepIndex = originalSteps.findIndex( + (step) => step.id === "drag_opportunity_to_won_step" + ); + return originalSteps.splice( + DragOppToWonStepIndex + 1, + 0, + { + /** + * Add some steps between "Drag your opportunity to Won when you get + * the deal. Congrats!" and "Let’s have a look at an Opportunity." to + * include the steps related to the lead generation (crm_iap_mine). + * This eases the on boarding for the Lead Generation process. + * + */ + trigger: ".o_button_generate_leads", + content: Markup(_t("Looking for more opportunities?
Try the Lead Generation tool.")), + position: "bottom", + run: function (actions) { + actions.auto('.o_button_generate_leads'); + }, + }, + { + trigger: ".modal-body .o_industry", + content: _t("Which Industry do you want to target?"), + position: "right", + }, + { + trigger: ".modal-footer button[name=action_submit]", + content: _t("Now, just let the magic happen!"), + position: "bottom", + run: function (actions) { + actions.auto(".modal-footer button[special=cancel]"); + }, + } + ); }, -}, { - trigger: '.modal-body .o_industry', - content: _t("Which Industry do you want to target?"), - position: "right", -}, { - trigger: '.modal-footer button[name=action_submit]', - content: _t("Now, just let the magic happen!"), - position: "bottom", - run: function (actions) { - actions.auto('.modal-footer button[special=cancel]'); -} }); diff --git a/addons/event/static/src/js/tours/event_tour.js b/addons/event/static/src/js/tours/event_tour.js index 28e40ce9bd5..0a82f2b5053 100644 --- a/addons/event/static/src/js/tours/event_tour.js +++ b/addons/event/static/src/js/tours/event_tour.js @@ -12,7 +12,7 @@ registry.category("web_tour.tours").add('event_tour', { url: '/web', rainbowManMessage: _t("Great! Now all you have to do is wait for your attendees to show up!"), sequence: 210, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="event.event_main_menu"]', content: Markup(_t("Ready to organize events in a few minutes? Let's get started!")), position: 'bottom', diff --git a/addons/event_sale/static/tests/tours/event_configurator_ui.js b/addons/event_sale/static/tests/tours/event_configurator_ui.js index 07380d8c774..7c3b5487cf5 100644 --- a/addons/event_sale/static/tests/tours/event_configurator_ui.js +++ b/addons/event_sale/static/tests/tours/event_configurator_ui.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('event_configurator_tour', { url: "/web", test: true, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="sale.sale_menu_root"]', edition: 'community' }, { diff --git a/addons/hr/static/tests/tours/hr_employee_flow.js b/addons/hr/static/tests/tours/hr_employee_flow.js index cdfc8f39643..c864588b3ae 100644 --- a/addons/hr/static/tests/tours/hr_employee_flow.js +++ b/addons/hr/static/tests/tours/hr_employee_flow.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('hr_employee_tour', { test: true, url: '/web', - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: "Open Employees app", diff --git a/addons/hr/static/tests/tours/user_modify_own_profile_tour.js b/addons/hr/static/tests/tours/user_modify_own_profile_tour.js index 9a82f4f0a33..9d764c59bd9 100644 --- a/addons/hr/static/tests/tours/user_modify_own_profile_tour.js +++ b/addons/hr/static/tests/tours/user_modify_own_profile_tour.js @@ -2,19 +2,30 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; import { registry } from "@web/core/registry"; +import { patch } from "@web/core/utils/patch"; /** * As 'hr' changes the flow a bit and displays the user preferences form in a full view instead of * a modal, we adapt the steps of the original tour accordingly. */ -registry.category("web_tour.tours").get('mail/static/tests/tours/user_modify_own_profile_tour.js').steps = [{ - content: 'Open user account menu', - trigger: '.o_user_menu button', -}, { - content: "Open preferences / profile screen", - trigger: '[data-menu=settings]', -}, { - content: "Update the email address", - trigger: 'div[name="email"] input', - run: 'text updatedemail@example.com', -}, ...stepUtils.saveForm()]; +patch(registry.category("web_tour.tours").get("mail/static/tests/tours/user_modify_own_profile_tour.js"), "patch_user_modify_own_profile_tour", { + steps() { + return [ + { + content: 'Open user account menu', + trigger: '.o_user_menu button', + }, + { + content: "Open preferences / profile screen", + trigger: '[data-menu=settings]', + }, + { + content: "Update the email address", + trigger: 'div[name="email"] input', + run: 'text updatedemail@example.com', + }, + ...stepUtils.saveForm(), + ]; + } +}); + diff --git a/addons/hr_expense/static/src/js/tours/hr_expense.js b/addons/hr_expense/static/src/js/tours/hr_expense.js index 562a15e9f5c..dc0efa89ec3 100644 --- a/addons/hr_expense/static/src/js/tours/hr_expense.js +++ b/addons/hr_expense/static/src/js/tours/hr_expense.js @@ -10,7 +10,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('hr_expense_tour' , { url: "/web", rainbowManMessage: _t("There you go - expense management in a nutshell!"), - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="hr_expense.menu_hr_expense_root"]', content: _t("Wasting time recording your receipts? Let’s try a better way."), position: 'right', diff --git a/addons/hr_expense/static/tests/tours/expense_upload_tours.js b/addons/hr_expense/static/tests/tours/expense_upload_tours.js index bd8691291f1..174bd364e77 100644 --- a/addons/hr_expense/static/tests/tours/expense_upload_tours.js +++ b/addons/hr_expense/static/tests/tours/expense_upload_tours.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add('hr_expense_test_tour', { test: true, url: "/web", - steps: [stepUtils.showAppsMenuItem(), + steps: () => [stepUtils.showAppsMenuItem(), { content: "Go to Expense", trigger: '.o_app[data-menu-xmlid="hr_expense.menu_hr_expense_root"]', diff --git a/addons/hr_holidays/static/src/tours/hr_holidays_tour.js b/addons/hr_holidays/static/src/tours/hr_holidays_tour.js index cd9ca902269..5046c1cbeb2 100644 --- a/addons/hr_holidays/static/src/tours/hr_holidays_tour.js +++ b/addons/hr_holidays/static/src/tours/hr_holidays_tour.js @@ -14,7 +14,7 @@ registry.category("web_tour.tours").add('hr_holidays_tour', { url: '/web', rainbowManMessage: _t("Congrats, we can see that your request has been validated."), test: false, - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="hr_holidays.menu_hr_holidays_root"]', diff --git a/addons/hr_holidays/static/tests/tours/time_off_request_calendar_view.js b/addons/hr_holidays/static/tests/tours/time_off_request_calendar_view.js index f58e6826d5b..13a94c87619 100644 --- a/addons/hr_holidays/static/tests/tours/time_off_request_calendar_view.js +++ b/addons/hr_holidays/static/tests/tours/time_off_request_calendar_view.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('time_off_request_calendar_view', { test: true, url: '/web', - steps: [stepUtils.showAppsMenuItem(), + steps: () => [stepUtils.showAppsMenuItem(), { content: "Open Time Off app", trigger: '.o_app[data-menu-xmlid="hr_holidays.menu_hr_holidays_root"]', diff --git a/addons/hr_recruitment/static/src/js/tours/hr_recruitment.js b/addons/hr_recruitment/static/src/js/tours/hr_recruitment.js index 1898e054def..00a6d474448 100644 --- a/addons/hr_recruitment/static/src/js/tours/hr_recruitment.js +++ b/addons/hr_recruitment/static/src/js/tours/hr_recruitment.js @@ -13,7 +13,7 @@ registry.category("web_tour.tours").add('hr_recruitment_tour',{ rainbowManMessage: markup(_t("
Great job! You hired a new colleague!
Try the Website app to publish job offers online.
")), fadeout: 'very_slow', sequence: 230, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="hr_recruitment.menu_hr_recruitment_root"]', content: Markup(_t("Let's have a look at how to improve your hiring process.")), position: 'right', diff --git a/addons/hr_skills/static/tests/tours/skills_tour.js b/addons/hr_skills/static/tests/tours/skills_tour.js index 7d97db8d8ca..7af9a9eb203 100644 --- a/addons/hr_skills/static/tests/tours/skills_tour.js +++ b/addons/hr_skills/static/tests/tours/skills_tour.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('hr_skills_tour', { test: true, url: '/web', - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: "Open Employees app", diff --git a/addons/im_livechat/static/tests/tours/im_livechat_channel_creation_tour.js b/addons/im_livechat/static/tests/tours/im_livechat_channel_creation_tour.js index 7cc3481877c..da897de374b 100644 --- a/addons/im_livechat/static/tests/tours/im_livechat_channel_creation_tour.js +++ b/addons/im_livechat/static/tests/tours/im_livechat_channel_creation_tour.js @@ -14,14 +14,14 @@ const requestChatSteps = [ registry.category("web_tour.tours").add("im_livechat_request_chat", { test: true, - steps: requestChatSteps, + steps: () => requestChatSteps, shadow_dom: ".o-livechat-root", }); registry.category("web_tour.tours").add("im_livechat_request_chat_and_send_message", { test: true, shadow_dom: ".o-livechat-root", - steps: [ + steps: () => [ ...requestChatSteps, { trigger: ".o-mail-Composer-input", diff --git a/addons/im_livechat/static/tests/tours/im_livechat_chatbot_steps_sequence_tour.js b/addons/im_livechat/static/tests/tours/im_livechat_chatbot_steps_sequence_tour.js index ccb7a98bcc1..e0ca04523ed 100644 --- a/addons/im_livechat/static/tests/tours/im_livechat_chatbot_steps_sequence_tour.js +++ b/addons/im_livechat/static/tests/tours/im_livechat_chatbot_steps_sequence_tour.js @@ -61,7 +61,7 @@ const commonSteps = [ registry.category("web_tour.tours").add("im_livechat_chatbot_steps_sequence_tour", { test: true, url: "/web", - steps: [ + steps: () => [ ...commonSteps, { trigger: 'button:contains("Save & Close")', @@ -80,7 +80,7 @@ registry.category("web_tour.tours").add("im_livechat_chatbot_steps_sequence_tour registry.category("web_tour.tours").add("im_livechat_chatbot_steps_sequence_with_move_tour", { test: true, url: "/web", - steps: [ + steps: () => [ ...commonSteps, { trigger: 'button:contains("Save & New")', diff --git a/addons/l10n_ar/static/src/js/tours/account.js b/addons/l10n_ar/static/src/js/tours/account.js index ecc2b4e7730..036b00ece62 100644 --- a/addons/l10n_ar/static/src/js/tours/account.js +++ b/addons/l10n_ar/static/src/js/tours/account.js @@ -1,23 +1,27 @@ /** @odoo-module **/ +import { patch } from "@web/core/utils/patch"; +import { registry } from "@web/core/registry"; +import "account.tour"; - import "account.tour"; - import { registry } from "@web/core/registry"; - let account_tour = registry.category("web_tour.tours").get("account_tour"); - // Remove the step suggesting to change the name as it is done another way (document number) - account_tour.steps = account_tour.steps.filter(step => step.trigger != "input[name=name]"); - - // Configure the AFIP Responsibility - let partner_step_idx = account_tour.steps.findIndex(step => step.trigger == 'div[name=partner_id] input'); - account_tour.steps.splice(partner_step_idx + 2, 0, { +patch(registry.category("web_tour.tours").get("account_tour"), "patch_account_tour", { + steps() { + const originalSteps = this._super(); + // Remove the step suggesting to change the name as it is done another way (document number) + const filteredSteps = originalSteps.filter((step) => step.trigger != "input[name=name]"); + const stepIndex = filteredSteps.findIndex((step) => step.trigger == 'div[name=partner_id] input'); + filteredSteps.splice(stepIndex + 2, 0, { // FIXME WOWL: this selector needs to work in both legacy and non-legacy views - trigger: "div[name=l10n_ar_afip_responsibility_type_id] input", - extra_trigger: "[name=move_type] [raw-value=out_invoice], [name=move_type][raw-value=out_invoice]", - position: "bottom", - content: "Set the AFIP Responsability", - run: "text IVA", - }) - account_tour.steps.splice(partner_step_idx + 3, 0, { - trigger: ".ui-menu-item > a:contains('IVA').ui-state-active", - auto: true, - in_modal: false, - }) + trigger: "div[name=l10n_ar_afip_responsibility_type_id] input", + extra_trigger: "[name=move_type] [raw-value=out_invoice], [name=move_type][raw-value=out_invoice]", + position: "bottom", + content: "Set the AFIP Responsability", + run: "text IVA", + }) + filteredSteps.splice(stepIndex + 3, 0, { + trigger: ".ui-menu-item > a:contains('IVA').ui-state-active", + auto: true, + in_modal: false, + }); + return filteredSteps; + } +}); diff --git a/addons/lunch/static/tests/tours/order_lunch.js b/addons/lunch/static/tests/tours/order_lunch.js index a74576e8c13..2622724f3f1 100644 --- a/addons/lunch/static/tests/tours/order_lunch.js +++ b/addons/lunch/static/tests/tours/order_lunch.js @@ -7,7 +7,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('order_lunch_tour', { url: "/web", test: true, - steps: [{ + steps: () => [{ trigger: 'a[data-menu-xmlid="lunch.menu_lunch"]', content: _t("Start by accessing the lunch app."), position: 'bottom', diff --git a/addons/mail/static/src/discuss/core/web/discuss_tour.js b/addons/mail/static/src/discuss/core/web/discuss_tour.js index db64aad1dbf..dc8e978431e 100644 --- a/addons/mail/static/src/discuss/core/web/discuss_tour.js +++ b/addons/mail/static/src/discuss/core/web/discuss_tour.js @@ -8,7 +8,7 @@ import { Markup } from "web.utils"; registry.category("web_tour.tours").add("mail_tour", { url: "/web#action=mail.action_discuss", sequence: 80, - steps: [ + steps: () => [ { trigger: ".o-mail-DiscussCategory-channel .o-mail-DiscussCategory-add", content: Markup( diff --git a/addons/mail/static/src/js/tours/load_message_order_tour.js b/addons/mail/static/src/js/tours/load_message_order_tour.js index 29deb4f11c5..daf90136dbc 100644 --- a/addons/mail/static/src/js/tours/load_message_order_tour.js +++ b/addons/mail/static/src/js/tours/load_message_order_tour.js @@ -4,7 +4,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add("mail.load_message_order", { test: true, - steps: [ + steps: () => [ { trigger: ".o-mail-DiscussCategoryItem:contains(MyTestChannel)", run: "click", diff --git a/addons/mail/static/tests/tours/discuss_channel_as_guest_tour.js b/addons/mail/static/tests/tours/discuss_channel_as_guest_tour.js index 187e39956c0..81aa073d10c 100644 --- a/addons/mail/static/tests/tours/discuss_channel_as_guest_tour.js +++ b/addons/mail/static/tests/tours/discuss_channel_as_guest_tour.js @@ -6,7 +6,7 @@ registry .category("web_tour.tours") .add("mail/static/tests/tours/discuss_channel_as_guest_tour.js", { test: true, - steps: [ + steps: () => [ { content: "Channel secret token has been hidden on welcome page", trigger: ".o-mail-WelcomePage", diff --git a/addons/mail/static/tests/tours/discuss_public_tour.js b/addons/mail/static/tests/tours/discuss_public_tour.js index 80d7954e085..bad512548f3 100644 --- a/addons/mail/static/tests/tours/discuss_public_tour.js +++ b/addons/mail/static/tests/tours/discuss_public_tour.js @@ -5,7 +5,7 @@ import { createFile, inputFiles } from "web.test_utils_file"; registry.category("web_tour.tours").add("mail/static/tests/tours/discuss_public_tour.js", { test: true, - steps: [ + steps: () => [ { trigger: ".o-mail-DiscussPublic", extraTrigger: ".o-mail-Thread", diff --git a/addons/mail/static/tests/tours/dynamic_placeholder_tour.js b/addons/mail/static/tests/tours/dynamic_placeholder_tour.js index 3c9d0fb562c..37b28a533a7 100644 --- a/addons/mail/static/tests/tours/dynamic_placeholder_tour.js +++ b/addons/mail/static/tests/tours/dynamic_placeholder_tour.js @@ -7,7 +7,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add("mail/static/tests/tours/dynamic_placeholder_tour.js", { url: "/web", test: true, - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: 'Go into the Setting "app"', diff --git a/addons/mail/static/tests/tours/mail_chatter_activity_test_tour.js b/addons/mail/static/tests/tours/mail_chatter_activity_test_tour.js index 1c5999e79fe..3b32f93a592 100644 --- a/addons/mail/static/tests/tours/mail_chatter_activity_test_tour.js +++ b/addons/mail/static/tests/tours/mail_chatter_activity_test_tour.js @@ -4,7 +4,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add("mail_activity_schedule_from_chatter", { test: true, - steps: [ + steps: () => [ { trigger: "button:contains('Activities')", }, diff --git a/addons/mail/static/tests/tours/mail_full_composer_test_tour.js b/addons/mail/static/tests/tours/mail_full_composer_test_tour.js index d3ada9d6c79..77b668e242b 100644 --- a/addons/mail/static/tests/tours/mail_full_composer_test_tour.js +++ b/addons/mail/static/tests/tours/mail_full_composer_test_tour.js @@ -11,7 +11,7 @@ import { createFile, inputFiles } from "web.test_utils_file"; */ registry.category("web_tour.tours").add("mail/static/tests/tours/mail_full_composer_test_tour.js", { test: true, - steps: [ + steps: () => [ { content: "Click on Send Message", trigger: "button:contains(Send message)", diff --git a/addons/mail/static/tests/tours/user_modify_own_profile_tour.js b/addons/mail/static/tests/tours/user_modify_own_profile_tour.js index fdc5ab38a8a..15cf7ebe40b 100644 --- a/addons/mail/static/tests/tours/user_modify_own_profile_tour.js +++ b/addons/mail/static/tests/tours/user_modify_own_profile_tour.js @@ -7,7 +7,7 @@ import { registry } from "@web/core/registry"; */ registry.category("web_tour.tours").add("mail/static/tests/tours/user_modify_own_profile_tour.js", { test: true, - steps: [ + steps: () => [ { content: "Open user account menu", trigger: ".o_user_menu button", diff --git a/addons/mass_mailing/static/src/js/tours/mass_mailing_tour.js b/addons/mass_mailing/static/src/js/tours/mass_mailing_tour.js index d3a0076ac1d..d38d1cd3777 100644 --- a/addons/mass_mailing/static/src/js/tours/mass_mailing_tour.js +++ b/addons/mass_mailing/static/src/js/tours/mass_mailing_tour.js @@ -11,7 +11,7 @@ url: '/web', rainbowManMessage: _t('Congratulations, I love your first mailing. :)'), sequence: 200, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="mass_mailing.mass_mailing_menu_root"]', content: _t("Let's try the Email Marketing app."), width: 225, diff --git a/addons/mass_mailing/static/tests/tours/mailing_campaign.js b/addons/mass_mailing/static/tests/tours/mailing_campaign.js index e849e3cff46..82735b99b5d 100644 --- a/addons/mass_mailing/static/tests/tours/mailing_campaign.js +++ b/addons/mass_mailing/static/tests/tours/mailing_campaign.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category('web_tour.tours').add('mailing_campaign', { test: true, url: '/web', - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: 'Select the "Email Marketing" app', diff --git a/addons/mass_mailing/static/tests/tours/mailing_editor.js b/addons/mass_mailing/static/tests/tours/mailing_editor.js index 4ac652d3be1..d9b2d292df9 100644 --- a/addons/mass_mailing/static/tests/tours/mailing_editor.js +++ b/addons/mass_mailing/static/tests/tours/mailing_editor.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('mailing_editor', { url: '/web', test: true, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="mass_mailing.mass_mailing_menu_root"]', }, { trigger: 'button.o_list_button_add', diff --git a/addons/mass_mailing/static/tests/tours/mailing_editor_theme.js b/addons/mass_mailing/static/tests/tours/mailing_editor_theme.js index 29a7bbb9061..c35de1e29c5 100644 --- a/addons/mass_mailing/static/tests/tours/mailing_editor_theme.js +++ b/addons/mass_mailing/static/tests/tours/mailing_editor_theme.js @@ -7,7 +7,7 @@ import { boundariesIn, setSelection } from "@web_editor/js/editor/odoo-editor/sr registry.category("web_tour.tours").add('mailing_editor_theme', { test: true, url: '/web', - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: "Select the 'Email Marketing' app.", diff --git a/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_tabs.js b/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_tabs.js index b54c1d66059..a40c0a0e846 100644 --- a/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_tabs.js +++ b/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_tabs.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('snippets_mailing_menu_tabs', { test: true, url: '/web', - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: "Select the 'Email Marketing' app.", trigger: '.o_app[data-menu-xmlid="mass_mailing.mass_mailing_menu_root"]', diff --git a/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_toolbar.js b/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_toolbar.js index d0fd4a1a29f..9b9516ffe49 100644 --- a/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_toolbar.js +++ b/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_toolbar.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('snippets_mailing_menu_toolbar', { test: true, url: '/web', - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: "Select the 'Email Marketing' app.", trigger: '.o_app[data-menu-xmlid="mass_mailing.mass_mailing_menu_root"]', diff --git a/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_toolbar_mobile.js b/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_toolbar_mobile.js index b26e35a541f..270c89c6023 100644 --- a/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_toolbar_mobile.js +++ b/addons/mass_mailing/static/tests/tours/snippets_mailing_menu_toolbar_mobile.js @@ -6,7 +6,7 @@ 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: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: "Select the 'Email Marketing' app.", trigger: '.o_app[data-menu-xmlid="mass_mailing.mass_mailing_menu_root"]', diff --git a/addons/mrp/static/tests/tours/mrp_manual_consumption.js b/addons/mrp/static/tests/tours/mrp_manual_consumption.js index 17e32d56b43..635cd1065ea 100644 --- a/addons/mrp/static/tests/tours/mrp_manual_consumption.js +++ b/addons/mrp/static/tests/tours/mrp_manual_consumption.js @@ -5,7 +5,7 @@ import { stepUtils } from '@web_tour/tour_service/tour_utils'; registry.category("web_tour.tours").add('test_mrp_manual_consumption', { test: true, - steps: [ + steps: () => [ { trigger: 'div[name=move_raw_ids] td[name="quantity_done"]:last:contains("5.00")', run: () => {}, diff --git a/addons/mrp_subcontracting/__manifest__.py b/addons/mrp_subcontracting/__manifest__.py index 2bcadbf8a8c..2459f28ddd4 100644 --- a/addons/mrp_subcontracting/__manifest__.py +++ b/addons/mrp_subcontracting/__manifest__.py @@ -134,6 +134,7 @@ 'mrp_subcontracting/static/src/subcontracting_portal/*', 'web/static/src/start.js', 'web/static/src/legacy/legacy_setup.js', + ('remove', 'web/static/src/core/emoji_picker/emoji_data.js'), ], }, 'uninstall_hook': 'uninstall_hook', diff --git a/addons/mrp_subcontracting/static/tests/tours/subcontracting_portal_tour.js b/addons/mrp_subcontracting/static/tests/tours/subcontracting_portal_tour.js index f07e792411a..cfa1815e0e7 100644 --- a/addons/mrp_subcontracting/static/tests/tours/subcontracting_portal_tour.js +++ b/addons/mrp_subcontracting/static/tests/tours/subcontracting_portal_tour.js @@ -2,20 +2,21 @@ import { registry } from "@web/core/registry"; -const subcontractingPortalSteps = [{ - trigger: 'table > tbody > tr a:has(span:contains(WH/IN/00))', - content: 'Select the picking to open the backend view.', - run: 'click', -},{ - trigger: 'iframe .o_subcontracting_portal', - content: 'Wait the subcontracting portal to be loaded.', - run: function () {}, -}, { - trigger: 'iframe button[name="action_show_details"]', - run: 'click', -}]; - registry.category("web_tour.tours").add('subcontracting_portal_tour', { test: true, url: '/my/productions', - steps: subcontractingPortalSteps }); + steps: () => [ + { + trigger: 'table > tbody > tr a:has(span:contains(WH/IN/00))', + content: 'Select the picking to open the backend view.', + run: 'click', + },{ + trigger: 'iframe .o_subcontracting_portal', + content: 'Wait the subcontracting portal to be loaded.', + run: function () {}, + }, { + trigger: 'iframe button[name="action_show_details"]', + run: 'click', + } + ], +}); diff --git a/addons/point_of_sale/__manifest__.py b/addons/point_of_sale/__manifest__.py index c92c9397252..90d7af5c558 100644 --- a/addons/point_of_sale/__manifest__.py +++ b/addons/point_of_sale/__manifest__.py @@ -146,6 +146,7 @@ 'point_of_sale.assets_qunit_tests': [ ('include', 'point_of_sale._assets_pos'), # dependencies of web.tests_assets (in the web tests, these come from assets_backend) + 'web/static/tests/patch_translations.js', 'web/static/src/owl2_compatibility/app.js', 'web/static/lib/jquery/jquery.js', 'web/static/lib/jquery/jquery.browser.js', diff --git a/addons/point_of_sale/static/src/app/loader/loader.xml b/addons/point_of_sale/static/src/app/loader/loader.xml index 19b1e51a3b3..6506fe5ab44 100644 --- a/addons/point_of_sale/static/src/app/loader/loader.xml +++ b/addons/point_of_sale/static/src/app/loader/loader.xml @@ -5,9 +5,9 @@
- + diff --git a/addons/point_of_sale/static/src/backend/tours/point_of_sale.js b/addons/point_of_sale/static/src/backend/tours/point_of_sale.js index 30b24c4d1b8..f163bfa8045 100644 --- a/addons/point_of_sale/static/src/backend/tours/point_of_sale.js +++ b/addons/point_of_sale/static/src/backend/tours/point_of_sale.js @@ -10,7 +10,7 @@ registry.category("web_tour.tours").add("point_of_sale_tour", { url: "/web", rainbowMan: false, sequence: 45, - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"]', diff --git a/addons/point_of_sale/static/tests/tours/Chrome.tour.js b/addons/point_of_sale/static/tests/tours/Chrome.tour.js index 2067ee8501b..8c6672ef5db 100644 --- a/addons/point_of_sale/static/tests/tours/Chrome.tour.js +++ b/addons/point_of_sale/static/tests/tours/Chrome.tour.js @@ -8,103 +8,110 @@ import { Chrome } from "@point_of_sale/../tests/tours/helpers/ChromeTourMethods" import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); - -// Order 1 is at Product Screen -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Desk Pad", "1", "2", "2.0"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.checkStatus("-0001", "Ongoing"); - -// Order 2 is at Payment Screen -TicketScreen.do.clickNewTicket(); -ProductScreen.exec.addOrderline("Monitor Stand", "3", "4", "12.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.checkStatus("-0002", "Payment"); - -// Order 3 is at Receipt Screen -TicketScreen.do.clickNewTicket(); -ProductScreen.exec.addOrderline("Whiteboard Pen", "5", "6", "30.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(true); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.checkStatus("-0003", "Receipt"); - -// Select order 1, should be at Product Screen -TicketScreen.do.selectOrder("-0001"); -ProductScreen.check.productIsDisplayed("Desk Pad"); -ProductScreen.check.selectedOrderlineHas("Desk Pad", "1.0", "2.0"); - -// Select order 2, should be at Payment Screen -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.selectOrder("-0002"); -PaymentScreen.check.emptyPaymentlines("12.0"); -PaymentScreen.check.validateButtonIsHighlighted(false); - -// Select order 3, should be at Receipt Screen -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.selectOrder("-0003"); -ReceiptScreen.check.totalAmountContains("30.0"); - -// Pay order 1, with change -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.selectOrder("-0001"); -ProductScreen.check.isShown(); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.enterPaymentLineAmount("Cash", "20"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(true); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.totalAmountContains("2.0"); - -// Order 1 now should have Receipt status -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.checkStatus("-0001", "Receipt"); - -// Select order 3, should still be at Receipt Screen -// and the total amount doesn't change. -TicketScreen.do.selectOrder("-0003"); -ReceiptScreen.check.totalAmountContains("30.0"); - -// click next screen on order 3 -// then delete the new empty order -ReceiptScreen.do.clickNextOrder(); -ProductScreen.check.orderIsEmpty(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.deleteOrder("-0004"); -TicketScreen.do.deleteOrder("-0001"); - -// After deleting order 1 above, order 2 became -// the 2nd-row order and it has payment status -TicketScreen.check.nthRowContains(2, "Payment"); -TicketScreen.do.deleteOrder("-0002"); -Chrome.do.confirmPopup(); -TicketScreen.do.clickNewTicket(); - -// Invoice an order -ProductScreen.exec.addOrderline("Whiteboard Pen", "5", "6"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Nicole Ford"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.clickInvoiceButton(); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.isShown(); - -registry.category("web_tour.tours").add("ChromeTour", { test: true, url: "/pos/ui", steps: getSteps() }); +registry + .category("web_tour.tours") + .add("ChromeTour", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + // Order 1 is at Product Screen + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Desk Pad", "1", "2", "2.0"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.checkStatus("-0001", "Ongoing"); + + // Order 2 is at Payment Screen + TicketScreen.do.clickNewTicket(); + ProductScreen.exec.addOrderline("Monitor Stand", "3", "4", "12.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.checkStatus("-0002", "Payment"); + + // Order 3 is at Receipt Screen + TicketScreen.do.clickNewTicket(); + ProductScreen.exec.addOrderline("Whiteboard Pen", "5", "6", "30.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(true); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.checkStatus("-0003", "Receipt"); + + // Select order 1, should be at Product Screen + TicketScreen.do.selectOrder("-0001"); + ProductScreen.check.productIsDisplayed("Desk Pad"); + ProductScreen.check.selectedOrderlineHas("Desk Pad", "1.0", "2.0"); + + // Select order 2, should be at Payment Screen + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectOrder("-0002"); + PaymentScreen.check.emptyPaymentlines("12.0"); + PaymentScreen.check.validateButtonIsHighlighted(false); + + // Select order 3, should be at Receipt Screen + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectOrder("-0003"); + ReceiptScreen.check.totalAmountContains("30.0"); + + // Pay order 1, with change + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectOrder("-0001"); + ProductScreen.check.isShown(); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.enterPaymentLineAmount("Cash", "20"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(true); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.totalAmountContains("2.0"); + + // Order 1 now should have Receipt status + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.checkStatus("-0001", "Receipt"); + + // Select order 3, should still be at Receipt Screen + // and the total amount doesn't change. + TicketScreen.do.selectOrder("-0003"); + ReceiptScreen.check.totalAmountContains("30.0"); + + // click next screen on order 3 + // then delete the new empty order + ReceiptScreen.do.clickNextOrder(); + ProductScreen.check.orderIsEmpty(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.deleteOrder("-0004"); + TicketScreen.do.deleteOrder("-0001"); + + // After deleting order 1 above, order 2 became + // the 2nd-row order and it has payment status + TicketScreen.check.nthRowContains(2, "Payment"); + TicketScreen.do.deleteOrder("-0002"); + Chrome.do.confirmPopup(); + TicketScreen.do.clickNewTicket(); + + // Invoice an order + ProductScreen.exec.addOrderline("Whiteboard Pen", "5", "6"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Nicole Ford"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.clickInvoiceButton(); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); + return getSteps(); + } + }); diff --git a/addons/point_of_sale/static/tests/tours/FixedPriceNegativeQty.tour.js b/addons/point_of_sale/static/tests/tours/FixedPriceNegativeQty.tour.js index db987677b56..47d7f1bed3a 100644 --- a/addons/point_of_sale/static/tests/tours/FixedPriceNegativeQty.tour.js +++ b/addons/point_of_sale/static/tests/tours/FixedPriceNegativeQty.tour.js @@ -6,20 +6,28 @@ import { ReceiptScreen } from "@point_of_sale/../tests/tours/helpers/ReceiptScre import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); -ProductScreen.do.clickHomeCategory(); - -ProductScreen.do.clickDisplayedProduct("Zero Amount Product"); -ProductScreen.check.selectedOrderlineHas("Zero Amount Product", "1.0", "1.0"); -ProductScreen.do.pressNumpad("+/- 1"); -ProductScreen.check.selectedOrderlineHas("Zero Amount Product", "-1.0", "-1.0"); - -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.check.remainingIs("0.00"); -PaymentScreen.do.clickValidate(); - -ReceiptScreen.check.receiptIsThere(); - -registry.category("web_tour.tours").add("FixedTaxNegativeQty", { test: true, url: "/pos/ui", steps: getSteps() }); +registry +.category("web_tour.tours") +.add("FixedTaxNegativeQty", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.clickHomeCategory(); + + ProductScreen.do.clickDisplayedProduct("Zero Amount Product"); + ProductScreen.check.selectedOrderlineHas("Zero Amount Product", "1.0", "1.0"); + ProductScreen.do.pressNumpad("+/- 1"); + ProductScreen.check.selectedOrderlineHas("Zero Amount Product", "-1.0", "-1.0"); + + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.check.remainingIs("0.00"); + PaymentScreen.do.clickValidate(); + + ReceiptScreen.check.receiptIsThere(); + return getSteps(); + } +}); diff --git a/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js b/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js index 3e3a88a231b..35edc59a3be 100644 --- a/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/PaymentScreen.tour.js @@ -8,266 +8,305 @@ import { ReceiptScreen } from "@point_of_sale/../tests/tours/helpers/ReceiptScre import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); +registry + .category("web_tour.tours") + .add("PaymentScreenTour", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.exec.addOrderline("Letter Tray", "10"); + ProductScreen.check.selectedOrderlineHas("Letter Tray", "10.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.check.emptyPaymentlines("52.8"); + + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.enterPaymentLineAmount("Cash", "11"); + PaymentScreen.check.selectedPaymentlineHas("Cash", "11.00"); + PaymentScreen.check.remainingIs("41.8"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(false); + // remove the selected paymentline with multiple backspace presses + PaymentScreen.do.pressNumpad("Backspace Backspace"); + PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "0"); + PaymentScreen.check.selectedPaymentlineHas("Cash", "0.00"); + PaymentScreen.do.clickPaymentlineDelButton("Cash", "0", true); + PaymentScreen.check.emptyPaymentlines("52.8"); + + // Pay with bank, the selected line should have full amount + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(true); + // remove the line using the delete button + PaymentScreen.do.clickPaymentlineDelButton("Bank", "52.8"); + + // Use +10 and +50 to increment the amount of the paymentline + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.pressNumpad("+10"); + PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "10"); + PaymentScreen.check.remainingIs("42.8"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(false); + PaymentScreen.do.pressNumpad("+50"); + PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "60"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("7.2"); + PaymentScreen.check.validateButtonIsHighlighted(true); + PaymentScreen.do.clickPaymentlineDelButton("Cash", "60.0"); + + // Multiple paymentlines + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.pressNumpad("1"); + PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "1"); + PaymentScreen.check.remainingIs("51.8"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(false); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.fillPaymentLineAmountMobile("Bank", "5"); + PaymentScreen.do.pressNumpad("5"); + PaymentScreen.check.remainingIs("46.8"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(false); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(true); -ProductScreen.exec.addOrderline("Letter Tray", "10"); -ProductScreen.check.selectedOrderlineHas("Letter Tray", "10.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.check.emptyPaymentlines("52.8"); + return getSteps(); + } + }); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.enterPaymentLineAmount("Cash", "11"); -PaymentScreen.check.selectedPaymentlineHas("Cash", "11.00"); -PaymentScreen.check.remainingIs("41.8"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(false); -// remove the selected paymentline with multiple backspace presses -PaymentScreen.do.pressNumpad("Backspace Backspace"); -PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "0"); -PaymentScreen.check.selectedPaymentlineHas("Cash", "0.00"); -PaymentScreen.do.clickPaymentlineDelButton("Cash", "0", true); -PaymentScreen.check.emptyPaymentlines("52.8"); - -// Pay with bank, the selected line should have full amount -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(true); -// remove the line using the delete button -PaymentScreen.do.clickPaymentlineDelButton("Bank", "52.8"); - -// Use +10 and +50 to increment the amount of the paymentline -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.pressNumpad("+10"); -PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "10"); -PaymentScreen.check.remainingIs("42.8"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(false); -PaymentScreen.do.pressNumpad("+50"); -PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "60"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("7.2"); -PaymentScreen.check.validateButtonIsHighlighted(true); -PaymentScreen.do.clickPaymentlineDelButton("Cash", "60.0"); - -// Multiple paymentlines -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.pressNumpad("1"); -PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "1"); -PaymentScreen.check.remainingIs("51.8"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(false); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.fillPaymentLineAmountMobile("Bank", "5"); -PaymentScreen.do.pressNumpad("5"); -PaymentScreen.check.remainingIs("46.8"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(false); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(true); + +registry + .category("web_tour.tours") + .add("PaymentScreenTour2", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Letter Tray", "1", "10"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.enterPaymentLineAmount("Bank", "1000"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + return getSteps(); + } + }); registry .category("web_tour.tours") - .add("PaymentScreenTour", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Letter Tray", "1", "10"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.enterPaymentLineAmount("Bank", "1000"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); - + .add("PaymentScreenRoundingUp", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Product Test", "1"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("2.00"); + PaymentScreen.do.clickPaymentMethod("Cash"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + + ProductScreen.exec.addOrderline("Product Test", "-1"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("-2.00"); + PaymentScreen.do.clickPaymentMethod("Cash"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + return getSteps(); + } + }); + registry .category("web_tour.tours") - .add("PaymentScreenTour2", { test: true, url: "/pos/ui", steps: getSteps() }); + .add("PaymentScreenRoundingDown", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Product Test", "1"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("1.95"); + PaymentScreen.do.clickPaymentMethod("Cash"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + + ProductScreen.exec.addOrderline("Product Test", "-1"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("-1.95"); + PaymentScreen.do.clickPaymentMethod("Cash"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); -startSteps(); - -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Product Test", "1"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("2.00"); -PaymentScreen.do.clickPaymentMethod("Cash"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); - -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); - -ProductScreen.exec.addOrderline("Product Test", "-1"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("-2.00"); -PaymentScreen.do.clickPaymentMethod("Cash"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); + return getSteps(); + } + }); + registry .category("web_tour.tours") - .add("PaymentScreenRoundingUp", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Product Test", "1"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("1.95"); -PaymentScreen.do.clickPaymentMethod("Cash"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); - -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); - -ProductScreen.exec.addOrderline("Product Test", "-1"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("-1.95"); -PaymentScreen.do.clickPaymentMethod("Cash"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); + .add("PaymentScreenRoundingHalfUp", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Product Test 1.2", "1"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("1.00"); + PaymentScreen.do.clickPaymentMethod("Cash"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + + ProductScreen.exec.addOrderline("Product Test 1.25", "1"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("1.5"); + PaymentScreen.do.clickPaymentMethod("Cash"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + + ProductScreen.exec.addOrderline("Product Test 1.4", "1"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("1.5"); + PaymentScreen.do.clickPaymentMethod("Cash"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + + ProductScreen.exec.addOrderline("Product Test 1.2", "1"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("1.00"); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.pressNumpad("2"); + PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "2"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("1.0"); + return getSteps(); + } + }); + registry .category("web_tour.tours") - .add("PaymentScreenRoundingDown", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Product Test 1.2", "1"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("1.00"); -PaymentScreen.do.clickPaymentMethod("Cash"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); - -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); - -ProductScreen.exec.addOrderline("Product Test 1.25", "1"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("1.5"); -PaymentScreen.do.clickPaymentMethod("Cash"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); - -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); - -ProductScreen.exec.addOrderline("Product Test 1.4", "1"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("1.5"); -PaymentScreen.do.clickPaymentMethod("Cash"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); - -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); - -ProductScreen.exec.addOrderline("Product Test 1.2", "1"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("1.00"); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.pressNumpad("2"); -PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "2"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("1.0"); - + .add("PaymentScreenRoundingHalfUpCashAndBank", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Product Test 40", "1"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Nicole Ford"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("40.00"); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.pressNumpad("3 8"); + PaymentScreen.do.fillPaymentLineAmountMobile("Bank", "38"); + PaymentScreen.check.remainingIs("2.0"); + PaymentScreen.do.clickPaymentMethod("Cash"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + + PaymentScreen.do.clickInvoiceButton(); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.receiptIsThere(); + ReceiptScreen.do.clickNextOrder(); + + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Product Test 41", "1"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Nicole Ford"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("41.00"); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.pressNumpad("3 8"); + PaymentScreen.do.fillPaymentLineAmountMobile("Bank", "38"); + PaymentScreen.check.remainingIs("3.0"); + PaymentScreen.do.clickPaymentMethod("Cash"); + + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + + PaymentScreen.do.clickInvoiceButton(); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.receiptIsThere(); + return getSteps(); + } + }); + registry .category("web_tour.tours") - .add("PaymentScreenRoundingHalfUp", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Product Test 40", "1"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Nicole Ford"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("40.00"); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.pressNumpad("3 8"); -PaymentScreen.do.fillPaymentLineAmountMobile("Bank", "38"); -PaymentScreen.check.remainingIs("2.0"); -PaymentScreen.do.clickPaymentMethod("Cash"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); - -PaymentScreen.do.clickInvoiceButton(); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.receiptIsThere(); -ReceiptScreen.do.clickNextOrder(); - -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Product Test 41", "1"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Nicole Ford"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("41.00"); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.pressNumpad("3 8"); -PaymentScreen.do.fillPaymentLineAmountMobile("Bank", "38"); -PaymentScreen.check.remainingIs("3.0"); -PaymentScreen.do.clickPaymentMethod("Cash"); - -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); - -PaymentScreen.do.clickInvoiceButton(); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.receiptIsThere(); - -registry.category("web_tour.tours").add("PaymentScreenRoundingHalfUpCashAndBank", { - test: true, - url: "/pos/ui", - steps: getSteps(), -}); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Product Test", "1"); -ProductScreen.do.clickPayButton(); - -PaymentScreen.check.totalIs("1.95"); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.enterPaymentLineAmount("Cash", "5"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("3.05"); -PaymentScreen.check.totalDueIs("1.95"); - -registry - .category("web_tour.tours") - .add("PaymentScreenTotalDueWithOverPayment", { test: true, url: "/pos/ui", steps: getSteps() }); + .add("PaymentScreenTotalDueWithOverPayment", { + test: true, + url: "/pos/ui", + steps: () => { + + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Product Test", "1"); + ProductScreen.do.clickPayButton(); + + PaymentScreen.check.totalIs("1.95"); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.enterPaymentLineAmount("Cash", "5"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("3.05"); + PaymentScreen.check.totalDueIs("1.95"); + return getSteps() + } + }); diff --git a/addons/point_of_sale/static/tests/tours/ProductConfigurator.tour.js b/addons/point_of_sale/static/tests/tours/ProductConfigurator.tour.js index 6c34a4ae19b..2401110f0a1 100644 --- a/addons/point_of_sale/static/tests/tours/ProductConfigurator.tour.js +++ b/addons/point_of_sale/static/tests/tours/ProductConfigurator.tour.js @@ -5,73 +5,80 @@ import { ProductConfigurator } from "@point_of_sale/../tests/tours/helpers/Produ import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -// signal to start generating steps -// when finished, steps can be taken from getSteps -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -// Go by default to home category -ProductScreen.do.clickHomeCategory(); - -// Click on Configurable Chair product -ProductScreen.do.clickDisplayedProduct("Configurable Chair"); -ProductConfigurator.check.isShown(); - -// Cancel configuration, not product should be in order -ProductConfigurator.do.cancelAttributes(); -ProductScreen.check.orderIsEmpty(); - -// Click on Configurable Chair product -ProductScreen.do.clickDisplayedProduct("Configurable Chair"); -ProductConfigurator.check.isShown(); - -// Pick Color -ProductConfigurator.do.pickColor("Red"); - -// Pick Radio -ProductConfigurator.do.pickSelect("Metal"); - -// Pick Select -ProductConfigurator.do.pickRadio("Other"); - -// Fill in custom attribute -ProductConfigurator.do.fillCustomAttribute("Custom Fabric"); - -// Confirm configuration -ProductConfigurator.do.confirmAttributes(); - -// Check that the product has been added to the order with correct attributes and price -ProductScreen.check.selectedOrderlineHas( - "Configurable Chair (Red, Metal, Other: Custom Fabric)", - "1.0", - "11.0" -); - -// Orderlines with the same attributes should be merged -ProductScreen.do.clickHomeCategory(); -ProductScreen.do.clickDisplayedProduct("Configurable Chair"); -ProductConfigurator.do.pickColor("Red"); -ProductConfigurator.do.pickSelect("Metal"); -ProductConfigurator.do.pickRadio("Other"); -ProductConfigurator.do.fillCustomAttribute("Custom Fabric"); -ProductConfigurator.do.confirmAttributes(); -ProductScreen.check.selectedOrderlineHas( - "Configurable Chair (Red, Metal, Other: Custom Fabric)", - "2.0", - "22.0" -); - -// Orderlines with different attributes shouldn't be merged -ProductScreen.do.clickHomeCategory(); -ProductScreen.do.clickDisplayedProduct("Configurable Chair"); -ProductConfigurator.do.pickColor("Blue"); -ProductConfigurator.do.pickSelect("Metal"); -ProductConfigurator.do.pickRadio("Leather"); -ProductConfigurator.do.confirmAttributes(); -ProductScreen.check.selectedOrderlineHas( - "Configurable Chair (Blue, Metal, Leather)", - "1.0", - "10.0" -); - -registry.category("web_tour.tours").add("ProductConfiguratorTour", { test: true, url: "/pos/ui", steps: getSteps() }); +registry + .category("web_tour.tours") + .add("ProductConfiguratorTour", { + test: true, + url: "/pos/ui", + steps: () => { + // signal to start generating steps + // when finished, steps can be taken from getSteps + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + // Go by default to home category + ProductScreen.do.clickHomeCategory(); + + // Click on Configurable Chair product + ProductScreen.do.clickDisplayedProduct("Configurable Chair"); + ProductConfigurator.check.isShown(); + + // Cancel configuration, not product should be in order + ProductConfigurator.do.cancelAttributes(); + ProductScreen.check.orderIsEmpty(); + + // Click on Configurable Chair product + ProductScreen.do.clickDisplayedProduct("Configurable Chair"); + ProductConfigurator.check.isShown(); + + // Pick Color + ProductConfigurator.do.pickColor("Red"); + + // Pick Radio + ProductConfigurator.do.pickSelect("Metal"); + + // Pick Select + ProductConfigurator.do.pickRadio("Other"); + + // Fill in custom attribute + ProductConfigurator.do.fillCustomAttribute("Custom Fabric"); + + // Confirm configuration + ProductConfigurator.do.confirmAttributes(); + + // Check that the product has been added to the order with correct attributes and price + ProductScreen.check.selectedOrderlineHas( + "Configurable Chair (Red, Metal, Other: Custom Fabric)", + "1.0", + "11.0" + ); + + // Orderlines with the same attributes should be merged + ProductScreen.do.clickHomeCategory(); + ProductScreen.do.clickDisplayedProduct("Configurable Chair"); + ProductConfigurator.do.pickColor("Red"); + ProductConfigurator.do.pickSelect("Metal"); + ProductConfigurator.do.pickRadio("Other"); + ProductConfigurator.do.fillCustomAttribute("Custom Fabric"); + ProductConfigurator.do.confirmAttributes(); + ProductScreen.check.selectedOrderlineHas( + "Configurable Chair (Red, Metal, Other: Custom Fabric)", + "2.0", + "22.0" + ); + + // Orderlines with different attributes shouldn't be merged + ProductScreen.do.clickHomeCategory(); + ProductScreen.do.clickDisplayedProduct("Configurable Chair"); + ProductConfigurator.do.pickColor("Blue"); + ProductConfigurator.do.pickSelect("Metal"); + ProductConfigurator.do.pickRadio("Leather"); + ProductConfigurator.do.confirmAttributes(); + ProductScreen.check.selectedOrderlineHas( + "Configurable Chair (Blue, Metal, Leather)", + "1.0", + "10.0" + ); + return getSteps(); + } + }); diff --git a/addons/point_of_sale/static/tests/tours/ProductScreen.tour.js b/addons/point_of_sale/static/tests/tours/ProductScreen.tour.js index 8120e754224..98e63ae639e 100644 --- a/addons/point_of_sale/static/tests/tours/ProductScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/ProductScreen.tour.js @@ -7,156 +7,171 @@ import { TextAreaPopup } from "@point_of_sale/../tests/tours/helpers/TextAreaPop import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -// signal to start generating steps -// when finished, steps can be taken from getSteps -startSteps(); +registry.category("web_tour.tours").add("ProductScreenTour", { + test: true, + url: "/pos/ui", + steps: () => { + // signal to start generating steps + // when finished, steps can be taken from getSteps + startSteps(); + + // Go by default to home category + ProductScreen.do.clickHomeCategory(); + + // Clicking product multiple times should increment quantity + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "1.0", "5.10"); + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "2.0", "10.20"); + + // Clicking product should add new orderline and select the orderline + // If orderline exists, increment the quantity + ProductScreen.do.clickDisplayedProduct("Letter Tray"); + ProductScreen.check.selectedOrderlineHas("Letter Tray", "1.0", "5.28"); + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "3.0", "15.30"); + + // Check effects of clicking numpad buttons + ProductScreen.do.clickOrderline("Letter Tray", "1"); + ProductScreen.check.selectedOrderlineHas("Letter Tray", "1.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Letter Tray", "0.0", "0.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "3", "15.30"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "0.0", "0.0"); + ProductScreen.do.pressNumpad("1"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "1.0", "5.1"); + ProductScreen.do.pressNumpad("2"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "12.0", "61.2"); + ProductScreen.do.pressNumpad("3"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "123.0", "627.3"); + ProductScreen.do.pressNumpad(". 5"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "123.5", "629.85"); + ProductScreen.do.pressNumpad("Price"); + ProductScreen.check.modeIsActive("Price"); + ProductScreen.do.pressNumpad("1"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "123.5", "123.5"); + ProductScreen.do.pressNumpad("1 ."); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "123.5", "1,358.5"); + ProductScreen.do.pressNumpad("Disc"); + ProductScreen.check.modeIsActive("Disc"); + ProductScreen.do.pressNumpad("5 ."); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "123.5", "1,290.58"); + ProductScreen.do.pressNumpad("Qty"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.orderIsEmpty(); + + // Check different subcategories + ProductScreen.do.clickSubcategory("Desks"); + ProductScreen.check.productIsDisplayed("Desk Pad"); + ProductScreen.do.clickHomeCategory(); + ProductScreen.do.clickSubcategory("Miscellaneous"); + ProductScreen.check.productIsDisplayed("Whiteboard Pen"); + ProductScreen.do.clickHomeCategory(); + ProductScreen.do.clickSubcategory("Chairs"); + ProductScreen.check.productIsDisplayed("Letter Tray"); + ProductScreen.do.clickHomeCategory(); + + // Add two orderlines and update quantity + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.do.clickDisplayedProduct("Wall Shelf Unit"); + ProductScreen.do.clickOrderline("Whiteboard Pen", "1.0"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.0"); + ProductScreen.do.pressNumpad("2"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "2.0"); + ProductScreen.do.clickOrderline("Wall Shelf Unit", "1.0"); + ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "1.0"); + ProductScreen.do.pressNumpad("2"); + ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "2.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "0.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "2.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "0.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.orderIsEmpty(); + + // Add multiple orderlines then delete each of them until empty + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.do.clickDisplayedProduct("Wall Shelf Unit"); + ProductScreen.do.clickDisplayedProduct("Small Shelf"); + ProductScreen.do.clickDisplayedProduct("Magnetic Board"); + ProductScreen.do.clickDisplayedProduct("Monitor Stand"); + ProductScreen.do.clickOrderline("Whiteboard Pen", "1.0"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "0.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Monitor Stand", "1.0"); + ProductScreen.do.clickOrderline("Wall Shelf Unit", "1.0"); + ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "1.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "0.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Monitor Stand", "1.0"); + ProductScreen.do.clickOrderline("Small Shelf", "1.0"); + ProductScreen.check.selectedOrderlineHas("Small Shelf", "1.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Small Shelf", "0.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Monitor Stand", "1.0"); + ProductScreen.do.clickOrderline("Magnetic Board", "1.0"); + ProductScreen.check.selectedOrderlineHas("Magnetic Board", "1.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Magnetic Board", "0.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Monitor Stand", "1.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Monitor Stand", "0.0"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.orderIsEmpty(); + + // Test OrderlineCustomerNoteButton + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "1.0"); + ProductScreen.do.clickOrderlineCustomerNoteButton(); + TextAreaPopup.check.isShown(); + TextAreaPopup.do.inputText("Test customer note"); + TextAreaPopup.do.clickConfirm(); + ProductScreen.check.orderlineHasCustomerNote("Desk Organizer", "1", "Test customer note"); + return getSteps(); + } +}); -// Go by default to home category -ProductScreen.do.clickHomeCategory(); +registry.category("web_tour.tours").add("FiscalPositionNoTax", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.clickHomeCategory(); + ProductScreen.do.clickDisplayedProduct('Test Product'); + ProductScreen.check.totalAmountIs('100.00'); + ProductScreen.do.changeFiscalPosition('No Tax'); + ProductScreen.check.noDiscountApplied("100.00"); + ProductScreen.check.totalAmountIs('86.96'); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod('Bank'); + PaymentScreen.check.remainingIs('0.00'); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); + ReceiptScreen.check.noOrderlineContainsDiscount(); + return getSteps() + } +}); -// Clicking product multiple times should increment quantity -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "1.0", "5.10"); -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "2.0", "10.20"); - -// Clicking product should add new orderline and select the orderline -// If orderline exists, increment the quantity -ProductScreen.do.clickDisplayedProduct("Letter Tray"); -ProductScreen.check.selectedOrderlineHas("Letter Tray", "1.0", "5.28"); -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "3.0", "15.30"); - -// Check effects of clicking numpad buttons -ProductScreen.do.clickOrderline("Letter Tray", "1"); -ProductScreen.check.selectedOrderlineHas("Letter Tray", "1.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Letter Tray", "0.0", "0.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "3", "15.30"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "0.0", "0.0"); -ProductScreen.do.pressNumpad("1"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "1.0", "5.1"); -ProductScreen.do.pressNumpad("2"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "12.0", "61.2"); -ProductScreen.do.pressNumpad("3"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "123.0", "627.3"); -ProductScreen.do.pressNumpad(". 5"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "123.5", "629.85"); -ProductScreen.do.pressNumpad("Price"); -ProductScreen.check.modeIsActive("Price"); -ProductScreen.do.pressNumpad("1"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "123.5", "123.5"); -ProductScreen.do.pressNumpad("1 ."); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "123.5", "1,358.5"); -ProductScreen.do.pressNumpad("Disc"); -ProductScreen.check.modeIsActive("Disc"); -ProductScreen.do.pressNumpad("5 ."); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "123.5", "1,290.58"); -ProductScreen.do.pressNumpad("Qty"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.orderIsEmpty(); - -// Check different subcategories -ProductScreen.do.clickSubcategory("Desks"); -ProductScreen.check.productIsDisplayed("Desk Pad"); -ProductScreen.do.clickHomeCategory(); -ProductScreen.do.clickSubcategory("Miscellaneous"); -ProductScreen.check.productIsDisplayed("Whiteboard Pen"); -ProductScreen.do.clickHomeCategory(); -ProductScreen.do.clickSubcategory("Chairs"); -ProductScreen.check.productIsDisplayed("Letter Tray"); -ProductScreen.do.clickHomeCategory(); - -// Add two orderlines and update quantity -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.do.clickDisplayedProduct("Wall Shelf Unit"); -ProductScreen.do.clickOrderline("Whiteboard Pen", "1.0"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.0"); -ProductScreen.do.pressNumpad("2"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "2.0"); -ProductScreen.do.clickOrderline("Wall Shelf Unit", "1.0"); -ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "1.0"); -ProductScreen.do.pressNumpad("2"); -ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "2.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "0.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "2.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "0.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.orderIsEmpty(); - -// Add multiple orderlines then delete each of them until empty -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.do.clickDisplayedProduct("Wall Shelf Unit"); -ProductScreen.do.clickDisplayedProduct("Small Shelf"); -ProductScreen.do.clickDisplayedProduct("Magnetic Board"); -ProductScreen.do.clickDisplayedProduct("Monitor Stand"); -ProductScreen.do.clickOrderline("Whiteboard Pen", "1.0"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "0.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Monitor Stand", "1.0"); -ProductScreen.do.clickOrderline("Wall Shelf Unit", "1.0"); -ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "1.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "0.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Monitor Stand", "1.0"); -ProductScreen.do.clickOrderline("Small Shelf", "1.0"); -ProductScreen.check.selectedOrderlineHas("Small Shelf", "1.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Small Shelf", "0.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Monitor Stand", "1.0"); -ProductScreen.do.clickOrderline("Magnetic Board", "1.0"); -ProductScreen.check.selectedOrderlineHas("Magnetic Board", "1.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Magnetic Board", "0.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Monitor Stand", "1.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Monitor Stand", "0.0"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.orderIsEmpty(); - -// Test OrderlineCustomerNoteButton -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "1.0"); -ProductScreen.do.clickOrderlineCustomerNoteButton(); -TextAreaPopup.check.isShown(); -TextAreaPopup.do.inputText("Test customer note"); -TextAreaPopup.do.clickConfirm(); -ProductScreen.check.orderlineHasCustomerNote("Desk Organizer", "1", "Test customer note"); - -registry.category("web_tour.tours").add("ProductScreenTour", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.clickHomeCategory(); -ProductScreen.do.clickDisplayedProduct('Test Product'); -ProductScreen.check.totalAmountIs('100.00'); -ProductScreen.do.changeFiscalPosition('No Tax'); -ProductScreen.check.noDiscountApplied("100.00"); -ProductScreen.check.totalAmountIs('86.96'); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod('Bank'); -PaymentScreen.check.remainingIs('0.00'); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.isShown(); -ReceiptScreen.check.noOrderlineContainsDiscount(); - -registry.category("web_tour.tours").add("FiscalPositionNoTax", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.enterOpeningAmount('90'); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.check.checkSecondCashClosingDetailsLineAmount('10.00', '-'); - -registry.category("web_tour.tours").add("CashClosingDetails", { test: true, url: "/pos/ui", steps: getSteps() }); +registry.category("web_tour.tours").add("CashClosingDetails", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.enterOpeningAmount('90'); + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.check.checkSecondCashClosingDetailsLineAmount('10.00', '-'); + return getSteps() + } +}); diff --git a/addons/point_of_sale/static/tests/tours/ReceiptScreen.tour.js b/addons/point_of_sale/static/tests/tours/ReceiptScreen.tour.js index 2d400b5d6b4..6a9d8e5d070 100644 --- a/addons/point_of_sale/static/tests/tours/ReceiptScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/ReceiptScreen.tour.js @@ -9,105 +9,119 @@ import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/util import { registry } from "@web/core/registry"; import { nbsp } from "@web/core/utils/strings"; -startSteps(); - -// press close button in receipt screen -ProductScreen.exec.addOrderline("Letter Tray", "10", "5"); -ProductScreen.check.selectedOrderlineHas("Letter Tray", "10"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.check.validateButtonIsHighlighted(true); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.receiptIsThere(); -// letter tray has 10% tax (search SRC) -ReceiptScreen.check.totalAmountContains("55.0"); -ReceiptScreen.do.clickNextOrder(); - -// send email in receipt screen -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Desk Pad", "6", "5", "30.0"); -ProductScreen.exec.addOrderline("Whiteboard Pen", "6", "6", "36.0"); -ProductScreen.exec.addOrderline("Monitor Stand", "6", "1", "6.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.enterPaymentLineAmount("Cash", "70"); -PaymentScreen.check.remainingIs("2.0"); -PaymentScreen.do.pressNumpad("0"); -PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "700"); -PaymentScreen.check.remainingIs("0.00"); -PaymentScreen.check.changeIs("628.0"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.receiptIsThere(); -ReceiptScreen.check.totalAmountContains("72.0"); -ReceiptScreen.do.setEmail("test@receiptscreen.com"); -ReceiptScreen.do.clickSend(); -ReceiptScreen.check.emailIsSuccessful(); -ReceiptScreen.do.clickNextOrder(); - -// order with tip -// check if tip amount is displayed -ProductScreen.exec.addOrderline("Desk Pad", "6", "5"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickTipButton(); -NumberPopup.do.enterValue("1"); -NumberPopup.check.inputShownIs("1"); -NumberPopup.do.clickConfirm(); -PaymentScreen.check.emptyPaymentlines("31.0"); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.receiptIsThere(); -ReceiptScreen.check.totalAmountContains(`$${nbsp}30.00 + $${nbsp}1.00 tip`); -ReceiptScreen.do.clickNextOrder(); - -// Test customer note in receipt -ProductScreen.exec.addOrderline("Desk Pad", "1", "5"); -ProductScreen.exec.addCustomerNote("Test customer note"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.customerNoteIsThere("Test customer note"); - registry .category("web_tour.tours") - .add("ReceiptScreenTour", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Test Product", "1"); -ProductScreen.do.selectPriceList("special_pricelist"); -ProductScreen.check.discountOriginalPriceIs("7.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.discountAmountIs("0.7"); - -registry.category("web_tour.tours").add("ReceiptScreenDiscountWithPricelistTour", { - test: true, - url: "/pos/ui", - steps: getSteps(), + .add("ReceiptScreenTour", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + // press close button in receipt screen + ProductScreen.exec.addOrderline("Letter Tray", "10", "5"); + ProductScreen.check.selectedOrderlineHas("Letter Tray", "10"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.check.validateButtonIsHighlighted(true); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.receiptIsThere(); + // letter tray has 10% tax (search SRC) + ReceiptScreen.check.totalAmountContains("55.0"); + ReceiptScreen.do.clickNextOrder(); + + // send email in receipt screen + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Desk Pad", "6", "5", "30.0"); + ProductScreen.exec.addOrderline("Whiteboard Pen", "6", "6", "36.0"); + ProductScreen.exec.addOrderline("Monitor Stand", "6", "1", "6.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.enterPaymentLineAmount("Cash", "70"); + PaymentScreen.check.remainingIs("2.0"); + PaymentScreen.do.pressNumpad("0"); + PaymentScreen.do.fillPaymentLineAmountMobile("Cash", "700"); + PaymentScreen.check.remainingIs("0.00"); + PaymentScreen.check.changeIs("628.0"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.receiptIsThere(); + ReceiptScreen.check.totalAmountContains("72.0"); + ReceiptScreen.do.setEmail("test@receiptscreen.com"); + ReceiptScreen.do.clickSend(); + ReceiptScreen.check.emailIsSuccessful(); + ReceiptScreen.do.clickNextOrder(); + + // order with tip + // check if tip amount is displayed + ProductScreen.exec.addOrderline("Desk Pad", "6", "5"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickTipButton(); + NumberPopup.do.enterValue("1"); + NumberPopup.check.inputShownIs("1"); + NumberPopup.do.clickConfirm(); + PaymentScreen.check.emptyPaymentlines("31.0"); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.receiptIsThere(); + ReceiptScreen.check.totalAmountContains(`$${nbsp}30.00 + $${nbsp}1.00 tip`); + ReceiptScreen.do.clickNextOrder(); + + // Test customer note in receipt + ProductScreen.exec.addOrderline("Desk Pad", "1", "5"); + ProductScreen.exec.addCustomerNote("Test customer note"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.customerNoteIsThere("Test customer note"); + return getSteps(); + } }); -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.exec.addOrderline("Desk Pad", "5", "5"); -ProductScreen.check.selectedOrderlineHas("Desk Pad", "5"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.check.validateButtonIsHighlighted(true); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.receiptIsThere(); -ReceiptScreen.do.clickNextOrder(); -ProductScreen.check.isShown(); -// Close the session -Chrome.do.clickMenuButton(); -ProductScreen.do.clickCloseButton(); -ProductScreen.do.closeWithCashAmount("25"); -ProductScreen.check.cashDifferenceIs("0.00"); -ProductScreen.do.clickCloseSession(); -ProductScreen.check.lastClosingCashIs("25.00"); registry .category("web_tour.tours") - .add("OrderPaidInCash", { test: true, url: "/pos/ui", steps: getSteps() }); + .add("ReceiptScreenDiscountWithPricelistTour", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Test Product", "1"); + ProductScreen.do.selectPriceList("special_pricelist"); + ProductScreen.check.discountOriginalPriceIs("7.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.discountAmountIs("0.7"); + return getSteps(); + }, + }); + +registry + .category("web_tour.tours") + .add("OrderPaidInCash", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.exec.addOrderline("Desk Pad", "5", "5"); + ProductScreen.check.selectedOrderlineHas("Desk Pad", "5"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.check.validateButtonIsHighlighted(true); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.receiptIsThere(); + ReceiptScreen.do.clickNextOrder(); + ProductScreen.check.isShown(); + // Close the session + Chrome.do.clickMenuButton(); + ProductScreen.do.clickCloseButton(); + ProductScreen.do.closeWithCashAmount("25"); + ProductScreen.check.cashDifferenceIs("0.00"); + ProductScreen.do.clickCloseSession(); + ProductScreen.check.lastClosingCashIs("25.00"); + return getSteps(); + } + }); diff --git a/addons/point_of_sale/static/tests/tours/TicketScreen.tour.js b/addons/point_of_sale/static/tests/tours/TicketScreen.tour.js index 8f24324220b..9f9e8260dae 100644 --- a/addons/point_of_sale/static/tests/tours/TicketScreen.tour.js +++ b/addons/point_of_sale/static/tests/tours/TicketScreen.tour.js @@ -10,159 +10,166 @@ import { Chrome } from "@point_of_sale/../tests/tours/helpers/ChromeTourMethods" import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); +registry + .category("web_tour.tours") + .add("TicketScreenTour", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + ProductScreen.exec.addOrderline("Desk Pad", "1", "3"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.deleteOrder("-0002"); + Chrome.do.confirmPopup(); + TicketScreen.do.clickDiscard(); + ProductScreen.check.orderIsEmpty(); + ProductScreen.exec.addOrderline("Desk Pad", "1", "2"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.deleteOrder("-0001"); + Chrome.do.confirmPopup(); + TicketScreen.do.clickDiscard(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.nthRowContains(2, "-0003"); + TicketScreen.do.clickDiscard(); + ProductScreen.exec.addOrderline("Desk Pad", "1", "2"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Nicole Ford"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.nthRowContains(2, "Nicole Ford"); + TicketScreen.do.clickNewTicket(); + ProductScreen.exec.addOrderline("Desk Pad", "1", "3"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Brandon Freeman"); + ProductScreen.do.clickPayButton(); + PaymentScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.nthRowContains(3, "Brandon Freeman"); + TicketScreen.do.clickNewTicket(); + ProductScreen.exec.addOrderline("Desk Pad", "2", "4"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.nthRowContains(4, "Receipt"); + TicketScreen.do.selectFilter("Receipt"); + TicketScreen.check.nthRowContains(2, "Receipt"); + TicketScreen.do.selectFilter("Payment"); + TicketScreen.check.nthRowContains(2, "Payment"); + TicketScreen.do.selectFilter("Ongoing"); + TicketScreen.check.nthRowContains(2, "Ongoing"); + TicketScreen.do.selectFilter("All active orders"); + TicketScreen.check.nthRowContains(4, "Receipt"); + TicketScreen.do.search("Customer", "Nicole"); + TicketScreen.check.nthRowContains(2, "Nicole"); + TicketScreen.do.search("Customer", "Brandon"); + TicketScreen.check.nthRowContains(2, "Brandon"); + TicketScreen.do.search("Receipt Number", "-0005"); + TicketScreen.check.nthRowContains(2, "Receipt"); + // Close the TicketScreen to see the current order which is in ReceiptScreen. + // This is just to remove the search string in the search bar. + TicketScreen.do.clickDiscard(); + ReceiptScreen.check.isShown(); + // Open again the TicketScreen to check the Paid filter. + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectFilter("Paid"); + TicketScreen.check.nthRowContains(2, "-0005"); + // Pay the order that was in PaymentScreen. + TicketScreen.do.selectFilter("Payment"); + TicketScreen.do.selectOrder("-0004"); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); + ReceiptScreen.do.clickNextOrder(); + ProductScreen.check.isShown(); + // Check that the Paid filter will show the 2 synced orders. + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectFilter("Paid"); + TicketScreen.check.nthRowContains(3, "Brandon Freeman"); + TicketScreen.check.nthRowContains(2, "-0005"); + // Invoice order + TicketScreen.do.selectOrder("-0005"); + TicketScreen.check.orderWidgetIsNotEmpty(); + TicketScreen.do.clickControlButton("Invoice"); + Chrome.do.confirmPopup(); + PartnerListScreen.check.isShown(); + PartnerListScreen.do.clickPartner("Colleen Diaz"); + TicketScreen.check.partnerIs("Colleen Diaz"); + // Reprint receipt + TicketScreen.do.clickControlButton("Print Receipt"); + ReceiptScreen.check.isShown(); + ReceiptScreen.do.clickBack(); + // When going back, the ticket screen should be in its previous state. + TicketScreen.check.filterIs("Paid"); + + // Test refund // + TicketScreen.do.clickDiscard(); + ProductScreen.check.isShown(); + ProductScreen.check.orderIsEmpty(); + ProductScreen.do.clickRefund(); + // Filter should be automatically 'Paid'. + TicketScreen.check.filterIs("Paid"); + TicketScreen.do.selectOrder("-0005"); + TicketScreen.check.partnerIs("Colleen Diaz"); + TicketScreen.do.clickOrderline("Desk Pad"); + TicketScreen.do.pressNumpad("3"); + // Error should show because 2 is more than the number + // that can be refunded. + ErrorPopup.do.clickConfirm(); + TicketScreen.do.clickDiscard(); + ProductScreen.do.goBackToMainScreen(); + ProductScreen.check.isShown(); + ProductScreen.check.orderIsEmpty(); + ProductScreen.do.clickRefund(); + TicketScreen.do.selectOrder("-0005"); + TicketScreen.do.clickOrderline("Desk Pad"); + TicketScreen.do.pressNumpad("1"); + TicketScreen.check.toRefundTextContains("To Refund: 1.00"); + TicketScreen.do.confirmRefund(); + ProductScreen.do.goBackToMainScreen(); + ProductScreen.check.isShown(); + ProductScreen.check.selectedOrderlineHas("Desk Pad", "-1.00"); + // Try changing the refund line to positive number. + // Error popup should show. + ProductScreen.do.pressNumpad("2"); + ErrorPopup.do.clickConfirm(); + // Change the refund line quantity to -3 -- not allowed + // so error popup. + ProductScreen.do.pressNumpad("+/- 3"); + ErrorPopup.do.clickConfirm(); + // Change the refund line quantity to -2 -- allowed. + ProductScreen.do.pressNumpad("+/- 2"); + ProductScreen.check.selectedOrderlineHas("Desk Pad", "-2.00"); + // Check if the amount being refunded changed to 2. + ProductScreen.do.clickRefund(); + TicketScreen.do.selectOrder("-0005"); + TicketScreen.check.toRefundTextContains("Refunding 2.00"); + TicketScreen.do.clickDiscard(); + ProductScreen.do.goBackToMainScreen(); + // Pay the refund order. + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); + ReceiptScreen.do.clickNextOrder(); + // Check refunded quantity. + ProductScreen.do.clickRefund(); + TicketScreen.do.selectOrder("-0005"); + TicketScreen.check.refundedNoteContains("2.00 Refunded"); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); -ProductScreen.exec.addOrderline("Desk Pad", "1", "3"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.deleteOrder("-0002"); -Chrome.do.confirmPopup(); -TicketScreen.do.clickDiscard(); -ProductScreen.check.orderIsEmpty(); -ProductScreen.exec.addOrderline("Desk Pad", "1", "2"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.deleteOrder("-0001"); -Chrome.do.confirmPopup(); -TicketScreen.do.clickDiscard(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.nthRowContains(2, "-0003"); -TicketScreen.do.clickDiscard(); -ProductScreen.exec.addOrderline("Desk Pad", "1", "2"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Nicole Ford"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.nthRowContains(2, "Nicole Ford"); -TicketScreen.do.clickNewTicket(); -ProductScreen.exec.addOrderline("Desk Pad", "1", "3"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Brandon Freeman"); -ProductScreen.do.clickPayButton(); -PaymentScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.nthRowContains(3, "Brandon Freeman"); -TicketScreen.do.clickNewTicket(); -ProductScreen.exec.addOrderline("Desk Pad", "2", "4"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.nthRowContains(4, "Receipt"); -TicketScreen.do.selectFilter("Receipt"); -TicketScreen.check.nthRowContains(2, "Receipt"); -TicketScreen.do.selectFilter("Payment"); -TicketScreen.check.nthRowContains(2, "Payment"); -TicketScreen.do.selectFilter("Ongoing"); -TicketScreen.check.nthRowContains(2, "Ongoing"); -TicketScreen.do.selectFilter("All active orders"); -TicketScreen.check.nthRowContains(4, "Receipt"); -TicketScreen.do.search("Customer", "Nicole"); -TicketScreen.check.nthRowContains(2, "Nicole"); -TicketScreen.do.search("Customer", "Brandon"); -TicketScreen.check.nthRowContains(2, "Brandon"); -TicketScreen.do.search("Receipt Number", "-0005"); -TicketScreen.check.nthRowContains(2, "Receipt"); -// Close the TicketScreen to see the current order which is in ReceiptScreen. -// This is just to remove the search string in the search bar. -TicketScreen.do.clickDiscard(); -ReceiptScreen.check.isShown(); -// Open again the TicketScreen to check the Paid filter. -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.selectFilter("Paid"); -TicketScreen.check.nthRowContains(2, "-0005"); -// Pay the order that was in PaymentScreen. -TicketScreen.do.selectFilter("Payment"); -TicketScreen.do.selectOrder("-0004"); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.isShown(); -ReceiptScreen.do.clickNextOrder(); -ProductScreen.check.isShown(); -// Check that the Paid filter will show the 2 synced orders. -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.selectFilter("Paid"); -TicketScreen.check.nthRowContains(3, "Brandon Freeman"); -TicketScreen.check.nthRowContains(2, "-0005"); -// Invoice order -TicketScreen.do.selectOrder("-0005"); -TicketScreen.check.orderWidgetIsNotEmpty(); -TicketScreen.do.clickControlButton("Invoice"); -Chrome.do.confirmPopup(); -PartnerListScreen.check.isShown(); -PartnerListScreen.do.clickPartner("Colleen Diaz"); -TicketScreen.check.partnerIs("Colleen Diaz"); -// Reprint receipt -TicketScreen.do.clickControlButton("Print Receipt"); -ReceiptScreen.check.isShown(); -ReceiptScreen.do.clickBack(); -// When going back, the ticket screen should be in its previous state. -TicketScreen.check.filterIs("Paid"); - -// Test refund // -TicketScreen.do.clickDiscard(); -ProductScreen.check.isShown(); -ProductScreen.check.orderIsEmpty(); -ProductScreen.do.clickRefund(); -// Filter should be automatically 'Paid'. -TicketScreen.check.filterIs("Paid"); -TicketScreen.do.selectOrder("-0005"); -TicketScreen.check.partnerIs("Colleen Diaz"); -TicketScreen.do.clickOrderline("Desk Pad"); -TicketScreen.do.pressNumpad("3"); -// Error should show because 2 is more than the number -// that can be refunded. -ErrorPopup.do.clickConfirm(); -TicketScreen.do.clickDiscard(); -ProductScreen.do.goBackToMainScreen(); -ProductScreen.check.isShown(); -ProductScreen.check.orderIsEmpty(); -ProductScreen.do.clickRefund(); -TicketScreen.do.selectOrder("-0005"); -TicketScreen.do.clickOrderline("Desk Pad"); -TicketScreen.do.pressNumpad("1"); -TicketScreen.check.toRefundTextContains("To Refund: 1.00"); -TicketScreen.do.confirmRefund(); -ProductScreen.do.goBackToMainScreen(); -ProductScreen.check.isShown(); -ProductScreen.check.selectedOrderlineHas("Desk Pad", "-1.00"); -// Try changing the refund line to positive number. -// Error popup should show. -ProductScreen.do.pressNumpad("2"); -ErrorPopup.do.clickConfirm(); -// Change the refund line quantity to -3 -- not allowed -// so error popup. -ProductScreen.do.pressNumpad("+/- 3"); -ErrorPopup.do.clickConfirm(); -// Change the refund line quantity to -2 -- allowed. -ProductScreen.do.pressNumpad("+/- 2"); -ProductScreen.check.selectedOrderlineHas("Desk Pad", "-2.00"); -// Check if the amount being refunded changed to 2. -ProductScreen.do.clickRefund(); -TicketScreen.do.selectOrder("-0005"); -TicketScreen.check.toRefundTextContains("Refunding 2.00"); -TicketScreen.do.clickDiscard(); -ProductScreen.do.goBackToMainScreen(); -// Pay the refund order. -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.isShown(); -ReceiptScreen.do.clickNextOrder(); -// Check refunded quantity. -ProductScreen.do.clickRefund(); -TicketScreen.do.selectOrder("-0005"); -TicketScreen.check.refundedNoteContains("2.00 Refunded"); - -registry.category("web_tour.tours").add("TicketScreenTour", { test: true, url: "/pos/ui", steps: getSteps() }); + return getSteps(); + } + }); diff --git a/addons/point_of_sale/static/tests/tours/acceptance_tour.js b/addons/point_of_sale/static/tests/tours/acceptance_tour.js index 203d24fc0bd..1dc5449860c 100644 --- a/addons/point_of_sale/static/tests/tours/acceptance_tour.js +++ b/addons/point_of_sale/static/tests/tours/acceptance_tour.js @@ -353,4 +353,4 @@ steps = steps.concat([ }, ]); -registry.category("web_tour.tours").add("pos_basic_order", { test: true, url: "/pos/ui", steps }); +registry.category("web_tour.tours").add("pos_basic_order", { test: true, url: "/pos/ui", steps: () => steps }); diff --git a/addons/point_of_sale/static/tests/tours/pricelist_tour.js b/addons/point_of_sale/static/tests/tours/pricelist_tour.js index e75c98729dd..6a3db0ef8bc 100644 --- a/addons/point_of_sale/static/tests/tours/pricelist_tour.js +++ b/addons/point_of_sale/static/tests/tours/pricelist_tour.js @@ -324,4 +324,8 @@ steps = steps.concat([ }, ]); -registry.category("web_tour.tours").add("pos_pricelist", { test: true, url: "/pos/ui", steps }); +registry.category("web_tour.tours").add("pos_pricelist", { + test: true, + url: "/pos/ui", + steps: () => steps, +}); diff --git a/addons/portal/static/tests/tours/portal.js b/addons/portal/static/tests/tours/portal.js index fa21f437c6d..5a266f9b933 100644 --- a/addons/portal/static/tests/tours/portal.js +++ b/addons/portal/static/tests/tours/portal.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('portal_load_homepage', { test: true, url: '/my', - steps: [ + steps: () => [ { content: "Check portal is loaded", trigger: 'a[href*="/my/account"]:contains("Edit"):first', diff --git a/addons/pos_hr/static/tests/tours/PosHrTour.js b/addons/pos_hr/static/tests/tours/PosHrTour.js index 869c94d729a..0d7e6ab7456 100644 --- a/addons/pos_hr/static/tests/tours/PosHrTour.js +++ b/addons/pos_hr/static/tests/tours/PosHrTour.js @@ -10,81 +10,89 @@ import { SelectionPopup } from "@point_of_sale/../tests/tours/helpers/SelectionP import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); +registry + .category("web_tour.tours") + .add("PosHrTour", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + PosHr.check.loginScreenIsShown(); + PosHr.do.clickLoginButton(); + SelectionPopup.check.isShown(); + SelectionPopup.check.hasSelectionItem("Pos Employee1"); + SelectionPopup.check.hasSelectionItem("Pos Employee2"); + SelectionPopup.check.hasSelectionItem("Mitchell Admin"); + SelectionPopup.do.clickItem("Pos Employee1"); + NumberPopup.check.isShown(); + NumberPopup.do.enterValue("25"); + NumberPopup.check.inputShownIs("••"); + NumberPopup.do.pressNumpad("8 1"); + NumberPopup.do.fillPopupValue("2581"); + NumberPopup.check.inputShownIs("••••"); + NumberPopup.do.clickConfirm(); + ErrorPopup.check.isShown(); + ErrorPopup.do.clickConfirm(); + PosHr.do.clickLoginButton(); + SelectionPopup.do.clickItem("Pos Employee1"); + NumberPopup.check.isShown(); + NumberPopup.do.enterValue("25"); + NumberPopup.check.inputShownIs("••"); + NumberPopup.do.pressNumpad("8 0"); + NumberPopup.do.fillPopupValue("2580"); + NumberPopup.check.inputShownIs("••••"); + NumberPopup.do.clickConfirm(); + ProductScreen.check.isShown(); + ProductScreen.do.confirmOpeningPopup(); + PosHr.check.cashierNameIs("Pos Employee1"); + PosHr.do.clickCashierName(); + SelectionPopup.do.clickItem("Mitchell Admin"); + PosHr.check.cashierNameIs("Mitchell Admin"); + Chrome.do.clickMenuButton(); + PosHr.do.clickLockButton(); + PosHr.do.clickLoginButton(); + SelectionPopup.do.clickItem("Pos Employee2"); + NumberPopup.do.enterValue("12"); + NumberPopup.check.inputShownIs("••"); + NumberPopup.do.pressNumpad("3 4"); + NumberPopup.do.fillPopupValue("1234"); + NumberPopup.check.inputShownIs("••••"); + NumberPopup.do.clickConfirm(); + ProductScreen.check.isShown(); + ProductScreen.do.clickHomeCategory(); + + // Create orders and check if the ticket list has the right employee for each order + // order for employee 2 + ProductScreen.exec.addOrderline("Desk Pad", "1", "2"); + ProductScreen.check.totalAmountIs("2.0"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.nthRowContains(2, "Pos Employee2"); + + // order for employee 1 + Chrome.do.clickMenuButton(); + PosHr.do.clickLockButton(); + PosHr.exec.login("Pos Employee1", "2580"); + TicketScreen.do.clickNewTicket(); + ProductScreen.exec.addOrderline("Desk Pad", "1", "4"); + ProductScreen.check.totalAmountIs("4.0"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.nthRowContains(2, "Pos Employee2"); + TicketScreen.check.nthRowContains(3, "Pos Employee1"); + + // order for admin + PosHr.do.clickCashierName(); + SelectionPopup.do.clickItem("Mitchell Admin"); + PosHr.check.cashierNameIs("Mitchell Admin"); + TicketScreen.do.clickNewTicket(); + ProductScreen.exec.addOrderline("Desk Pad", "1", "8"); + ProductScreen.check.totalAmountIs("8.0"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.nthRowContains(4, "Mitchell Admin"); -PosHr.check.loginScreenIsShown(); -PosHr.do.clickLoginButton(); -SelectionPopup.check.isShown(); -SelectionPopup.check.hasSelectionItem("Pos Employee1"); -SelectionPopup.check.hasSelectionItem("Pos Employee2"); -SelectionPopup.check.hasSelectionItem("Mitchell Admin"); -SelectionPopup.do.clickItem("Pos Employee1"); -NumberPopup.check.isShown(); -NumberPopup.do.enterValue("25"); -NumberPopup.check.inputShownIs("••"); -NumberPopup.do.pressNumpad("8 1"); -NumberPopup.do.fillPopupValue("2581"); -NumberPopup.check.inputShownIs("••••"); -NumberPopup.do.clickConfirm(); -ErrorPopup.check.isShown(); -ErrorPopup.do.clickConfirm(); -PosHr.do.clickLoginButton(); -SelectionPopup.do.clickItem("Pos Employee1"); -NumberPopup.check.isShown(); -NumberPopup.do.enterValue("25"); -NumberPopup.check.inputShownIs("••"); -NumberPopup.do.pressNumpad("8 0"); -NumberPopup.do.fillPopupValue("2580"); -NumberPopup.check.inputShownIs("••••"); -NumberPopup.do.clickConfirm(); -ProductScreen.check.isShown(); -ProductScreen.do.confirmOpeningPopup(); -PosHr.check.cashierNameIs("Pos Employee1"); -PosHr.do.clickCashierName(); -SelectionPopup.do.clickItem("Mitchell Admin"); -PosHr.check.cashierNameIs("Mitchell Admin"); -Chrome.do.clickMenuButton(); -PosHr.do.clickLockButton(); -PosHr.do.clickLoginButton(); -SelectionPopup.do.clickItem("Pos Employee2"); -NumberPopup.do.enterValue("12"); -NumberPopup.check.inputShownIs("••"); -NumberPopup.do.pressNumpad("3 4"); -NumberPopup.do.fillPopupValue("1234"); -NumberPopup.check.inputShownIs("••••"); -NumberPopup.do.clickConfirm(); -ProductScreen.check.isShown(); -ProductScreen.do.clickHomeCategory(); - -// Create orders and check if the ticket list has the right employee for each order -// order for employee 2 -ProductScreen.exec.addOrderline("Desk Pad", "1", "2"); -ProductScreen.check.totalAmountIs("2.0"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.nthRowContains(2, "Pos Employee2"); - -// order for employee 1 -Chrome.do.clickMenuButton(); -PosHr.do.clickLockButton(); -PosHr.exec.login("Pos Employee1", "2580"); -TicketScreen.do.clickNewTicket(); -ProductScreen.exec.addOrderline("Desk Pad", "1", "4"); -ProductScreen.check.totalAmountIs("4.0"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.nthRowContains(2, "Pos Employee2"); -TicketScreen.check.nthRowContains(3, "Pos Employee1"); - -// order for admin -PosHr.do.clickCashierName(); -SelectionPopup.do.clickItem("Mitchell Admin"); -PosHr.check.cashierNameIs("Mitchell Admin"); -TicketScreen.do.clickNewTicket(); -ProductScreen.exec.addOrderline("Desk Pad", "1", "8"); -ProductScreen.check.totalAmountIs("8.0"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.nthRowContains(4, "Mitchell Admin"); - -registry.category("web_tour.tours").add("PosHrTour", { test: true, url: "/pos/ui", steps: getSteps() }); + return getSteps(); + } + }); diff --git a/addons/pos_loyalty/static/src/tours/EWalletProgramTours.js b/addons/pos_loyalty/static/src/tours/EWalletProgramTours.js index 29591ca8753..238a2d3bc6d 100644 --- a/addons/pos_loyalty/static/src/tours/EWalletProgramTours.js +++ b/addons/pos_loyalty/static/src/tours/EWalletProgramTours.js @@ -9,97 +9,112 @@ import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/util import { registry } from "@web/core/registry"; //#region EWalletProgramTour1 - -startSteps(); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); - -// Topup 50$ for partner_aaa -ProductScreen.do.clickDisplayedProduct("Top-up eWallet"); -PosLoyalty.check.orderTotalIs("50.00"); -ProductScreen.do.clickPayButton(false); -// If there's no partner, we asked to redirect to the partner list screen. -Chrome.do.confirmPopup(); -PartnerListScreen.check.isShown(); -PartnerListScreen.do.clickPartner("AAAAAAA"); -PosLoyalty.exec.finalizeOrder("Cash", "50"); - -// Topup 10$ for partner_bbb -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("BBBBBBB"); -ProductScreen.exec.addOrderline("Top-up eWallet", "1", "10"); -PosLoyalty.check.orderTotalIs("10.00"); -PosLoyalty.exec.finalizeOrder("Cash", "10"); - -registry.category("web_tour.tours").add("EWalletProgramTour1", { test: true, url: "/pos/web", steps: getSteps() }); +registry + .category("web_tour.tours") + .add("EWalletProgramTour1", { + test: true, + url: "/pos/web", + steps: () => { + + startSteps(); + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + // Topup 50$ for partner_aaa + ProductScreen.do.clickDisplayedProduct("Top-up eWallet"); + PosLoyalty.check.orderTotalIs("50.00"); + ProductScreen.do.clickPayButton(false); + // If there's no partner, we asked to redirect to the partner list screen. + Chrome.do.confirmPopup(); + PartnerListScreen.check.isShown(); + PartnerListScreen.do.clickPartner("AAAAAAA"); + PosLoyalty.exec.finalizeOrder("Cash", "50"); + + // Topup 10$ for partner_bbb + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("BBBBBBB"); + ProductScreen.exec.addOrderline("Top-up eWallet", "1", "10"); + PosLoyalty.check.orderTotalIs("10.00"); + PosLoyalty.exec.finalizeOrder("Cash", "10"); + return getSteps(); + } + }); //#endregion - //#region EWalletProgramTour2 -const getEWalletText = (suffix) => "eWallet" + (suffix !== "" ? ` ${suffix}` : ""); - -startSteps(); -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Whiteboard Pen", "2", "6", "12.00"); -PosLoyalty.check.eWalletButtonState({ highlighted: false }); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("AAAAAAA"); -PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Pay") }); -PosLoyalty.do.clickEWalletButton(getEWalletText("Pay")); -PosLoyalty.check.orderTotalIs("0.00"); -PosLoyalty.exec.finalizeOrder("Cash", "0"); - -// Consume partner_bbb's full eWallet. -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("BBBBBBB"); -PosLoyalty.check.eWalletButtonState({ highlighted: false }); -ProductScreen.exec.addOrderline("Desk Pad", "6", "6", "36.00"); -PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Pay") }); -PosLoyalty.do.clickEWalletButton(getEWalletText("Pay")); -PosLoyalty.check.orderTotalIs("26.00"); -PosLoyalty.exec.finalizeOrder("Cash", "26"); - -// Switching partners should work. -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("BBBBBBB"); -ProductScreen.exec.addOrderline("Desk Pad", "2", "19", "38.00"); -PosLoyalty.check.eWalletButtonState({ highlighted: false }); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("AAAAAAA"); -PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Pay") }); -PosLoyalty.do.clickEWalletButton(getEWalletText("Pay")); -PosLoyalty.check.orderTotalIs("0.00"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("BBBBBBB"); -PosLoyalty.check.eWalletButtonState({ highlighted: false }); -PosLoyalty.check.orderTotalIs("38.00"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("AAAAAAA"); -PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Pay") }); -PosLoyalty.do.clickEWalletButton(getEWalletText("Pay")); -PosLoyalty.check.orderTotalIs("0.00"); -PosLoyalty.exec.finalizeOrder("Cash", "0"); - -// Refund with eWallet. -// - Make an order to refund. -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("BBBBBBB"); -ProductScreen.exec.addOrderline("Whiteboard Pen", "1", "20", "20.00"); -PosLoyalty.check.orderTotalIs("20.00"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); -// - Refund order. -ProductScreen.do.clickRefund(); -TicketScreen.check.filterIs("Paid"); -TicketScreen.do.selectOrder("-0004"); -TicketScreen.check.partnerIs("BBBBBBB"); -TicketScreen.do.confirmRefund(); -ProductScreen.check.isShown(); -PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Refund") }); -PosLoyalty.do.clickEWalletButton(getEWalletText("Refund")); -PosLoyalty.check.orderTotalIs("0.00"); -PosLoyalty.exec.finalizeOrder("Cash", "0"); - -registry.category("web_tour.tours").add("EWalletProgramTour2", { test: true, url: "/pos/web", steps: getSteps() }); +registry + .category("web_tour.tours") + .add("EWalletProgramTour2", { + test: true, + url: "/pos/web", + steps: () => { + + + const getEWalletText = (suffix) => "eWallet" + (suffix !== "" ? ` ${suffix}` : ""); + + startSteps(); + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Whiteboard Pen", "2", "6", "12.00"); + PosLoyalty.check.eWalletButtonState({ highlighted: false }); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("AAAAAAA"); + PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Pay") }); + PosLoyalty.do.clickEWalletButton(getEWalletText("Pay")); + PosLoyalty.check.orderTotalIs("0.00"); + PosLoyalty.exec.finalizeOrder("Cash", "0"); + + // Consume partner_bbb's full eWallet. + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("BBBBBBB"); + PosLoyalty.check.eWalletButtonState({ highlighted: false }); + ProductScreen.exec.addOrderline("Desk Pad", "6", "6", "36.00"); + PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Pay") }); + PosLoyalty.do.clickEWalletButton(getEWalletText("Pay")); + PosLoyalty.check.orderTotalIs("26.00"); + PosLoyalty.exec.finalizeOrder("Cash", "26"); + + // Switching partners should work. + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("BBBBBBB"); + ProductScreen.exec.addOrderline("Desk Pad", "2", "19", "38.00"); + PosLoyalty.check.eWalletButtonState({ highlighted: false }); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("AAAAAAA"); + PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Pay") }); + PosLoyalty.do.clickEWalletButton(getEWalletText("Pay")); + PosLoyalty.check.orderTotalIs("0.00"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("BBBBBBB"); + PosLoyalty.check.eWalletButtonState({ highlighted: false }); + PosLoyalty.check.orderTotalIs("38.00"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("AAAAAAA"); + PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Pay") }); + PosLoyalty.do.clickEWalletButton(getEWalletText("Pay")); + PosLoyalty.check.orderTotalIs("0.00"); + PosLoyalty.exec.finalizeOrder("Cash", "0"); + + // Refund with eWallet. + // - Make an order to refund. + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("BBBBBBB"); + ProductScreen.exec.addOrderline("Whiteboard Pen", "1", "20", "20.00"); + PosLoyalty.check.orderTotalIs("20.00"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + // - Refund order. + ProductScreen.do.clickRefund(); + TicketScreen.check.filterIs("Paid"); + TicketScreen.do.selectOrder("-0004"); + TicketScreen.check.partnerIs("BBBBBBB"); + TicketScreen.do.confirmRefund(); + ProductScreen.check.isShown(); + PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Refund") }); + PosLoyalty.do.clickEWalletButton(getEWalletText("Refund")); + PosLoyalty.check.orderTotalIs("0.00"); + PosLoyalty.exec.finalizeOrder("Cash", "0"); + return getSteps(); + } + }); //#endregion diff --git a/addons/pos_loyalty/static/src/tours/GiftCardProgramTours.js b/addons/pos_loyalty/static/src/tours/GiftCardProgramTours.js index 2545ad94f89..c7513d38d73 100644 --- a/addons/pos_loyalty/static/src/tours/GiftCardProgramTours.js +++ b/addons/pos_loyalty/static/src/tours/GiftCardProgramTours.js @@ -8,71 +8,96 @@ import { registry } from "@web/core/registry"; import { TicketScreen } from "@point_of_sale/../tests/tours/helpers/TicketScreenTourMethods"; //#region GiftCardProgramCreateSetTour1 -startSteps(); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); -ProductScreen.do.clickDisplayedProduct("Gift Card"); -PosLoyalty.check.orderTotalIs("50.00"); -PosLoyalty.exec.finalizeOrder("Cash", "50"); registry .category("web_tour.tours") - .add("GiftCardProgramCreateSetTour1", { test: true, url: "/pos/web", steps: getSteps() }); + .add("GiftCardProgramCreateSetTour1", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + ProductScreen.do.clickDisplayedProduct("Gift Card"); + PosLoyalty.check.orderTotalIs("50.00"); + PosLoyalty.exec.finalizeOrder("Cash", "50"); + return getSteps(); + } + }); //#endregion //#region GiftCardProgramCreateSetTour2 -startSteps(); -ProductScreen.do.clickHomeCategory(); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -PosLoyalty.do.enterCode("044123456"); -PosLoyalty.check.orderTotalIs("0.00"); -PosLoyalty.exec.finalizeOrder("Cash", "0"); registry .category("web_tour.tours") - .add("GiftCardProgramCreateSetTour2", { test: true, url: "/pos/web", steps: getSteps() }); + .add("GiftCardProgramCreateSetTour2", { + test: true, + url: "/pos/web", + steps: () => { + + startSteps(); + ProductScreen.do.clickHomeCategory(); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + PosLoyalty.do.enterCode("044123456"); + PosLoyalty.check.orderTotalIs("0.00"); + PosLoyalty.exec.finalizeOrder("Cash", "0"); + return getSteps(); + } + }); //#endregion //#region GiftCardProgramScanUseTour -startSteps(); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); -// Pay the 5$ gift card. -ProductScreen.do.clickDisplayedProduct("Gift Card"); -TextInputPopup.check.isShown(); -TextInputPopup.do.inputText("044123456"); -TextInputPopup.do.clickConfirm(); -PosLoyalty.check.orderTotalIs("5.00"); -PosLoyalty.exec.finalizeOrder("Cash", "5"); -// Partially use the gift card. (4$) -ProductScreen.exec.addOrderline("Desk Pad", "2", "2", "4.0"); -PosLoyalty.do.enterCode("044123456"); -PosLoyalty.check.orderTotalIs("0.00"); -PosLoyalty.exec.finalizeOrder("Cash", "0"); -// Use the remaining of the gift card. (5$ - 4$ = 1$) -ProductScreen.exec.addOrderline("Whiteboard Pen", "6", "6", "36.0"); -PosLoyalty.do.enterCode("044123456"); -PosLoyalty.check.orderTotalIs("35.00"); -PosLoyalty.exec.finalizeOrder("Cash", "35"); registry .category("web_tour.tours") - .add("GiftCardProgramScanUseTour", { test: true, url: "/pos/web", steps: getSteps() }); + .add("GiftCardProgramScanUseTour", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + // Pay the 5$ gift card. + ProductScreen.do.clickDisplayedProduct("Gift Card"); + TextInputPopup.check.isShown(); + TextInputPopup.do.inputText("044123456"); + TextInputPopup.do.clickConfirm(); + PosLoyalty.check.orderTotalIs("5.00"); + PosLoyalty.exec.finalizeOrder("Cash", "5"); + // Partially use the gift card. (4$) + ProductScreen.exec.addOrderline("Desk Pad", "2", "2", "4.0"); + PosLoyalty.do.enterCode("044123456"); + PosLoyalty.check.orderTotalIs("0.00"); + PosLoyalty.exec.finalizeOrder("Cash", "0"); + // Use the remaining of the gift card. (5$ - 4$ = 1$) + ProductScreen.exec.addOrderline("Whiteboard Pen", "6", "6", "36.0"); + PosLoyalty.do.enterCode("044123456"); + PosLoyalty.check.orderTotalIs("35.00"); + PosLoyalty.exec.finalizeOrder("Cash", "35"); + return getSteps(); + } + }); //#endregion -startSteps(); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); -ProductScreen.exec.addOrderline("Magnetic Board", "1"); // 1.98 -PosLoyalty.check.orderTotalIs("1.98"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); -ProductScreen.do.clickRefund(); -TicketScreen.do.selectOrder("-0001"); -TicketScreen.do.clickOrderline("Magnetic Board"); -TicketScreen.do.pressNumpad("1"); -TicketScreen.do.confirmRefund(); -ProductScreen.check.isShown(); -ProductScreen.check.selectedOrderlineHas("Magnetic Board", "-1.00"); -ProductScreen.exec.addOrderline("Gift Card", "1"); -ProductScreen.check.selectedOrderlineHas("Gift Card", "1"); -PosLoyalty.check.orderTotalIs("0.0"); registry .category("web_tour.tours") - .add("GiftCardWithRefundtTour", { test: true, url: "/pos/web", steps: getSteps() }); + .add("GiftCardWithRefundtTour", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + ProductScreen.exec.addOrderline("Magnetic Board", "1"); // 1.98 + PosLoyalty.check.orderTotalIs("1.98"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + ProductScreen.do.clickRefund(); + TicketScreen.do.selectOrder("-0001"); + TicketScreen.do.clickOrderline("Magnetic Board"); + TicketScreen.do.pressNumpad("1"); + TicketScreen.do.confirmRefund(); + ProductScreen.check.isShown(); + ProductScreen.check.selectedOrderlineHas("Magnetic Board", "-1.00"); + ProductScreen.exec.addOrderline("Gift Card", "1"); + ProductScreen.check.selectedOrderlineHas("Gift Card", "1"); + PosLoyalty.check.orderTotalIs("0.0"); + return getSteps(); + } + }); diff --git a/addons/pos_loyalty/static/src/tours/MultipleGiftWalletProgramsTour.js b/addons/pos_loyalty/static/src/tours/MultipleGiftWalletProgramsTour.js index 095d9f10f4c..2b5ede32dcb 100644 --- a/addons/pos_loyalty/static/src/tours/MultipleGiftWalletProgramsTour.js +++ b/addons/pos_loyalty/static/src/tours/MultipleGiftWalletProgramsTour.js @@ -6,71 +6,79 @@ import { SelectionPopup } from "@point_of_sale/../tests/tours/helpers/SelectionP import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -const getEWalletText = (suffix) => "eWallet" + (suffix !== "" ? ` ${suffix}` : ""); +registry + .category("web_tour.tours") + .add("MultipleGiftWalletProgramsTour", { + test: true, + url: "/pos/web", + steps: () => { + const getEWalletText = (suffix) => "eWallet" + (suffix !== "" ? ` ${suffix}` : ""); + + startSteps(); + // One card for gift_card_1. + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + ProductScreen.do.clickDisplayedProduct("Gift Card"); + SelectionPopup.check.hasSelectionItem("gift_card_1"); + SelectionPopup.check.hasSelectionItem("gift_card_2"); + SelectionPopup.do.clickItem("gift_card_1"); + ProductScreen.check.selectedOrderlineHas("Gift Card"); + ProductScreen.do.pressNumpad("Price"); + ProductScreen.check.modeIsActive("Price"); + ProductScreen.do.pressNumpad("1 0"); + PosLoyalty.check.orderTotalIs("10.00"); + PosLoyalty.exec.finalizeOrder("Cash", "10"); + // One card for gift_card_1. + ProductScreen.do.clickDisplayedProduct("Gift Card"); + SelectionPopup.do.clickItem("gift_card_2"); + ProductScreen.check.selectedOrderlineHas("Gift Card"); + ProductScreen.do.pressNumpad("Price"); + ProductScreen.check.modeIsActive("Price"); + ProductScreen.do.pressNumpad("2 0"); + PosLoyalty.check.orderTotalIs("20.00"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + // Top up ewallet_1 for AAAAAAA. + ProductScreen.do.clickDisplayedProduct("Top-up eWallet"); + SelectionPopup.check.hasSelectionItem("ewallet_1"); + SelectionPopup.check.hasSelectionItem("ewallet_2"); + SelectionPopup.do.clickItem("ewallet_1"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("AAAAAAA"); + ProductScreen.do.pressNumpad("Price"); + ProductScreen.check.modeIsActive("Price"); + ProductScreen.do.pressNumpad("3 0"); + PosLoyalty.check.orderTotalIs("30.00"); + PosLoyalty.exec.finalizeOrder("Cash", "30"); + // Top up ewallet_2 for AAAAAAA. + ProductScreen.do.clickDisplayedProduct("Top-up eWallet"); + SelectionPopup.do.clickItem("ewallet_2"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("AAAAAAA"); + ProductScreen.do.pressNumpad("Price"); + ProductScreen.check.modeIsActive("Price"); + ProductScreen.do.pressNumpad("4 0"); + PosLoyalty.check.orderTotalIs("40.00"); + PosLoyalty.exec.finalizeOrder("Cash", "40"); + // Top up ewallet_1 for BBBBBBB. + ProductScreen.do.clickDisplayedProduct("Top-up eWallet"); + SelectionPopup.do.clickItem("ewallet_1"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("BBBBBBB"); + PosLoyalty.check.orderTotalIs("50.00"); + PosLoyalty.exec.finalizeOrder("Cash", "50"); + // Consume 12$ from ewallet_1 of AAAAAAA. + ProductScreen.exec.addOrderline("Whiteboard Pen", "2", "6", "12.00"); + PosLoyalty.check.eWalletButtonState({ highlighted: false }); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("AAAAAAA"); + PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Pay") }); + PosLoyalty.do.clickEWalletButton(getEWalletText("Pay")); + SelectionPopup.check.hasSelectionItem("ewallet_1"); + SelectionPopup.check.hasSelectionItem("ewallet_2"); + SelectionPopup.do.clickItem("ewallet_1"); + PosLoyalty.check.orderTotalIs("0.00"); + PosLoyalty.exec.finalizeOrder("Cash", "0"); -startSteps(); -// One card for gift_card_1. -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); -ProductScreen.do.clickDisplayedProduct("Gift Card"); -SelectionPopup.check.hasSelectionItem("gift_card_1"); -SelectionPopup.check.hasSelectionItem("gift_card_2"); -SelectionPopup.do.clickItem("gift_card_1"); -ProductScreen.check.selectedOrderlineHas("Gift Card"); -ProductScreen.do.pressNumpad("Price"); -ProductScreen.check.modeIsActive("Price"); -ProductScreen.do.pressNumpad("1 0"); -PosLoyalty.check.orderTotalIs("10.00"); -PosLoyalty.exec.finalizeOrder("Cash", "10"); -// One card for gift_card_1. -ProductScreen.do.clickDisplayedProduct("Gift Card"); -SelectionPopup.do.clickItem("gift_card_2"); -ProductScreen.check.selectedOrderlineHas("Gift Card"); -ProductScreen.do.pressNumpad("Price"); -ProductScreen.check.modeIsActive("Price"); -ProductScreen.do.pressNumpad("2 0"); -PosLoyalty.check.orderTotalIs("20.00"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); -// Top up ewallet_1 for AAAAAAA. -ProductScreen.do.clickDisplayedProduct("Top-up eWallet"); -SelectionPopup.check.hasSelectionItem("ewallet_1"); -SelectionPopup.check.hasSelectionItem("ewallet_2"); -SelectionPopup.do.clickItem("ewallet_1"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("AAAAAAA"); -ProductScreen.do.pressNumpad("Price"); -ProductScreen.check.modeIsActive("Price"); -ProductScreen.do.pressNumpad("3 0"); -PosLoyalty.check.orderTotalIs("30.00"); -PosLoyalty.exec.finalizeOrder("Cash", "30"); -// Top up ewallet_2 for AAAAAAA. -ProductScreen.do.clickDisplayedProduct("Top-up eWallet"); -SelectionPopup.do.clickItem("ewallet_2"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("AAAAAAA"); -ProductScreen.do.pressNumpad("Price"); -ProductScreen.check.modeIsActive("Price"); -ProductScreen.do.pressNumpad("4 0"); -PosLoyalty.check.orderTotalIs("40.00"); -PosLoyalty.exec.finalizeOrder("Cash", "40"); -// Top up ewallet_1 for BBBBBBB. -ProductScreen.do.clickDisplayedProduct("Top-up eWallet"); -SelectionPopup.do.clickItem("ewallet_1"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("BBBBBBB"); -PosLoyalty.check.orderTotalIs("50.00"); -PosLoyalty.exec.finalizeOrder("Cash", "50"); -// Consume 12$ from ewallet_1 of AAAAAAA. -ProductScreen.exec.addOrderline("Whiteboard Pen", "2", "6", "12.00"); -PosLoyalty.check.eWalletButtonState({ highlighted: false }); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("AAAAAAA"); -PosLoyalty.check.eWalletButtonState({ highlighted: true, text: getEWalletText("Pay") }); -PosLoyalty.do.clickEWalletButton(getEWalletText("Pay")); -SelectionPopup.check.hasSelectionItem("ewallet_1"); -SelectionPopup.check.hasSelectionItem("ewallet_2"); -SelectionPopup.do.clickItem("ewallet_1"); -PosLoyalty.check.orderTotalIs("0.00"); -PosLoyalty.exec.finalizeOrder("Cash", "0"); - -registry.category("web_tour.tours").add("MultipleGiftWalletProgramsTour", { test: true, url: "/pos/web", steps: getSteps() }); + return getSteps(); + } + }); diff --git a/addons/pos_loyalty/static/src/tours/PosLoyaltyLoyaltyProgramTour.js b/addons/pos_loyalty/static/src/tours/PosLoyaltyLoyaltyProgramTour.js index 7dfe88b8db0..61d0544c371 100644 --- a/addons/pos_loyalty/static/src/tours/PosLoyaltyLoyaltyProgramTour.js +++ b/addons/pos_loyalty/static/src/tours/PosLoyaltyLoyaltyProgramTour.js @@ -5,159 +5,184 @@ import { ProductScreen } from "@point_of_sale/../tests/tours/helpers/ProductScre import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); +registry + .category("web_tour.tours") + .add("PosLoyaltyLoyaltyProgram1", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + // Order1: Generates 2 points. + ProductScreen.exec.addOrderline("Whiteboard Pen", "2"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Test Partner AAA"); + PosLoyalty.check.orderTotalIs("6.40"); + PosLoyalty.exec.finalizeOrder("Cash", "10"); + + // Order2: Consumes points to get free product. + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Test Partner AAA"); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.00"); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "2.00"); + // At this point, Test Partner AAA has 4 points. + PosLoyalty.check.isRewardButtonHighlighted(true); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "3.00"); + PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); + PosLoyalty.check.isRewardButtonHighlighted(false); + PosLoyalty.check.orderTotalIs("6.40"); + PosLoyalty.exec.finalizeOrder("Cash", "10"); + + // Order3: Generate 4 points. + // - Initially gets free product, but was removed automatically by changing the + // number of items to zero. + // - It's impossible to checked here if the free product reward is really removed + // so we check in the backend the number of orders that consumed the reward. + ProductScreen.exec.addOrderline("Whiteboard Pen", "4"); + PosLoyalty.check.orderTotalIs("12.80"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Test Partner AAA"); + PosLoyalty.check.isRewardButtonHighlighted(true); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.do.pressNumpad("Backspace"); + // At this point, the reward line should have been automatically removed + // because there is not enough points to purchase it. Unfortunately, we + // can't check that here. + PosLoyalty.check.orderTotalIs("0.00"); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.00"); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "2.00"); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "3.00"); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "4.00"); + PosLoyalty.check.isRewardButtonHighlighted(true); + + PosLoyalty.check.orderTotalIs("12.80"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); -// Order1: Generates 2 points. -ProductScreen.exec.addOrderline("Whiteboard Pen", "2"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Test Partner AAA"); -PosLoyalty.check.orderTotalIs("6.40"); -PosLoyalty.exec.finalizeOrder("Cash", "10"); + return getSteps(); + } + }); -// Order2: Consumes points to get free product. -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Test Partner AAA"); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.00"); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "2.00"); -// At this point, Test Partner AAA has 4 points. -PosLoyalty.check.isRewardButtonHighlighted(true); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "3.00"); -PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); -PosLoyalty.check.isRewardButtonHighlighted(false); -PosLoyalty.check.orderTotalIs("6.40"); -PosLoyalty.exec.finalizeOrder("Cash", "10"); +registry + .category("web_tour.tours") + .add("PosLoyaltyLoyaltyProgram2", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + + ProductScreen.do.clickHomeCategory(); + + // Order1: Immediately set the customer to Test Partner AAA which has 4 points. + // - He has enough points to purchase a free product but since there is still + // no product in the order, reward button should not yet be highlighted. + // - Furthermore, clicking the reward product should not add it as reward product. + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Test Partner AAA"); + // No item in the order, so reward button is off. + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + PosLoyalty.check.isRewardButtonHighlighted(true); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); + PosLoyalty.check.isRewardButtonHighlighted(false); + PosLoyalty.check.orderTotalIs("3.20"); + PosLoyalty.exec.finalizeOrder("Cash", "10"); + + // Order2: Generate 4 points for Test Partner CCC. + // - Reference: Order2_CCC + // - But set Test Partner BBB first as the customer. + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Test Partner BBB"); + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.00"); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "2.00"); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "3.00"); + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "4.00"); + PosLoyalty.check.isRewardButtonHighlighted(true); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Test Partner CCC"); + PosLoyalty.check.customerIs("Test Partner CCC"); + PosLoyalty.check.orderTotalIs("12.80"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + + // Order3: Generate 3 points for Test Partner BBB. + // - Reference: Order3_BBB + // - But set Test Partner CCC first as the customer. + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Test Partner CCC"); + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.exec.addOrderline("Whiteboard Pen", "3"); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Test Partner BBB"); + PosLoyalty.check.customerIs("Test Partner BBB"); + PosLoyalty.check.orderTotalIs("9.60"); + PosLoyalty.exec.finalizeOrder("Cash", "10"); + + // Order4: Should not have reward because the customer will be removed. + // - Reference: Order4_no_reward + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.00"); + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("Test Partner CCC"); + PosLoyalty.check.isRewardButtonHighlighted(true); + PosLoyalty.do.claimReward("Free Product - Whiteboard Pen"); + PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); + ProductScreen.do.clickPartnerButton(); + // This deselects the customer. + PosLoyalty.do.unselectPartner(); + PosLoyalty.check.customerIs("Customer"); + PosLoyalty.check.orderTotalIs("6.40"); + PosLoyalty.exec.finalizeOrder("Cash", "10"); -// Order3: Generate 4 points. -// - Initially gets free product, but was removed automatically by changing the -// number of items to zero. -// - It's impossible to checked here if the free product reward is really removed -// so we check in the backend the number of orders that consumed the reward. -ProductScreen.exec.addOrderline("Whiteboard Pen", "4"); -PosLoyalty.check.orderTotalIs("12.80"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Test Partner AAA"); -PosLoyalty.check.isRewardButtonHighlighted(true); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.do.pressNumpad("Backspace"); -// At this point, the reward line should have been automatically removed -// because there is not enough points to purchase it. Unfortunately, we -// can't check that here. -PosLoyalty.check.orderTotalIs("0.00"); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.00"); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "2.00"); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "3.00"); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "4.00"); -PosLoyalty.check.isRewardButtonHighlighted(true); + return getSteps(); + } + }); -PosLoyalty.check.orderTotalIs("12.80"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); +registry + .category("web_tour.tours") + .add("PosLoyaltyLoyaltyProgram3", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + // Generates 10.2 points and use points to get the reward product with zero sale price + ProductScreen.exec.addOrderline('Desk Organizer', '2'); + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer('Test Partner AAA'); + + // At this point, the free_product program is triggered. + // The reward button should be highlighted. + PosLoyalty.check.isRewardButtonHighlighted(true); + PosLoyalty.do.claimReward("Free Product - Whiteboard Pen"); + PosLoyalty.check.hasRewardLine('Free Product - Whiteboard Pen', '0.0', '1.00'); + + PosLoyalty.check.orderTotalIs('10.2'); + PosLoyalty.exec.finalizeOrder('Cash', '10.2'); -registry.category("web_tour.tours").add("PosLoyaltyLoyaltyProgram1", { test: true, url: "/pos/web", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.clickHomeCategory(); - -// Order1: Immediately set the customer to Test Partner AAA which has 4 points. -// - He has enough points to purchase a free product but since there is still -// no product in the order, reward button should not yet be highlighted. -// - Furthermore, clicking the reward product should not add it as reward product. -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Test Partner AAA"); -// No item in the order, so reward button is off. -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -PosLoyalty.check.isRewardButtonHighlighted(true); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); -PosLoyalty.check.isRewardButtonHighlighted(false); -PosLoyalty.check.orderTotalIs("3.20"); -PosLoyalty.exec.finalizeOrder("Cash", "10"); - -// Order2: Generate 4 points for Test Partner CCC. -// - Reference: Order2_CCC -// - But set Test Partner BBB first as the customer. -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Test Partner BBB"); -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.00"); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "2.00"); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "3.00"); -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "4.00"); -PosLoyalty.check.isRewardButtonHighlighted(true); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Test Partner CCC"); -PosLoyalty.check.customerIs("Test Partner CCC"); -PosLoyalty.check.orderTotalIs("12.80"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); - -// Order3: Generate 3 points for Test Partner BBB. -// - Reference: Order3_BBB -// - But set Test Partner CCC first as the customer. -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Test Partner CCC"); -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.exec.addOrderline("Whiteboard Pen", "3"); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Test Partner BBB"); -PosLoyalty.check.customerIs("Test Partner BBB"); -PosLoyalty.check.orderTotalIs("9.60"); -PosLoyalty.exec.finalizeOrder("Cash", "10"); - -// Order4: Should not have reward because the customer will be removed. -// - Reference: Order4_no_reward -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -ProductScreen.check.selectedOrderlineHas("Whiteboard Pen", "1.00"); -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("Test Partner CCC"); -PosLoyalty.check.isRewardButtonHighlighted(true); -PosLoyalty.do.claimReward("Free Product - Whiteboard Pen"); -PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); -ProductScreen.do.clickPartnerButton(); -// This deselects the customer. -PosLoyalty.do.unselectPartner(); -PosLoyalty.check.customerIs("Customer"); -PosLoyalty.check.orderTotalIs("6.40"); -PosLoyalty.exec.finalizeOrder("Cash", "10"); - -registry.category("web_tour.tours").add("PosLoyaltyLoyaltyProgram2", { test: true, url: "/pos/web", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); - -// Generates 10.2 points and use points to get the reward product with zero sale price -ProductScreen.exec.addOrderline('Desk Organizer', '2'); -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer('Test Partner AAA'); - -// At this point, the free_product program is triggered. -// The reward button should be highlighted. -PosLoyalty.check.isRewardButtonHighlighted(true); -PosLoyalty.do.claimReward("Free Product - Whiteboard Pen"); -PosLoyalty.check.hasRewardLine('Free Product - Whiteboard Pen', '0.0', '1.00'); - -PosLoyalty.check.orderTotalIs('10.2'); -PosLoyalty.exec.finalizeOrder('Cash', '10.2'); - -registry.category("web_tour.tours").add("PosLoyaltyLoyaltyProgram3", { test: true, url: "/pos/web", steps: getSteps() }); + return getSteps(); + } + }); diff --git a/addons/pos_loyalty/static/src/tours/PosLoyaltyRewardButtonTour.js b/addons/pos_loyalty/static/src/tours/PosLoyaltyRewardButtonTour.js index e8026f897e9..e742b47f7ba 100644 --- a/addons/pos_loyalty/static/src/tours/PosLoyaltyRewardButtonTour.js +++ b/addons/pos_loyalty/static/src/tours/PosLoyaltyRewardButtonTour.js @@ -6,181 +6,205 @@ import { SelectionPopup } from "@point_of_sale/../tests/tours/helpers/SelectionP import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); - -ProductScreen.exec.addOrderline("Desk Organizer", "2"); - -// At this point, the free_product program is triggered. -// The reward button should be highlighted. -PosLoyalty.check.isRewardButtonHighlighted(true); -// Since the reward button is highlighted, clicking the reward product should be added as reward. -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "3.00"); -PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-5.10", "1.00"); -// In the succeeding 2 clicks on the product, it is considered as a regular product. -// In the third click, the product will be added as reward. -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -PosLoyalty.check.isRewardButtonHighlighted(true); -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "6.00"); -PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-10.20", "2.00"); - -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -PosLoyalty.check.isRewardButtonHighlighted(false); -PosLoyalty.check.orderTotalIs("25.50"); -// Finalize order that consumed a reward. -PosLoyalty.exec.finalizeOrder("Cash", "30"); - -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "1.00"); -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "2.00"); -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-5.10", "1.00"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "0.00"); -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "1.00"); -ProductScreen.do.clickDisplayedProduct("Desk Organizer"); -ProductScreen.check.selectedOrderlineHas("Desk Organizer", "2.00"); -PosLoyalty.check.isRewardButtonHighlighted(true); -// Finalize order but without the reward. -// This step is important. When syncing the order, no reward should be synced. -PosLoyalty.check.orderTotalIs("10.20"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); - -ProductScreen.exec.addOrderline("Magnetic Board", "2"); -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.do.clickDisplayedProduct("Magnetic Board"); -PosLoyalty.check.isRewardButtonHighlighted(true); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -PosLoyalty.check.isRewardButtonHighlighted(false); -PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); -ProductScreen.do.clickOrderline("Magnetic Board", "3.00"); -ProductScreen.check.selectedOrderlineHas("Magnetic Board", "3.00"); -ProductScreen.do.pressNumpad("6"); -ProductScreen.check.selectedOrderlineHas("Magnetic Board", "6.00"); -PosLoyalty.check.isRewardButtonHighlighted(true); -PosLoyalty.do.claimReward("Free Product - Whiteboard Pen"); -PosLoyalty.check.isRewardButtonHighlighted(false); -PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-6.40", "2.00"); -// Finalize order that consumed a reward. -PosLoyalty.check.orderTotalIs("11.88"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); - -ProductScreen.exec.addOrderline("Magnetic Board", "6"); -ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); -PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); -PosLoyalty.check.isRewardButtonHighlighted(true); - -ProductScreen.do.clickOrderline("Magnetic Board", "6.00"); -ProductScreen.do.pressNumpad("Backspace"); -// At this point, the reward should have been removed. -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.check.selectedOrderlineHas("Magnetic Board", "0.00"); -ProductScreen.do.clickDisplayedProduct("Magnetic Board"); -ProductScreen.check.selectedOrderlineHas("Magnetic Board", "1.00"); -ProductScreen.do.clickDisplayedProduct("Magnetic Board"); -ProductScreen.check.selectedOrderlineHas("Magnetic Board", "2.00"); -ProductScreen.do.clickDisplayedProduct("Magnetic Board"); -ProductScreen.check.selectedOrderlineHas("Magnetic Board", "3.00"); -PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); -PosLoyalty.check.isRewardButtonHighlighted(false); - -PosLoyalty.check.orderTotalIs("5.94"); -PosLoyalty.exec.finalizeOrder("Cash", "10"); - -// Promotion: 2 items of shelves, get desk_pad/monitor_stand free -// This is the 5th order. -ProductScreen.do.clickDisplayedProduct("Wall Shelf Unit"); -ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "1.00"); -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.do.clickDisplayedProduct("Small Shelf"); -ProductScreen.check.selectedOrderlineHas("Small Shelf", "1.00"); -PosLoyalty.check.isRewardButtonHighlighted(true); -// Click reward product. Should be automatically added as reward. -ProductScreen.do.clickDisplayedProduct("Desk Pad"); -PosLoyalty.check.isRewardButtonHighlighted(false); -PosLoyalty.check.hasRewardLine("Free Product", "-1.98", "1.00"); -// Remove the reward line. The next steps will check if cashier -// can select from the different reward products. -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.do.pressNumpad("Backspace"); -PosLoyalty.check.isRewardButtonHighlighted(true); -PosLoyalty.do.claimReward("Free Product - [Desk Pad, Monitor Stand]"); -SelectionPopup.check.hasSelectionItem("Monitor Stand"); -SelectionPopup.check.hasSelectionItem("Desk Pad"); -SelectionPopup.do.clickItem("Desk Pad"); -PosLoyalty.check.isRewardButtonHighlighted(false); -PosLoyalty.check.hasRewardLine("Free Product", "-1.98", "1.00"); -ProductScreen.do.pressNumpad("Backspace"); -ProductScreen.do.pressNumpad("Backspace"); -PosLoyalty.check.isRewardButtonHighlighted(true); -PosLoyalty.do.claimReward("Free Product - [Desk Pad, Monitor Stand]"); -SelectionPopup.check.hasSelectionItem("Monitor Stand"); -SelectionPopup.check.hasSelectionItem("Desk Pad"); -SelectionPopup.do.clickItem("Monitor Stand"); -PosLoyalty.check.isRewardButtonHighlighted(false); -ProductScreen.check.selectedOrderlineHas("Monitor Stand", "1.00", "3.19"); -PosLoyalty.check.hasRewardLine("Free Product", "-3.19", "1.00"); -PosLoyalty.check.orderTotalIs("4.81"); -PosLoyalty.exec.finalizeOrder("Cash", "10"); registry .category("web_tour.tours") - .add("PosLoyaltyFreeProductTour", { test: true, url: "/pos/web", steps: getSteps() }); -startSteps(); + .add("PosLoyaltyFreeProductTour", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + ProductScreen.exec.addOrderline("Desk Organizer", "2"); + + // At this point, the free_product program is triggered. + // The reward button should be highlighted. + PosLoyalty.check.isRewardButtonHighlighted(true); + // Since the reward button is highlighted, clicking the reward product should be added as reward. + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "3.00"); + PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-5.10", "1.00"); + // In the succeeding 2 clicks on the product, it is considered as a regular product. + // In the third click, the product will be added as reward. + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + PosLoyalty.check.isRewardButtonHighlighted(true); + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "6.00"); + PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-10.20", "2.00"); + + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + PosLoyalty.check.isRewardButtonHighlighted(false); + PosLoyalty.check.orderTotalIs("25.50"); + // Finalize order that consumed a reward. + PosLoyalty.exec.finalizeOrder("Cash", "30"); + + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "1.00"); + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "2.00"); + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-5.10", "1.00"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "0.00"); + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "1.00"); + ProductScreen.do.clickDisplayedProduct("Desk Organizer"); + ProductScreen.check.selectedOrderlineHas("Desk Organizer", "2.00"); + PosLoyalty.check.isRewardButtonHighlighted(true); + // Finalize order but without the reward. + // This step is important. When syncing the order, no reward should be synced. + PosLoyalty.check.orderTotalIs("10.20"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + + ProductScreen.exec.addOrderline("Magnetic Board", "2"); + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.do.clickDisplayedProduct("Magnetic Board"); + PosLoyalty.check.isRewardButtonHighlighted(true); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + PosLoyalty.check.isRewardButtonHighlighted(false); + PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); + ProductScreen.do.clickOrderline("Magnetic Board", "3.00"); + ProductScreen.check.selectedOrderlineHas("Magnetic Board", "3.00"); + ProductScreen.do.pressNumpad("6"); + ProductScreen.check.selectedOrderlineHas("Magnetic Board", "6.00"); + PosLoyalty.check.isRewardButtonHighlighted(true); + PosLoyalty.do.claimReward("Free Product - Whiteboard Pen"); + PosLoyalty.check.isRewardButtonHighlighted(false); + PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-6.40", "2.00"); + // Finalize order that consumed a reward. + PosLoyalty.check.orderTotalIs("11.88"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + + ProductScreen.exec.addOrderline("Magnetic Board", "6"); + ProductScreen.do.clickDisplayedProduct("Whiteboard Pen"); + PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); + PosLoyalty.check.isRewardButtonHighlighted(true); + + ProductScreen.do.clickOrderline("Magnetic Board", "6.00"); + ProductScreen.do.pressNumpad("Backspace"); + // At this point, the reward should have been removed. + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.check.selectedOrderlineHas("Magnetic Board", "0.00"); + ProductScreen.do.clickDisplayedProduct("Magnetic Board"); + ProductScreen.check.selectedOrderlineHas("Magnetic Board", "1.00"); + ProductScreen.do.clickDisplayedProduct("Magnetic Board"); + ProductScreen.check.selectedOrderlineHas("Magnetic Board", "2.00"); + ProductScreen.do.clickDisplayedProduct("Magnetic Board"); + ProductScreen.check.selectedOrderlineHas("Magnetic Board", "3.00"); + PosLoyalty.check.hasRewardLine("Free Product - Whiteboard Pen", "-3.20", "1.00"); + PosLoyalty.check.isRewardButtonHighlighted(false); + + PosLoyalty.check.orderTotalIs("5.94"); + PosLoyalty.exec.finalizeOrder("Cash", "10"); + + // Promotion: 2 items of shelves, get desk_pad/monitor_stand free + // This is the 5th order. + ProductScreen.do.clickDisplayedProduct("Wall Shelf Unit"); + ProductScreen.check.selectedOrderlineHas("Wall Shelf Unit", "1.00"); + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.do.clickDisplayedProduct("Small Shelf"); + ProductScreen.check.selectedOrderlineHas("Small Shelf", "1.00"); + PosLoyalty.check.isRewardButtonHighlighted(true); + // Click reward product. Should be automatically added as reward. + ProductScreen.do.clickDisplayedProduct("Desk Pad"); + PosLoyalty.check.isRewardButtonHighlighted(false); + PosLoyalty.check.hasRewardLine("Free Product", "-1.98", "1.00"); + // Remove the reward line. The next steps will check if cashier + // can select from the different reward products. + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.do.pressNumpad("Backspace"); + PosLoyalty.check.isRewardButtonHighlighted(true); + PosLoyalty.do.claimReward("Free Product - [Desk Pad, Monitor Stand]"); + SelectionPopup.check.hasSelectionItem("Monitor Stand"); + SelectionPopup.check.hasSelectionItem("Desk Pad"); + SelectionPopup.do.clickItem("Desk Pad"); + PosLoyalty.check.isRewardButtonHighlighted(false); + PosLoyalty.check.hasRewardLine("Free Product", "-1.98", "1.00"); + ProductScreen.do.pressNumpad("Backspace"); + ProductScreen.do.pressNumpad("Backspace"); + PosLoyalty.check.isRewardButtonHighlighted(true); + PosLoyalty.do.claimReward("Free Product - [Desk Pad, Monitor Stand]"); + SelectionPopup.check.hasSelectionItem("Monitor Stand"); + SelectionPopup.check.hasSelectionItem("Desk Pad"); + SelectionPopup.do.clickItem("Monitor Stand"); + PosLoyalty.check.isRewardButtonHighlighted(false); + ProductScreen.check.selectedOrderlineHas("Monitor Stand", "1.00", "3.19"); + PosLoyalty.check.hasRewardLine("Free Product", "-3.19", "1.00"); + PosLoyalty.check.orderTotalIs("4.81"); + PosLoyalty.exec.finalizeOrder("Cash", "10"); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); - -ProductScreen.do.clickPartnerButton(); -ProductScreen.do.clickCustomer("AAA Partner"); -ProductScreen.exec.addOrderline("Test Product A", "1"); -PosLoyalty.check.isRewardButtonHighlighted(true); -PosLoyalty.do.clickRewardButton(); -SelectionPopup.do.clickItem("Free Product - Test Product A"); -PosLoyalty.check.hasRewardLine("Free Product - Test Product A", "-11.50", "1.00"); -PosLoyalty.check.isRewardButtonHighlighted(false); + return getSteps(); + } + }); registry .category("web_tour.tours") - .add("PosLoyaltyFreeProductTour2", { test: true, url: "/pos/web", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); - -ProductScreen.do.clickDisplayedProduct('Test Product A'); -ProductScreen.check.selectedOrderlineHas('Test Product A', '1.00', '40.00'); -ProductScreen.do.clickDisplayedProduct('Test Product B'); -ProductScreen.check.selectedOrderlineHas('Test Product B', '1.00', '40.00'); -PosLoyalty.do.clickRewardButton(); -SelectionPopup.do.clickItem("$ 10 per order on specific products"); -PosLoyalty.check.hasRewardLine('$ 10 per order on specific products', '-10.00', '1.00'); -PosLoyalty.check.orderTotalIs('60.00'); + .add("PosLoyaltyFreeProductTour2", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + ProductScreen.do.clickPartnerButton(); + ProductScreen.do.clickCustomer("AAA Partner"); + ProductScreen.exec.addOrderline("Test Product A", "1"); + PosLoyalty.check.isRewardButtonHighlighted(true); + PosLoyalty.do.clickRewardButton(); + SelectionPopup.do.clickItem("Free Product - Test Product A"); + PosLoyalty.check.hasRewardLine("Free Product - Test Product A", "-11.50", "1.00"); + PosLoyalty.check.isRewardButtonHighlighted(false); + return getSteps(); + } + }); registry .category("web_tour.tours") - .add("PosLoyaltySpecificDiscountTour", { test: true, url: "/pos/web", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); - -ProductScreen.do.clickDisplayedProduct('Test Product A'); -ProductScreen.do.clickDisplayedProduct('Test Product C'); -PosLoyalty.check.orderTotalIs('130.00'); -PosLoyalty.check.isRewardButtonHighlighted(true); -PosLoyalty.do.clickRewardButton(); -PosLoyalty.check.orderTotalIs('130.00'); + .add("PosLoyaltySpecificDiscountTour", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + ProductScreen.do.clickDisplayedProduct('Test Product A'); + ProductScreen.check.selectedOrderlineHas('Test Product A', '1.00', '40.00'); + ProductScreen.do.clickDisplayedProduct('Test Product B'); + ProductScreen.check.selectedOrderlineHas('Test Product B', '1.00', '40.00'); + PosLoyalty.do.clickRewardButton(); + SelectionPopup.do.clickItem("$ 10 per order on specific products"); + PosLoyalty.check.hasRewardLine('$ 10 per order on specific products', '-10.00', '1.00'); + PosLoyalty.check.orderTotalIs('60.00'); + return getSteps(); + } + }); registry .category("web_tour.tours") - .add("PosLoyaltySpecificDiscountWithFreeProductTour", { test: true, url: "/pos/web", steps: getSteps() }); + .add("PosLoyaltySpecificDiscountWithFreeProductTour", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + ProductScreen.do.clickDisplayedProduct('Test Product A'); + ProductScreen.do.clickDisplayedProduct('Test Product C'); + PosLoyalty.check.orderTotalIs('130.00'); + PosLoyalty.check.isRewardButtonHighlighted(true); + PosLoyalty.do.clickRewardButton(); + PosLoyalty.check.orderTotalIs('130.00'); + return getSteps(); + } + }); + \ No newline at end of file diff --git a/addons/pos_loyalty/static/src/tours/PosLoyaltyTour.js b/addons/pos_loyalty/static/src/tours/PosLoyaltyTour.js index c55f1e4d580..75bfd5866f1 100644 --- a/addons/pos_loyalty/static/src/tours/PosLoyaltyTour.js +++ b/addons/pos_loyalty/static/src/tours/PosLoyaltyTour.js @@ -5,212 +5,240 @@ import { ProductScreen } from "@point_of_sale/../tests/tours/helpers/ProductScre import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -// --- PoS Loyalty Tour Basic Part 1 --- -// Generate coupons for PosLoyaltyTour2. -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); - -// basic order -// just accept the automatically applied promo program -// applied programs: -// - on cheapest product -ProductScreen.exec.addOrderline("Whiteboard Pen", "5"); -PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-2.88"); -PosLoyalty.do.selectRewardLine("on the cheapest product"); -PosLoyalty.check.orderTotalIs("13.12"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); - -// remove the reward from auto promo program -// no applied programs -ProductScreen.exec.addOrderline("Whiteboard Pen", "6"); -PosLoyalty.check.hasRewardLine("on the cheapest product", "-2.88"); -PosLoyalty.check.orderTotalIs("16.32"); -PosLoyalty.exec.removeRewardLine("90% on the cheapest product"); -PosLoyalty.check.orderTotalIs("19.2"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); - -// order with coupon code from coupon program -// applied programs: -// - coupon program -ProductScreen.exec.addOrderline("Desk Organizer", "9"); -PosLoyalty.check.hasRewardLine("on the cheapest product", "-4.59"); -PosLoyalty.exec.removeRewardLine("90% on the cheapest product"); -PosLoyalty.check.orderTotalIs("45.90"); -PosLoyalty.do.enterCode("invalid_code"); -PosLoyalty.check.notificationMessageContains("invalid_code"); -PosLoyalty.do.enterCode("1234"); -PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-15.30"); -PosLoyalty.exec.finalizeOrder("Cash", "50"); - -// Use coupon but eventually remove the reward -// applied programs: -// - on cheapest product -ProductScreen.exec.addOrderline("Letter Tray", "4"); -ProductScreen.exec.addOrderline("Desk Organizer", "9"); -PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-4.75"); -PosLoyalty.check.orderTotalIs("62.27"); -PosLoyalty.do.enterCode("5678"); -PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-15.30"); -PosLoyalty.check.orderTotalIs("46.97"); -PosLoyalty.exec.removeRewardLine("Free Product"); -PosLoyalty.check.orderTotalIs("62.27"); -PosLoyalty.exec.finalizeOrder("Cash", "90"); - -// specific product discount -// applied programs: -// - on cheapest product -// - on specific products -ProductScreen.exec.addOrderline("Magnetic Board", "10"); // 1.98 -ProductScreen.exec.addOrderline("Desk Organizer", "3"); // 5.1 -ProductScreen.exec.addOrderline("Letter Tray", "4"); // 4.8 tax 10% -PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-1.78"); -PosLoyalty.check.orderTotalIs("54.44"); -PosLoyalty.do.enterCode("promocode"); -PosLoyalty.check.hasRewardLine("50% on specific products", "-16.66"); // 17.55 - 1.78*0.5 -PosLoyalty.check.orderTotalIs("37.78"); -PosLoyalty.exec.finalizeOrder("Cash", "50"); registry .category("web_tour.tours") - .add("PosLoyaltyTour1", { test: true, url: "/pos/web", steps: getSteps() }); + .add("PosLoyaltyTour1", { + test: true, + url: "/pos/web", + steps: () => { + // --- PoS Loyalty Tour Basic Part 1 --- + // Generate coupons for PosLoyaltyTour2. + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + // basic order + // just accept the automatically applied promo program + // applied programs: + // - on cheapest product + ProductScreen.exec.addOrderline("Whiteboard Pen", "5"); + PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-2.88"); + PosLoyalty.do.selectRewardLine("on the cheapest product"); + PosLoyalty.check.orderTotalIs("13.12"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + + // remove the reward from auto promo program + // no applied programs + ProductScreen.exec.addOrderline("Whiteboard Pen", "6"); + PosLoyalty.check.hasRewardLine("on the cheapest product", "-2.88"); + PosLoyalty.check.orderTotalIs("16.32"); + PosLoyalty.exec.removeRewardLine("90% on the cheapest product"); + PosLoyalty.check.orderTotalIs("19.2"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + + // order with coupon code from coupon program + // applied programs: + // - coupon program + ProductScreen.exec.addOrderline("Desk Organizer", "9"); + PosLoyalty.check.hasRewardLine("on the cheapest product", "-4.59"); + PosLoyalty.exec.removeRewardLine("90% on the cheapest product"); + PosLoyalty.check.orderTotalIs("45.90"); + PosLoyalty.do.enterCode("invalid_code"); + PosLoyalty.check.notificationMessageContains("invalid_code"); + PosLoyalty.do.enterCode("1234"); + PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-15.30"); + PosLoyalty.exec.finalizeOrder("Cash", "50"); + + // Use coupon but eventually remove the reward + // applied programs: + // - on cheapest product + ProductScreen.exec.addOrderline("Letter Tray", "4"); + ProductScreen.exec.addOrderline("Desk Organizer", "9"); + PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-4.75"); + PosLoyalty.check.orderTotalIs("62.27"); + PosLoyalty.do.enterCode("5678"); + PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-15.30"); + PosLoyalty.check.orderTotalIs("46.97"); + PosLoyalty.exec.removeRewardLine("Free Product"); + PosLoyalty.check.orderTotalIs("62.27"); + PosLoyalty.exec.finalizeOrder("Cash", "90"); + + // specific product discount + // applied programs: + // - on cheapest product + // - on specific products + ProductScreen.exec.addOrderline("Magnetic Board", "10"); // 1.98 + ProductScreen.exec.addOrderline("Desk Organizer", "3"); // 5.1 + ProductScreen.exec.addOrderline("Letter Tray", "4"); // 4.8 tax 10% + PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-1.78"); + PosLoyalty.check.orderTotalIs("54.44"); + PosLoyalty.do.enterCode("promocode"); + PosLoyalty.check.hasRewardLine("50% on specific products", "-16.66"); // 17.55 - 1.78*0.5 + PosLoyalty.check.orderTotalIs("37.78"); + PosLoyalty.exec.finalizeOrder("Cash", "50"); + return getSteps(); + } + }); -// --- PoS Loyalty Tour Basic Part 2 --- -// Using the coupons generated from PosLoyaltyTour1. -startSteps(); - -ProductScreen.do.clickHomeCategory(); - -// Test that global discount and cheapest product discounts can be accumulated. -// Applied programs: -// - global discount -// - on cheapest discount -ProductScreen.exec.addOrderline("Desk Organizer", "10"); // 5.1 -PosLoyalty.check.hasRewardLine("on the cheapest product", "-4.59"); -ProductScreen.exec.addOrderline("Letter Tray", "4"); // 4.8 tax 10% -PosLoyalty.check.hasRewardLine("on the cheapest product", "-4.75"); -PosLoyalty.do.enterCode("123456"); -PosLoyalty.check.hasRewardLine("10% on your order", "-5.10"); -PosLoyalty.check.hasRewardLine("10% on your order", "-1.64"); -PosLoyalty.check.orderTotalIs("60.63"); //SUBTOTAL -PosLoyalty.exec.finalizeOrder("Cash", "70"); - -// Scanning coupon twice. -// Also apply global discount on top of free product to check if the -// calculated discount is correct. -// Applied programs: -// - coupon program (free product) -// - global discount -// - on cheapest discount -ProductScreen.exec.addOrderline("Desk Organizer", "11"); // 5.1 per item -PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-4.59"); -PosLoyalty.check.orderTotalIs("51.51"); -// add global discount and the discount will be replaced -PosLoyalty.do.enterCode("345678"); -PosLoyalty.check.hasRewardLine("10% on your order", "-5.15"); -// add free product coupon (for qty=11, free=4) -// the discount should change after having free products -// it should go back to cheapest discount as it is higher -PosLoyalty.do.enterCode("5678"); -PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-20.40"); -PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-4.59"); -// set quantity to 18 -// free qty stays the same since the amount of points on the card only allows for 4 free products -ProductScreen.do.pressNumpad("Backspace 8"); -PosLoyalty.check.hasRewardLine("10% on your order", "-6.68"); -PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-20.40"); -// scan the code again and check notification -PosLoyalty.do.enterCode("5678"); -PosLoyalty.check.orderTotalIs("60.13"); -PosLoyalty.exec.finalizeOrder("Cash", "65"); - -// Specific products discount (with promocode) and free product (1357) -// Applied programs: -// - discount on specific products -// - free product -ProductScreen.exec.addOrderline("Desk Organizer", "6"); // 5.1 per item -PosLoyalty.check.hasRewardLine("on the cheapest product", "-4.59"); -PosLoyalty.exec.removeRewardLine("90% on the cheapest product"); -PosLoyalty.do.enterCode("promocode"); -PosLoyalty.check.hasRewardLine("50% on specific products", "-15.30"); -PosLoyalty.do.enterCode("1357"); -PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-10.20"); -PosLoyalty.check.hasRewardLine("50% on specific products", "-10.20"); -PosLoyalty.check.orderTotalIs("10.20"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); - -// Check reset program -// Enter two codes and reset the programs. -// The codes should be checked afterwards. They should return to new. -// Applied programs: -// - cheapest product -ProductScreen.exec.addOrderline("Monitor Stand", "6"); // 3.19 per item -PosLoyalty.do.enterCode("098765"); -PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-2.87"); -PosLoyalty.check.hasRewardLine("10% on your order", "-1.63"); -PosLoyalty.check.orderTotalIs("14.64"); -PosLoyalty.exec.removeRewardLine("90% on the cheapest product"); -PosLoyalty.check.hasRewardLine("10% on your order", "-1.91"); -PosLoyalty.check.orderTotalIs("17.23"); -PosLoyalty.do.resetActivePrograms(); -PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-2.87"); -PosLoyalty.check.orderTotalIs("16.27"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); + +registry + .category("web_tour.tours") + .add("PosLoyaltyTour2", { + test: true, + url: "/pos/web", + steps: () => { + // --- PoS Loyalty Tour Basic Part 2 --- + // Using the coupons generated from PosLoyaltyTour1. + startSteps(); + + ProductScreen.do.clickHomeCategory(); + + // Test that global discount and cheapest product discounts can be accumulated. + // Applied programs: + // - global discount + // - on cheapest discount + ProductScreen.exec.addOrderline("Desk Organizer", "10"); // 5.1 + PosLoyalty.check.hasRewardLine("on the cheapest product", "-4.59"); + ProductScreen.exec.addOrderline("Letter Tray", "4"); // 4.8 tax 10% + PosLoyalty.check.hasRewardLine("on the cheapest product", "-4.75"); + PosLoyalty.do.enterCode("123456"); + PosLoyalty.check.hasRewardLine("10% on your order", "-5.10"); + PosLoyalty.check.hasRewardLine("10% on your order", "-1.64"); + PosLoyalty.check.orderTotalIs("60.63"); //SUBTOTAL + PosLoyalty.exec.finalizeOrder("Cash", "70"); + + // Scanning coupon twice. + // Also apply global discount on top of free product to check if the + // calculated discount is correct. + // Applied programs: + // - coupon program (free product) + // - global discount + // - on cheapest discount + ProductScreen.exec.addOrderline("Desk Organizer", "11"); // 5.1 per item + PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-4.59"); + PosLoyalty.check.orderTotalIs("51.51"); + // add global discount and the discount will be replaced + PosLoyalty.do.enterCode("345678"); + PosLoyalty.check.hasRewardLine("10% on your order", "-5.15"); + // add free product coupon (for qty=11, free=4) + // the discount should change after having free products + // it should go back to cheapest discount as it is higher + PosLoyalty.do.enterCode("5678"); + PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-20.40"); + PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-4.59"); + // set quantity to 18 + // free qty stays the same since the amount of points on the card only allows for 4 free products + ProductScreen.do.pressNumpad("Backspace 8"); + PosLoyalty.check.hasRewardLine("10% on your order", "-6.68"); + PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-20.40"); + // scan the code again and check notification + PosLoyalty.do.enterCode("5678"); + PosLoyalty.check.orderTotalIs("60.13"); + PosLoyalty.exec.finalizeOrder("Cash", "65"); + + // Specific products discount (with promocode) and free product (1357) + // Applied programs: + // - discount on specific products + // - free product + ProductScreen.exec.addOrderline("Desk Organizer", "6"); // 5.1 per item + PosLoyalty.check.hasRewardLine("on the cheapest product", "-4.59"); + PosLoyalty.exec.removeRewardLine("90% on the cheapest product"); + PosLoyalty.do.enterCode("promocode"); + PosLoyalty.check.hasRewardLine("50% on specific products", "-15.30"); + PosLoyalty.do.enterCode("1357"); + PosLoyalty.check.hasRewardLine("Free Product - Desk Organizer", "-10.20"); + PosLoyalty.check.hasRewardLine("50% on specific products", "-10.20"); + PosLoyalty.check.orderTotalIs("10.20"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + + // Check reset program + // Enter two codes and reset the programs. + // The codes should be checked afterwards. They should return to new. + // Applied programs: + // - cheapest product + ProductScreen.exec.addOrderline("Monitor Stand", "6"); // 3.19 per item + PosLoyalty.do.enterCode("098765"); + PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-2.87"); + PosLoyalty.check.hasRewardLine("10% on your order", "-1.63"); + PosLoyalty.check.orderTotalIs("14.64"); + PosLoyalty.exec.removeRewardLine("90% on the cheapest product"); + PosLoyalty.check.hasRewardLine("10% on your order", "-1.91"); + PosLoyalty.check.orderTotalIs("17.23"); + PosLoyalty.do.resetActivePrograms(); + PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-2.87"); + PosLoyalty.check.orderTotalIs("16.27"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + return getSteps(); + } + }); + +registry + .category("web_tour.tours") + .add("PosLoyaltyTour3", { + test: true, + url: "/pos/web", + steps: () => { + // --- PoS Loyalty Tour Basic Part 3 --- + + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + ProductScreen.do.clickDisplayedProduct("Promo Product"); + PosLoyalty.check.orderTotalIs("34.50"); + ProductScreen.do.clickDisplayedProduct("Product B"); + PosLoyalty.check.hasRewardLine("100% on specific products", "25.00"); + ProductScreen.do.clickDisplayedProduct("Product A"); + PosLoyalty.check.hasRewardLine("100% on specific products", "15.00"); + PosLoyalty.check.orderTotalIs("34.50"); + ProductScreen.do.clickDisplayedProduct("Product A"); + PosLoyalty.check.hasRewardLine("100% on specific products", "21.82"); + PosLoyalty.check.hasRewardLine("100% on specific products", "18.18"); + PosLoyalty.check.orderTotalIs("49.50"); + + return getSteps(); + } + }); + +registry + .category("web_tour.tours") + .add("PosLoyaltyTour4", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + ProductScreen.exec.addOrderline("Test Product 1", "1"); + ProductScreen.exec.addOrderline("Test Product 2", "1"); + ProductScreen.do.selectPriceList("Public Pricelist"); + PosLoyalty.do.enterCode("abcda"); + PosLoyalty.check.orderTotalIs("0.00"); + ProductScreen.do.selectPriceList("Test multi-currency"); + PosLoyalty.check.orderTotalIs("0.00"); + return getSteps(); + } + }); registry .category("web_tour.tours") - .add("PosLoyaltyTour2", { test: true, url: "/pos/web", steps: getSteps() }); - -// --- PoS Loyalty Tour Basic Part 3 --- - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); - -ProductScreen.do.clickDisplayedProduct("Promo Product"); -PosLoyalty.check.orderTotalIs("34.50"); -ProductScreen.do.clickDisplayedProduct("Product B"); -PosLoyalty.check.hasRewardLine("100% on specific products", "25.00"); -ProductScreen.do.clickDisplayedProduct("Product A"); -PosLoyalty.check.hasRewardLine("100% on specific products", "15.00"); -PosLoyalty.check.orderTotalIs("34.50"); -ProductScreen.do.clickDisplayedProduct("Product A"); -PosLoyalty.check.hasRewardLine("100% on specific products", "21.82"); -PosLoyalty.check.hasRewardLine("100% on specific products", "18.18"); -PosLoyalty.check.orderTotalIs("49.50"); - -registry - .category("web_tour.tours") - .add("PosLoyaltyTour3", { test: true, url: "/pos/web", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); - -ProductScreen.exec.addOrderline("Test Product 1", "1"); -ProductScreen.exec.addOrderline("Test Product 2", "1"); -ProductScreen.do.selectPriceList("Public Pricelist"); -PosLoyalty.do.enterCode("abcda"); -PosLoyalty.check.orderTotalIs("0.00"); -ProductScreen.do.selectPriceList("Test multi-currency"); -PosLoyalty.check.orderTotalIs("0.00"); - -registry - .category("web_tour.tours") - .add("PosLoyaltyTour4", { test: true, url: "/pos/web", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.clickHomeCategory(); - -ProductScreen.exec.addOrderline("Test Product 1", "1.00", "100"); -PosLoyalty.do.clickDiscountButton(); -PosLoyalty.do.clickConfirmButton(); -ProductScreen.check.totalAmountIs("92.00"); - -registry - .category("web_tour.tours") - .add("PosCouponTour5", { test: true, url: "/pos/web", steps: getSteps() }); + .add("PosCouponTour5", { + test: true, + url: "/pos/web", + steps: () => { + startSteps(); + + ProductScreen.do.clickHomeCategory(); + + ProductScreen.exec.addOrderline("Test Product 1", "1.00", "100"); + PosLoyalty.do.clickDiscountButton(); + PosLoyalty.do.clickConfirmButton(); + ProductScreen.check.totalAmountIs("92.00"); + return getSteps(); + } + }); diff --git a/addons/pos_loyalty/static/src/tours/PosLoyaltyValidityTour.js b/addons/pos_loyalty/static/src/tours/PosLoyaltyValidityTour.js index 95df36ce9c4..54d65dc3ce9 100644 --- a/addons/pos_loyalty/static/src/tours/PosLoyaltyValidityTour.js +++ b/addons/pos_loyalty/static/src/tours/PosLoyaltyValidityTour.js @@ -5,32 +5,46 @@ import { ProductScreen } from "@point_of_sale/../tests/tours/helpers/ProductScre import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -// First tour should not get any automatic rewards -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickHomeCategory(); - -// Not valid -> date -ProductScreen.exec.addOrderline("Whiteboard Pen", "5"); -PosLoyalty.check.checkNoClaimableRewards(); -PosLoyalty.exec.finalizeOrder("Cash", "20"); - -registry.category("web_tour.tours").add("PosLoyaltyValidity1", { test: true, url: "/pos/web", steps: getSteps() }); - -// Second tour -startSteps(); - -ProductScreen.do.clickHomeCategory(); - -// Valid -ProductScreen.exec.addOrderline("Whiteboard Pen", "5"); -PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-2.88"); -PosLoyalty.exec.finalizeOrder("Cash", "20"); - -// Not valid -> usage -ProductScreen.exec.addOrderline("Whiteboard Pen", "5"); -PosLoyalty.check.checkNoClaimableRewards(); -PosLoyalty.exec.finalizeOrder("Cash", "20"); - -registry.category("web_tour.tours").add("PosLoyaltyValidity2", { test: true, url: "/pos/web", steps: getSteps() }); +registry + .category("web_tour.tours") + .add("PosLoyaltyValidity1", { + test: true, + url: "/pos/web", + steps: () => { + // First tour should not get any automatic rewards + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickHomeCategory(); + + // Not valid -> date + ProductScreen.exec.addOrderline("Whiteboard Pen", "5"); + PosLoyalty.check.checkNoClaimableRewards(); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + return getSteps(); + } + }); + +registry + .category("web_tour.tours") + .add("PosLoyaltyValidity2", { + test: true, + url: "/pos/web", + steps: () => { + // Second tour + startSteps(); + + ProductScreen.do.clickHomeCategory(); + + // Valid + ProductScreen.exec.addOrderline("Whiteboard Pen", "5"); + PosLoyalty.check.hasRewardLine("90% on the cheapest product", "-2.88"); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + + // Not valid -> usage + ProductScreen.exec.addOrderline("Whiteboard Pen", "5"); + PosLoyalty.check.checkNoClaimableRewards(); + PosLoyalty.exec.finalizeOrder("Cash", "20"); + return getSteps(); + } + }); diff --git a/addons/pos_online_payment/static/tests/tours/OnlinePayment.tour.js b/addons/pos_online_payment/static/tests/tours/OnlinePayment.tour.js index 85ad18ce414..79b521f191e 100644 --- a/addons/pos_online_payment/static/tests/tours/OnlinePayment.tour.js +++ b/addons/pos_online_payment/static/tests/tours/OnlinePayment.tour.js @@ -9,111 +9,128 @@ import { ErrorPopup } from "@point_of_sale/../tests/tours/helpers/ErrorPopupTour import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.exec.addOrderline("Letter Tray", "10"); -ProductScreen.check.selectedOrderlineHas("Letter Tray", "10.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.check.totalIs("48.0"); -PaymentScreen.check.emptyPaymentlines("48.0"); - -PaymentScreen.do.clickPaymentMethod("Online payment"); -PaymentScreen.do.enterPaymentLineAmount("Online payment", "48"); -PaymentScreen.check.selectedPaymentlineHas("Online payment", "48.0"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(true); -PaymentScreen.do.clickValidate(); -OnlinePaymentPopup.check.isShown(); -OnlinePaymentPopup.check.amountIs("48.0"); -OnlinePaymentPopup.do.fakeOnlinePaymentPaidData(); -OnlinePaymentPopup.check.isNotShown(); -ReceiptScreen.check.isShown(); -ReceiptScreen.check.receiptIsThere(); +registry + .category("web_tour.tours") + .add("OnlinePaymentLocalFakePaidDataTour", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.exec.addOrderline("Letter Tray", "10"); + ProductScreen.check.selectedOrderlineHas("Letter Tray", "10.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.check.totalIs("48.0"); + PaymentScreen.check.emptyPaymentlines("48.0"); + + PaymentScreen.do.clickPaymentMethod("Online payment"); + PaymentScreen.do.enterPaymentLineAmount("Online payment", "48"); + PaymentScreen.check.selectedPaymentlineHas("Online payment", "48.0"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(true); + PaymentScreen.do.clickValidate(); + OnlinePaymentPopup.check.isShown(); + OnlinePaymentPopup.check.amountIs("48.0"); + OnlinePaymentPopup.do.fakeOnlinePaymentPaidData(); + OnlinePaymentPopup.check.isNotShown(); + ReceiptScreen.check.isShown(); + ReceiptScreen.check.receiptIsThere(); + return getSteps() + } + }); registry .category("web_tour.tours") - .add("OnlinePaymentLocalFakePaidDataTour", { test: true, url: "/pos/ui", steps: getSteps() }); + .add("OnlinePaymentErrorsTour", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.exec.addOrderline("Letter Tray", "10"); + ProductScreen.check.selectedOrderlineHas("Letter Tray", "10.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.check.totalIs("48.0"); + PaymentScreen.check.emptyPaymentlines("48.0"); + + PaymentScreen.do.clickPaymentMethod("Online payment"); + PaymentScreen.do.enterPaymentLineAmount("Online payment", "47"); + PaymentScreen.check.selectedPaymentlineHas("Online payment", "47.0"); + PaymentScreen.check.remainingIs("1.0"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(false); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.enterPaymentLineAmount("Cash", "2"); + PaymentScreen.check.selectedPaymentlineHas("Cash", "2.0"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("1.0"); + PaymentScreen.check.validateButtonIsHighlighted(true); + PaymentScreen.do.clickValidate(); + ErrorPopup.check.isShown(); + ErrorPopup.do.clickConfirm(); + PaymentScreen.do.clickPaymentline("Online payment", "47.0"); + PaymentScreen.do.clickPaymentlineDelButton("Online payment", "47.0"); + PaymentScreen.do.clickPaymentMethod("Online payment"); + PaymentScreen.check.selectedPaymentlineHas("Online payment", "46.0"); + PaymentScreen.do.clickPaymentMethod("Online payment"); + PaymentScreen.check.selectedPaymentlineHas("Online payment", "0.0"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(true); + PaymentScreen.do.clickValidate(); + ErrorPopup.check.isShown(); + ErrorPopup.do.clickConfirm(); + PaymentScreen.do.clickPaymentline("Online payment", "0.0"); + PaymentScreen.do.clickPaymentlineDelButton("Online payment", "0.0"); + PaymentScreen.do.clickPaymentline("Cash", "2.0"); + PaymentScreen.do.enterPaymentLineAmount("Cash", "3"); + PaymentScreen.check.selectedPaymentlineHas("Cash", "3.0"); + PaymentScreen.do.clickPaymentMethod("Online payment"); + PaymentScreen.check.selectedPaymentlineHas("Online payment", "-1.0"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(true); + PaymentScreen.do.clickValidate(); + ErrorPopup.check.isShown(); + ErrorPopup.do.clickConfirm(); -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.exec.addOrderline("Letter Tray", "10"); -ProductScreen.check.selectedOrderlineHas("Letter Tray", "10.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.check.totalIs("48.0"); -PaymentScreen.check.emptyPaymentlines("48.0"); - -PaymentScreen.do.clickPaymentMethod("Online payment"); -PaymentScreen.do.enterPaymentLineAmount("Online payment", "47"); -PaymentScreen.check.selectedPaymentlineHas("Online payment", "47.0"); -PaymentScreen.check.remainingIs("1.0"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(false); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.enterPaymentLineAmount("Cash", "2"); -PaymentScreen.check.selectedPaymentlineHas("Cash", "2.0"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("1.0"); -PaymentScreen.check.validateButtonIsHighlighted(true); -PaymentScreen.do.clickValidate(); -ErrorPopup.check.isShown(); -ErrorPopup.do.clickConfirm(); -PaymentScreen.do.clickPaymentline("Online payment", "47.0"); -PaymentScreen.do.clickPaymentlineDelButton("Online payment", "47.0"); -PaymentScreen.do.clickPaymentMethod("Online payment"); -PaymentScreen.check.selectedPaymentlineHas("Online payment", "46.0"); -PaymentScreen.do.clickPaymentMethod("Online payment"); -PaymentScreen.check.selectedPaymentlineHas("Online payment", "0.0"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(true); -PaymentScreen.do.clickValidate(); -ErrorPopup.check.isShown(); -ErrorPopup.do.clickConfirm(); -PaymentScreen.do.clickPaymentline("Online payment", "0.0"); -PaymentScreen.do.clickPaymentlineDelButton("Online payment", "0.0"); -PaymentScreen.do.clickPaymentline("Cash", "2.0"); -PaymentScreen.do.enterPaymentLineAmount("Cash", "3"); -PaymentScreen.check.selectedPaymentlineHas("Cash", "3.0"); -PaymentScreen.do.clickPaymentMethod("Online payment"); -PaymentScreen.check.selectedPaymentlineHas("Online payment", "-1.0"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(true); -PaymentScreen.do.clickValidate(); -ErrorPopup.check.isShown(); -ErrorPopup.do.clickConfirm(); + return getSteps(); + } + }); registry .category("web_tour.tours") - .add("OnlinePaymentErrorsTour", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.exec.addOrderline("Letter Tray", "10"); -ProductScreen.check.selectedOrderlineHas("Letter Tray", "10.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.check.totalIs("48.0"); -PaymentScreen.check.emptyPaymentlines("48.0"); - -PaymentScreen.do.clickPaymentMethod("Online payment"); -PaymentScreen.do.enterPaymentLineAmount("Online payment", "48"); -PaymentScreen.check.selectedPaymentlineHas("Online payment", "48.0"); -PaymentScreen.check.remainingIs("0.0"); -PaymentScreen.check.changeIs("0.0"); -PaymentScreen.check.validateButtonIsHighlighted(true); -PaymentScreen.do.clickValidate(); -OnlinePaymentPopup.check.isShown(); -OnlinePaymentPopup.check.amountIs("48.0"); -OnlinePaymentPopup.check.waitForOnlinePayment(); -OnlinePaymentPopup.check.isNotShown(); -ReceiptScreen.check.isShown(); -ReceiptScreen.check.receiptIsThere(); -Chrome.do.closeSession(); - -registry - .category("web_tour.tours") - .add("OnlinePaymentServerFakePaymentTour", { test: true, url: "/pos/ui", steps: getSteps() }); + .add("OnlinePaymentServerFakePaymentTour", { + test: true, + url: "/pos/ui", + steps: () => { + + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.exec.addOrderline("Letter Tray", "10"); + ProductScreen.check.selectedOrderlineHas("Letter Tray", "10.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.check.totalIs("48.0"); + PaymentScreen.check.emptyPaymentlines("48.0"); + + PaymentScreen.do.clickPaymentMethod("Online payment"); + PaymentScreen.do.enterPaymentLineAmount("Online payment", "48"); + PaymentScreen.check.selectedPaymentlineHas("Online payment", "48.0"); + PaymentScreen.check.remainingIs("0.0"); + PaymentScreen.check.changeIs("0.0"); + PaymentScreen.check.validateButtonIsHighlighted(true); + PaymentScreen.do.clickValidate(); + OnlinePaymentPopup.check.isShown(); + OnlinePaymentPopup.check.amountIs("48.0"); + OnlinePaymentPopup.check.waitForOnlinePayment(); + OnlinePaymentPopup.check.isNotShown(); + ReceiptScreen.check.isShown(); + ReceiptScreen.check.receiptIsThere(); + Chrome.do.closeSession(); + return getSteps(); + } + }); diff --git a/addons/pos_restaurant/static/tests/tours/ControlButtons.tour.js b/addons/pos_restaurant/static/tests/tours/ControlButtons.tour.js index 2416de9a8d9..ea2d09050f5 100644 --- a/addons/pos_restaurant/static/tests/tours/ControlButtons.tour.js +++ b/addons/pos_restaurant/static/tests/tours/ControlButtons.tour.js @@ -10,51 +10,59 @@ import { BillScreen } from "@pos_restaurant/../tests/tours/helpers/BillScreenTou import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -// signal to start generating steps -// when finished, steps can be taken from getSteps -startSteps(); +registry + .category("web_tour.tours") + .add("ControlButtonsTour", { + test: true, + url: "/pos/ui", + steps: () => { + // signal to start generating steps + // when finished, steps can be taken from getSteps + startSteps(); + + // Test TransferOrderButton + FloorScreen.do.clickTable("2"); + ProductScreen.exec.addOrderline("Water", "5", "2", "10.0"); + ProductScreen.do.clickTransferButton(); + FloorScreen.do.clickTable("4"); + ProductScreen.do.clickOrderline("Water", "5", "2"); + Chrome.do.backToFloor(); + FloorScreen.do.clickTable("2"); + ProductScreen.check.orderIsEmpty(); + Chrome.do.backToFloor(); + FloorScreen.do.clickTable("4"); + ProductScreen.do.clickOrderline("Water", "5", "2"); + + // Test SplitBillButton + ProductScreen.do.clickSplitBillButton(); + SplitBillScreen.do.clickBack(); + + // Test OrderlineNoteButton + ProductScreen.do.clickNoteButton(); + TextAreaPopup.check.isShown(); + TextAreaPopup.do.inputText("test note"); + TextAreaPopup.do.clickConfirm(); + ProductScreen.check.orderlineHasNote("Water", "5", "test note"); + ProductScreen.exec.addOrderline("Water", "8", "1", "8.0"); + + // Test PrintBillButton + ProductScreen.do.clickPrintBillButton(); + BillScreen.check.isShown(); + BillScreen.do.clickOk(); + + // Test GuestButton + ProductScreen.do.clickGuestButton(); + NumberPopup.do.enterValue("15"); + NumberPopup.check.inputShownIs("15"); + NumberPopup.do.clickConfirm(); + ProductScreen.check.guestNumberIs("15"); + + ProductScreen.do.clickGuestButton(); + NumberPopup.do.enterValue("5"); + NumberPopup.check.inputShownIs("5"); + NumberPopup.do.clickConfirm(); + ProductScreen.check.guestNumberIs("5"); -// Test TransferOrderButton -FloorScreen.do.clickTable("2"); -ProductScreen.exec.addOrderline("Water", "5", "2", "10.0"); -ProductScreen.do.clickTransferButton(); -FloorScreen.do.clickTable("4"); -ProductScreen.do.clickOrderline("Water", "5", "2"); -Chrome.do.backToFloor(); -FloorScreen.do.clickTable("2"); -ProductScreen.check.orderIsEmpty(); -Chrome.do.backToFloor(); -FloorScreen.do.clickTable("4"); -ProductScreen.do.clickOrderline("Water", "5", "2"); - -// Test SplitBillButton -ProductScreen.do.clickSplitBillButton(); -SplitBillScreen.do.clickBack(); - -// Test OrderlineNoteButton -ProductScreen.do.clickNoteButton(); -TextAreaPopup.check.isShown(); -TextAreaPopup.do.inputText("test note"); -TextAreaPopup.do.clickConfirm(); -ProductScreen.check.orderlineHasNote("Water", "5", "test note"); -ProductScreen.exec.addOrderline("Water", "8", "1", "8.0"); - -// Test PrintBillButton -ProductScreen.do.clickPrintBillButton(); -BillScreen.check.isShown(); -BillScreen.do.clickOk(); - -// Test GuestButton -ProductScreen.do.clickGuestButton(); -NumberPopup.do.enterValue("15"); -NumberPopup.check.inputShownIs("15"); -NumberPopup.do.clickConfirm(); -ProductScreen.check.guestNumberIs("15"); - -ProductScreen.do.clickGuestButton(); -NumberPopup.do.enterValue("5"); -NumberPopup.check.inputShownIs("5"); -NumberPopup.do.clickConfirm(); -ProductScreen.check.guestNumberIs("5"); - -registry.category("web_tour.tours").add("ControlButtonsTour", { test: true, url: "/pos/ui", steps: getSteps() }); + return getSteps(); + } + }); diff --git a/addons/pos_restaurant/static/tests/tours/FloorScreen.tour.js b/addons/pos_restaurant/static/tests/tours/FloorScreen.tour.js index 6fa646ae471..7b806c72ec2 100644 --- a/addons/pos_restaurant/static/tests/tours/FloorScreen.tour.js +++ b/addons/pos_restaurant/static/tests/tours/FloorScreen.tour.js @@ -8,114 +8,121 @@ import { ProductScreen } from "@pos_restaurant/../tests/tours/helpers/ProductScr import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -// signal to start generating steps -// when finished, steps can be taken from getSteps -startSteps(); - -// check floors if they contain their corresponding tables -FloorScreen.check.selectedFloorIs("Main Floor"); -FloorScreen.check.hasTable("2"); -FloorScreen.check.hasTable("4"); -FloorScreen.check.hasTable("5"); -FloorScreen.do.clickFloor("Second Floor"); -FloorScreen.check.hasTable("3"); -FloorScreen.check.hasTable("1"); - -// clicking table in active mode does not open product screen -// instead, table is selected -FloorScreen.do.clickEdit(); -FloorScreen.do.clickTable("3"); -FloorScreen.check.selectedTableIs("3"); -FloorScreen.do.clickTable("1"); -FloorScreen.check.selectedTableIs("1"); - -// test add table -FloorScreen.do.clickFloor("Main Floor"); -FloorScreen.do.clickAddTable(); -FloorScreen.check.selectedTableIs("1"); -FloorScreen.do.clickRename(); -TextInputPopup.check.isShown(); -TextInputPopup.do.inputText("100"); -TextInputPopup.do.clickConfirm(); -FloorScreen.do.clickTable("100"); -FloorScreen.check.selectedTableIs("100"); - -// test duplicate table -FloorScreen.do.clickDuplicate(); -// the name is the first number available on the floor -FloorScreen.check.selectedTableIs("1"); -FloorScreen.do.clickRename(); -TextInputPopup.check.isShown(); -TextInputPopup.do.inputText("1111"); -TextInputPopup.do.clickConfirm(); -FloorScreen.do.clickTable("1111"); -FloorScreen.check.selectedTableIs("1111"); - -// switch floor, switch back and check if -// the new tables are still there -FloorScreen.do.clickFloor("Second Floor"); -FloorScreen.check.hasTable("3"); -FloorScreen.check.hasTable("1"); - -//test duplicate multiple tables -FloorScreen.do.clickTable("1"); -FloorScreen.check.selectedTableIs("1"); -FloorScreen.do.ctrlClickTable("3"); -FloorScreen.check.selectedTableIs("3"); -FloorScreen.do.clickDuplicate(); -FloorScreen.check.selectedTableIs("2"); -FloorScreen.check.selectedTableIs("4"); - -//test delete multiple tables -FloorScreen.do.clickTrash(); -Chrome.do.confirmPopup(); - -FloorScreen.do.clickFloor("Main Floor"); -FloorScreen.check.hasTable("2"); -FloorScreen.check.hasTable("4"); -FloorScreen.check.hasTable("5"); -FloorScreen.check.hasTable("100"); -FloorScreen.check.hasTable("1111"); - -// test delete table -FloorScreen.do.clickTable("2"); -FloorScreen.check.selectedTableIs("2"); -FloorScreen.do.clickTrash(); -Chrome.do.confirmPopup(); - -// change number of seats -FloorScreen.do.clickTable("4"); -FloorScreen.check.selectedTableIs("4"); -FloorScreen.do.clickSeats(); -NumberPopup.do.pressNumpad("Backspace 9"); -NumberPopup.do.fillPopupValue("9"); -NumberPopup.check.inputShownIs("9"); -NumberPopup.do.clickConfirm(); -FloorScreen.check.tableSeatIs("4", "9"); - -// change number of seat when the input is already selected -FloorScreen.do.clickTable("4"); -FloorScreen.check.selectedTableIs("4"); -FloorScreen.do.clickSeats(); -NumberPopup.do.enterValue("15"); -NumberPopup.check.inputShownIs("15"); -NumberPopup.do.clickConfirm(); -FloorScreen.check.tableSeatIs("4", "15"); - -// change shape -FloorScreen.do.clickTable("4"); -FloorScreen.do.changeShapeTo("round"); - -// Opening product screen in main floor should go back to main floor -FloorScreen.do.closeEdit(); -FloorScreen.check.tableIsNotSelected("4"); -FloorScreen.do.clickTable("4"); -ProductScreen.check.isShown(); -Chrome.do.backToFloor(); - -// Opening product screen in second floor should go back to second floor -FloorScreen.do.clickFloor("Second Floor"); -FloorScreen.check.hasTable("3"); -FloorScreen.do.clickTable("3"); - -registry.category("web_tour.tours").add("FloorScreenTour", { test: true, url: "/pos/ui", steps: getSteps() }); +registry + .category("web_tour.tours") + .add("FloorScreenTour", { + test: true, + url: "/pos/ui", + steps: () => { + // signal to start generating steps + // when finished, steps can be taken from getSteps + startSteps(); + + // check floors if they contain their corresponding tables + FloorScreen.check.selectedFloorIs("Main Floor"); + FloorScreen.check.hasTable("2"); + FloorScreen.check.hasTable("4"); + FloorScreen.check.hasTable("5"); + FloorScreen.do.clickFloor("Second Floor"); + FloorScreen.check.hasTable("3"); + FloorScreen.check.hasTable("1"); + + // clicking table in active mode does not open product screen + // instead, table is selected + FloorScreen.do.clickEdit(); + FloorScreen.do.clickTable("3"); + FloorScreen.check.selectedTableIs("3"); + FloorScreen.do.clickTable("1"); + FloorScreen.check.selectedTableIs("1"); + + // test add table + FloorScreen.do.clickFloor("Main Floor"); + FloorScreen.do.clickAddTable(); + FloorScreen.check.selectedTableIs("1"); + FloorScreen.do.clickRename(); + TextInputPopup.check.isShown(); + TextInputPopup.do.inputText("100"); + TextInputPopup.do.clickConfirm(); + FloorScreen.do.clickTable("100"); + FloorScreen.check.selectedTableIs("100"); + + // test duplicate table + FloorScreen.do.clickDuplicate(); + // the name is the first number available on the floor + FloorScreen.check.selectedTableIs("1"); + FloorScreen.do.clickRename(); + TextInputPopup.check.isShown(); + TextInputPopup.do.inputText("1111"); + TextInputPopup.do.clickConfirm(); + FloorScreen.do.clickTable("1111"); + FloorScreen.check.selectedTableIs("1111"); + + // switch floor, switch back and check if + // the new tables are still there + FloorScreen.do.clickFloor("Second Floor"); + FloorScreen.check.hasTable("3"); + FloorScreen.check.hasTable("1"); + + //test duplicate multiple tables + FloorScreen.do.clickTable("1"); + FloorScreen.check.selectedTableIs("1"); + FloorScreen.do.ctrlClickTable("3"); + FloorScreen.check.selectedTableIs("3"); + FloorScreen.do.clickDuplicate(); + FloorScreen.check.selectedTableIs("2"); + FloorScreen.check.selectedTableIs("4"); + + //test delete multiple tables + FloorScreen.do.clickTrash(); + Chrome.do.confirmPopup(); + + FloorScreen.do.clickFloor("Main Floor"); + FloorScreen.check.hasTable("2"); + FloorScreen.check.hasTable("4"); + FloorScreen.check.hasTable("5"); + FloorScreen.check.hasTable("100"); + FloorScreen.check.hasTable("1111"); + + // test delete table + FloorScreen.do.clickTable("2"); + FloorScreen.check.selectedTableIs("2"); + FloorScreen.do.clickTrash(); + Chrome.do.confirmPopup(); + + // change number of seats + FloorScreen.do.clickTable("4"); + FloorScreen.check.selectedTableIs("4"); + FloorScreen.do.clickSeats(); + NumberPopup.do.pressNumpad("Backspace 9"); + NumberPopup.do.fillPopupValue("9"); + NumberPopup.check.inputShownIs("9"); + NumberPopup.do.clickConfirm(); + FloorScreen.check.tableSeatIs("4", "9"); + + // change number of seat when the input is already selected + FloorScreen.do.clickTable("4"); + FloorScreen.check.selectedTableIs("4"); + FloorScreen.do.clickSeats(); + NumberPopup.do.enterValue("15"); + NumberPopup.check.inputShownIs("15"); + NumberPopup.do.clickConfirm(); + FloorScreen.check.tableSeatIs("4", "15"); + + // change shape + FloorScreen.do.clickTable("4"); + FloorScreen.do.changeShapeTo("round"); + + // Opening product screen in main floor should go back to main floor + FloorScreen.do.closeEdit(); + FloorScreen.check.tableIsNotSelected("4"); + FloorScreen.do.clickTable("4"); + ProductScreen.check.isShown(); + Chrome.do.backToFloor(); + + // Opening product screen in second floor should go back to second floor + FloorScreen.do.clickFloor("Second Floor"); + FloorScreen.check.hasTable("3"); + FloorScreen.do.clickTable("3"); + return getSteps(); + } + }); diff --git a/addons/pos_restaurant/static/tests/tours/Refund.tour.js b/addons/pos_restaurant/static/tests/tours/Refund.tour.js index cc76a45f96b..0e2c9cb7c41 100644 --- a/addons/pos_restaurant/static/tests/tours/Refund.tour.js +++ b/addons/pos_restaurant/static/tests/tours/Refund.tour.js @@ -8,36 +8,44 @@ import { TicketScreen } from "@point_of_sale/../tests/tours/helpers/TicketScreen import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -// signal to start generating steps -// when finished, steps can be taken from getSteps -startSteps(); +registry + .category("web_tour.tours") + .add("RefundStayCurrentTableTour", { + test: true, + url: "/pos/ui", + steps: () => { + // signal to start generating steps + // when finished, steps can be taken from getSteps + startSteps(); + + // Create first order and pay it + FloorScreen.do.clickTable("2"); + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickDisplayedProduct("Coca-Cola"); + ProductScreen.check.selectedOrderlineHas("Coca-Cola"); + ProductScreen.do.clickDisplayedProduct("Coca-Cola"); + ProductScreen.check.selectedOrderlineHas("Coca-Cola"); + ProductScreen.do.clickDisplayedProduct("Water"); + ProductScreen.check.selectedOrderlineHas("Water"); + ProductScreen.check.totalAmountIs("6.60"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.do.clickNextOrder(); + + // Go to another table and refund one of the product + FloorScreen.do.clickTable("4"); + ProductScreen.check.orderIsEmpty(); + ProductScreen.do.clickRefund(); + TicketScreen.do.selectOrder("-0001"); + TicketScreen.do.clickOrderline("Coca-Cola"); + TicketScreen.do.pressNumpad("2"); + TicketScreen.check.toRefundTextContains("To Refund: 2.00"); + TicketScreen.do.confirmRefund(); + ProductScreen.check.isShown(); + ProductScreen.check.selectedOrderlineHas("Coca-Cola"); + ProductScreen.check.totalAmountIs("-4.40"); -// Create first order and pay it -FloorScreen.do.clickTable("2"); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickDisplayedProduct("Coca-Cola"); -ProductScreen.check.selectedOrderlineHas("Coca-Cola"); -ProductScreen.do.clickDisplayedProduct("Coca-Cola"); -ProductScreen.check.selectedOrderlineHas("Coca-Cola"); -ProductScreen.do.clickDisplayedProduct("Water"); -ProductScreen.check.selectedOrderlineHas("Water"); -ProductScreen.check.totalAmountIs("6.60"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.do.clickNextOrder(); - -// Go to another table and refund one of the product -FloorScreen.do.clickTable("4"); -ProductScreen.check.orderIsEmpty(); -ProductScreen.do.clickRefund(); -TicketScreen.do.selectOrder("-0001"); -TicketScreen.do.clickOrderline("Coca-Cola"); -TicketScreen.do.pressNumpad("2"); -TicketScreen.check.toRefundTextContains("To Refund: 2.00"); -TicketScreen.do.confirmRefund(); -ProductScreen.check.isShown(); -ProductScreen.check.selectedOrderlineHas("Coca-Cola"); -ProductScreen.check.totalAmountIs("-4.40"); - -registry.category("web_tour.tours").add("RefundStayCurrentTableTour", { test: true, url: "/pos/ui", steps: getSteps() }); + return getSteps(); + } + }); diff --git a/addons/pos_restaurant/static/tests/tours/SplitBillScreen.tour.js b/addons/pos_restaurant/static/tests/tours/SplitBillScreen.tour.js index c25cd870346..0be920a8d2e 100644 --- a/addons/pos_restaurant/static/tests/tours/SplitBillScreen.tour.js +++ b/addons/pos_restaurant/static/tests/tours/SplitBillScreen.tour.js @@ -10,108 +10,130 @@ import { TicketScreen } from "@point_of_sale/../tests/tours/helpers/TicketScreen import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -// signal to start generating steps -// when finished, steps can be taken from getSteps -startSteps(); +registry + .category("web_tour.tours") + .add("SplitBillScreenTour", { + test: true, + url: "/pos/ui", + steps: () => { + // signal to start generating steps + // when finished, steps can be taken from getSteps + startSteps(); + + FloorScreen.do.clickTable("2"); + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.exec.addOrderline("Water", "5", "2", "10.0"); + ProductScreen.exec.addOrderline("Minute Maid", "3", "2", "6.0"); + ProductScreen.exec.addOrderline("Coca-Cola", "1", "2", "2.0"); + ProductScreen.do.clickSplitBillButton(); + + // Check if the screen contains all the orderlines + SplitBillScreen.check.orderlineHas("Water", "5", "0"); + SplitBillScreen.check.orderlineHas("Minute Maid", "3", "0"); + SplitBillScreen.check.orderlineHas("Coca-Cola", "1", "0"); + + // split 3 water and 1 coca-cola + SplitBillScreen.do.clickOrderline("Water"); + SplitBillScreen.check.orderlineHas("Water", "5", "1"); + SplitBillScreen.do.clickOrderline("Water"); + SplitBillScreen.do.clickOrderline("Water"); + SplitBillScreen.check.orderlineHas("Water", "5", "3"); + SplitBillScreen.check.subtotalIs("6.0"); + SplitBillScreen.do.clickOrderline("Coca-Cola"); + SplitBillScreen.check.orderlineHas("Coca-Cola", "1", "1"); + SplitBillScreen.check.subtotalIs("8.0"); + + // click pay to split, go back to check the lines + SplitBillScreen.do.clickPay(); + PaymentScreen.do.clickBack(); + ProductScreen.do.clickOrderline("Water", "3.0"); + ProductScreen.do.clickOrderline("Coca-Cola", "1.0"); + + // go back to the original order and see if the order is changed + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectOrder("-0001"); + ProductScreen.check.isShown(); + ProductScreen.do.clickOrderline("Water", "2.0"); + ProductScreen.do.clickOrderline("Minute Maid", "3.0"); + return getSteps(); + } + }); -FloorScreen.do.clickTable("2"); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.exec.addOrderline("Water", "5", "2", "10.0"); -ProductScreen.exec.addOrderline("Minute Maid", "3", "2", "6.0"); -ProductScreen.exec.addOrderline("Coca-Cola", "1", "2", "2.0"); -ProductScreen.do.clickSplitBillButton(); +registry + .category("web_tour.tours") + .add("SplitBillScreenTour2", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + FloorScreen.do.clickTable("2"); + ProductScreen.exec.addOrderline("Water", "1", "2.0"); + ProductScreen.exec.addOrderline("Minute Maid", "1", "2.0"); + ProductScreen.exec.addOrderline("Coca-Cola", "1", "2.0"); + Chrome.do.backToFloor(); + FloorScreen.do.clickTable("2"); + ProductScreen.do.clickSplitBillButton(); + + SplitBillScreen.do.clickOrderline("Water"); + SplitBillScreen.check.orderlineHas("Water", "1", "1"); + SplitBillScreen.do.clickOrderline("Coca-Cola"); + SplitBillScreen.check.orderlineHas("Coca-Cola", "1", "1"); + SplitBillScreen.do.clickPay(); + PaymentScreen.do.clickBack(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectOrder("-0002"); + ProductScreen.do.clickOrderline("Water", "1.0"); + ProductScreen.do.clickOrderline("Coca-Cola", "1.0"); + ProductScreen.check.totalAmountIs("4.00"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectOrder("-0001"); + ProductScreen.do.clickOrderline("Minute Maid", "1.0"); + ProductScreen.check.totalAmountIs("2.00"); + return getSteps(); + } + }); -// Check if the screen contains all the orderlines -SplitBillScreen.check.orderlineHas("Water", "5", "0"); -SplitBillScreen.check.orderlineHas("Minute Maid", "3", "0"); -SplitBillScreen.check.orderlineHas("Coca-Cola", "1", "0"); +registry + .category("web_tour.tours") + .add("SplitBillScreenTour3", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + FloorScreen.do.clickTable("2"); + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.exec.addOrderline("Water", "2", "2", "4.00"); + ProductScreen.do.clickSplitBillButton(); + + // Check if the screen contains all the orderlines + SplitBillScreen.check.orderlineHas("Water", "2", "0"); + + // split 1 water + SplitBillScreen.do.clickOrderline("Water"); + SplitBillScreen.check.orderlineHas("Water", "2", "1"); + SplitBillScreen.check.subtotalIs("2.0"); + + // click pay to split, and pay + SplitBillScreen.do.clickPay(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.clickValidate(); + // Check if the receiptscreen suggests us to continue the order + ReceiptScreen.do.clickContinueOrder(); + + // Check if there is still water in the order + ProductScreen.check.isShown(); + ProductScreen.do.clickOrderline("Water", "1.0"); + ProductScreen.do.clickPayButton(true); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.clickValidate(); + // Check if there is no more order to continue + ReceiptScreen.do.clickNextOrder(); -// split 3 water and 1 coca-cola -SplitBillScreen.do.clickOrderline("Water"); -SplitBillScreen.check.orderlineHas("Water", "5", "1"); -SplitBillScreen.do.clickOrderline("Water"); -SplitBillScreen.do.clickOrderline("Water"); -SplitBillScreen.check.orderlineHas("Water", "5", "3"); -SplitBillScreen.check.subtotalIs("6.0"); -SplitBillScreen.do.clickOrderline("Coca-Cola"); -SplitBillScreen.check.orderlineHas("Coca-Cola", "1", "1"); -SplitBillScreen.check.subtotalIs("8.0"); - -// click pay to split, go back to check the lines -SplitBillScreen.do.clickPay(); -PaymentScreen.do.clickBack(); -ProductScreen.do.clickOrderline("Water", "3.0"); -ProductScreen.do.clickOrderline("Coca-Cola", "1.0"); - -// go back to the original order and see if the order is changed -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.selectOrder("-0001"); -ProductScreen.check.isShown(); -ProductScreen.do.clickOrderline("Water", "2.0"); -ProductScreen.do.clickOrderline("Minute Maid", "3.0"); - -registry.category("web_tour.tours").add("SplitBillScreenTour", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -FloorScreen.do.clickTable("2"); -ProductScreen.exec.addOrderline("Water", "1", "2.0"); -ProductScreen.exec.addOrderline("Minute Maid", "1", "2.0"); -ProductScreen.exec.addOrderline("Coca-Cola", "1", "2.0"); -Chrome.do.backToFloor(); -FloorScreen.do.clickTable("2"); -ProductScreen.do.clickSplitBillButton(); - -SplitBillScreen.do.clickOrderline("Water"); -SplitBillScreen.check.orderlineHas("Water", "1", "1"); -SplitBillScreen.do.clickOrderline("Coca-Cola"); -SplitBillScreen.check.orderlineHas("Coca-Cola", "1", "1"); -SplitBillScreen.do.clickPay(); -PaymentScreen.do.clickBack(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.selectOrder("-0002"); -ProductScreen.do.clickOrderline("Water", "1.0"); -ProductScreen.do.clickOrderline("Coca-Cola", "1.0"); -ProductScreen.check.totalAmountIs("4.00"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.selectOrder("-0001"); -ProductScreen.do.clickOrderline("Minute Maid", "1.0"); -ProductScreen.check.totalAmountIs("2.00"); - -registry.category("web_tour.tours").add("SplitBillScreenTour2", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); -FloorScreen.do.clickTable("2"); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.exec.addOrderline("Water", "2", "2", "4.00"); -ProductScreen.do.clickSplitBillButton(); - -// Check if the screen contains all the orderlines -SplitBillScreen.check.orderlineHas("Water", "2", "0"); - -// split 1 water -SplitBillScreen.do.clickOrderline("Water"); -SplitBillScreen.check.orderlineHas("Water", "2", "1"); -SplitBillScreen.check.subtotalIs("2.0"); - -// click pay to split, and pay -SplitBillScreen.do.clickPay(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.clickValidate(); -// Check if the receiptscreen suggests us to continue the order -ReceiptScreen.do.clickContinueOrder(); - -// Check if there is still water in the order -ProductScreen.check.isShown(); -ProductScreen.do.clickOrderline("Water", "1.0"); -ProductScreen.do.clickPayButton(true); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.clickValidate(); -// Check if there is no more order to continue -ReceiptScreen.do.clickNextOrder(); - -registry.category("web_tour.tours").add("SplitBillScreenTour3", { test: true, url: "/pos/ui", steps: getSteps() }); + return getSteps(); + } + }); diff --git a/addons/pos_restaurant/static/tests/tours/TicketScreen.tour.js b/addons/pos_restaurant/static/tests/tours/TicketScreen.tour.js index b942d5f1bed..f5db94f57d2 100644 --- a/addons/pos_restaurant/static/tests/tours/TicketScreen.tour.js +++ b/addons/pos_restaurant/static/tests/tours/TicketScreen.tour.js @@ -7,60 +7,65 @@ import { Chrome } from "@pos_restaurant/../tests/tours/helpers/ChromeTourMethods import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -// New Ticket button should not be in the ticket screen if no table is selected. -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.noNewTicketButton(); -TicketScreen.do.clickDiscard(); - -// Deleting the last order in the table brings back to floorscreen -FloorScreen.do.clickTable("4"); -ProductScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.nthRowContains(2, "-0001"); -TicketScreen.do.deleteOrder("-0001"); -TicketScreen.do.clickDiscard(); - -// Create 2 items in a table. From floorscreen, delete 1 item. Then select the other item. -// Correct order and screen should be displayed and the BackToFloorButton is shown. -FloorScreen.do.clickTable("2"); -ProductScreen.exec.addOrderline("Minute Maid", "1", "2"); -ProductScreen.check.totalAmountIs("2.0"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); -ProductScreen.exec.addOrderline("Coca-Cola", "2", "2"); -ProductScreen.check.totalAmountIs("4.0"); -Chrome.do.backToFloor(); -FloorScreen.check.orderCountSyncedInTableIs("2", "3"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.deleteOrder("-0003"); -Chrome.do.confirmPopup(); -TicketScreen.do.selectOrder("-0002"); -ProductScreen.check.isShown(); -ProductScreen.check.totalAmountIs("2.0"); -Chrome.do.backToFloor(); - -// Make sure that order is deleted properly. -FloorScreen.do.clickTable("5"); -ProductScreen.exec.addOrderline("Minute Maid", "1", "3"); -ProductScreen.check.totalAmountIs("3.0"); -Chrome.do.backToFloor(); -FloorScreen.check.orderCountSyncedInTableIs("5", "1"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.deleteOrder("-0004"); -Chrome.do.confirmPopup(); -TicketScreen.do.clickDiscard(); -FloorScreen.check.isShown(); -FloorScreen.do.clickTable("5"); -ProductScreen.check.orderIsEmpty(); - registry .category("web_tour.tours") - .add("PosResTicketScreenTour", { test: true, url: "/pos/ui", steps: getSteps() }); + .add("PosResTicketScreenTour", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + // New Ticket button should not be in the ticket screen if no table is selected. + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.noNewTicketButton(); + TicketScreen.do.clickDiscard(); + + // Deleting the last order in the table brings back to floorscreen + FloorScreen.do.clickTable("4"); + ProductScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.nthRowContains(2, "-0001"); + TicketScreen.do.deleteOrder("-0001"); + TicketScreen.do.clickDiscard(); + + // Create 2 items in a table. From floorscreen, delete 1 item. Then select the other item. + // Correct order and screen should be displayed and the BackToFloorButton is shown. + FloorScreen.do.clickTable("2"); + ProductScreen.exec.addOrderline("Minute Maid", "1", "2"); + ProductScreen.check.totalAmountIs("2.0"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + ProductScreen.exec.addOrderline("Coca-Cola", "2", "2"); + ProductScreen.check.totalAmountIs("4.0"); + Chrome.do.backToFloor(); + FloorScreen.check.orderCountSyncedInTableIs("2", "3"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.deleteOrder("-0003"); + Chrome.do.confirmPopup(); + TicketScreen.do.selectOrder("-0002"); + ProductScreen.check.isShown(); + ProductScreen.check.totalAmountIs("2.0"); + Chrome.do.backToFloor(); + + // Make sure that order is deleted properly. + FloorScreen.do.clickTable("5"); + ProductScreen.exec.addOrderline("Minute Maid", "1", "3"); + ProductScreen.check.totalAmountIs("3.0"); + Chrome.do.backToFloor(); + FloorScreen.check.orderCountSyncedInTableIs("5", "1"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.deleteOrder("-0004"); + Chrome.do.confirmPopup(); + TicketScreen.do.clickDiscard(); + FloorScreen.check.isShown(); + FloorScreen.do.clickTable("5"); + ProductScreen.check.orderIsEmpty(); + return getSteps(); + } + }); diff --git a/addons/pos_restaurant/static/tests/tours/TipScreen.tour.js b/addons/pos_restaurant/static/tests/tours/TipScreen.tour.js index ee3aaa6100b..81df6d1251b 100644 --- a/addons/pos_restaurant/static/tests/tours/TipScreen.tour.js +++ b/addons/pos_restaurant/static/tests/tours/TipScreen.tour.js @@ -11,140 +11,146 @@ import { Chrome } from "@pos_restaurant/../tests/tours/helpers/ChromeTourMethods import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); - -// Create order that is synced when draft. -// order 1 -ProductScreen.do.confirmOpeningPopup(); -FloorScreen.do.clickTable("2"); -ProductScreen.exec.addOrderline("Minute Maid", "1", "2"); -ProductScreen.check.totalAmountIs("2.0"); -Chrome.do.backToFloor(); -FloorScreen.check.orderCountSyncedInTableIs("2", "1"); -FloorScreen.do.clickTable("2"); -ProductScreen.check.totalAmountIs("2.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.clickValidate(); -TipScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); -// order 2 -ProductScreen.exec.addOrderline("Coca-Cola", "2", "2"); -ProductScreen.check.totalAmountIs("4.0"); -Chrome.do.backToFloor(); -FloorScreen.check.orderCountSyncedInTableIs("2", "2"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.nthRowContains("2", "Tipping"); -TicketScreen.do.clickDiscard(); - -// Create without syncing the draft. -// order 3 -FloorScreen.do.clickTable("5"); -ProductScreen.exec.addOrderline("Minute Maid", "3", "2"); -ProductScreen.check.totalAmountIs("6.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.clickValidate(); -TipScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); -// order 4 -ProductScreen.exec.addOrderline("Coca-Cola", "4", "2"); -ProductScreen.check.totalAmountIs("8.0"); -Chrome.do.backToFloor(); -FloorScreen.check.orderCountSyncedInTableIs("5", "4"); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.check.nthRowContains("4", "Tipping"); - -// Tip 20% on order1 -TicketScreen.do.selectOrder("-0001"); -TipScreen.check.isShown(); -TipScreen.check.totalAmountIs("2.0"); -TipScreen.check.percentAmountIs("15%", "0.30"); -TipScreen.check.percentAmountIs("20%", "0.40"); -TipScreen.check.percentAmountIs("25%", "0.50"); -TipScreen.do.clickPercentTip("20%"); -TipScreen.check.inputAmountIs("0.40"); -Chrome.do.backToFloor(); -FloorScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); - -// Tip 25% on order3 -TicketScreen.do.selectOrder("-0003"); -TipScreen.check.isShown(); -TipScreen.check.totalAmountIs("6.0"); -TipScreen.check.percentAmountIs("15%", "0.90"); -TipScreen.check.percentAmountIs("20%", "1.20"); -TipScreen.check.percentAmountIs("25%", "1.50"); -TipScreen.do.clickPercentTip("25%"); -TipScreen.check.inputAmountIs("1.50"); -Chrome.do.backToFloor(); -FloorScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); - -// finalize order 4 then tip custom amount -TicketScreen.do.selectOrder("-0004"); -ProductScreen.check.isShown(); -ProductScreen.check.totalAmountIs("8.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.clickValidate(); -TipScreen.check.isShown(); -TipScreen.check.totalAmountIs("8.0"); -TipScreen.check.percentAmountIs("15%", "1.20"); -TipScreen.check.percentAmountIs("20%", "1.60"); -TipScreen.check.percentAmountIs("25%", "2.00"); -TipScreen.do.setCustomTip("1.00"); -TipScreen.check.inputAmountIs("1.00"); -Chrome.do.backToFloor(); -FloorScreen.check.isShown(); - -// settle tips here -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.selectFilter("Tipping"); -TicketScreen.check.tipContains("1.00"); -TicketScreen.do.settleTips(); -TicketScreen.do.selectFilter("All active orders"); -TicketScreen.check.nthRowContains(2, "Ongoing"); - -// tip order2 during payment -// tip screen should not show after validating payment screen -TicketScreen.do.selectOrder("-0002"); -ProductScreen.check.isShown(); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickTipButton(); -NumberPopup.check.isShown(); -NumberPopup.do.enterValue("1"); -NumberPopup.check.inputShownIs("1"); -NumberPopup.do.clickConfirm(); -PaymentScreen.check.emptyPaymentlines("5.0"); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.isShown(); - -// order 5 -// Click directly on "settle" without selecting a Tip -ReceiptScreen.do.clickNextOrder(); -FloorScreen.do.clickTable("2"); -ProductScreen.exec.addOrderline("Minute Maid", "3", "2"); -ProductScreen.check.totalAmountIs("6.0"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Bank"); -PaymentScreen.do.clickValidate(); -TipScreen.check.isShown(); -TipScreen.do.clickSettle(); -ReceiptScreen.check.isShown(); -ReceiptScreen.do.clickNextOrder(); -FloorScreen.check.isShown(); registry .category("web_tour.tours") - .add("PosResTipScreenTour", { test: true, url: "/pos/ui", steps: getSteps() }); + .add("PosResTipScreenTour", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + // Create order that is synced when draft. + // order 1 + ProductScreen.do.confirmOpeningPopup(); + FloorScreen.do.clickTable("2"); + ProductScreen.exec.addOrderline("Minute Maid", "1", "2"); + ProductScreen.check.totalAmountIs("2.0"); + Chrome.do.backToFloor(); + FloorScreen.check.orderCountSyncedInTableIs("2", "1"); + FloorScreen.do.clickTable("2"); + ProductScreen.check.totalAmountIs("2.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.clickValidate(); + TipScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + // order 2 + ProductScreen.exec.addOrderline("Coca-Cola", "2", "2"); + ProductScreen.check.totalAmountIs("4.0"); + Chrome.do.backToFloor(); + FloorScreen.check.orderCountSyncedInTableIs("2", "2"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.nthRowContains("2", "Tipping"); + TicketScreen.do.clickDiscard(); + + // Create without syncing the draft. + // order 3 + FloorScreen.do.clickTable("5"); + ProductScreen.exec.addOrderline("Minute Maid", "3", "2"); + ProductScreen.check.totalAmountIs("6.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.clickValidate(); + TipScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + // order 4 + ProductScreen.exec.addOrderline("Coca-Cola", "4", "2"); + ProductScreen.check.totalAmountIs("8.0"); + Chrome.do.backToFloor(); + FloorScreen.check.orderCountSyncedInTableIs("5", "4"); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.check.nthRowContains("4", "Tipping"); + + // Tip 20% on order1 + TicketScreen.do.selectOrder("-0001"); + TipScreen.check.isShown(); + TipScreen.check.totalAmountIs("2.0"); + TipScreen.check.percentAmountIs("15%", "0.30"); + TipScreen.check.percentAmountIs("20%", "0.40"); + TipScreen.check.percentAmountIs("25%", "0.50"); + TipScreen.do.clickPercentTip("20%"); + TipScreen.check.inputAmountIs("0.40"); + Chrome.do.backToFloor(); + FloorScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + + // Tip 25% on order3 + TicketScreen.do.selectOrder("-0003"); + TipScreen.check.isShown(); + TipScreen.check.totalAmountIs("6.0"); + TipScreen.check.percentAmountIs("15%", "0.90"); + TipScreen.check.percentAmountIs("20%", "1.20"); + TipScreen.check.percentAmountIs("25%", "1.50"); + TipScreen.do.clickPercentTip("25%"); + TipScreen.check.inputAmountIs("1.50"); + Chrome.do.backToFloor(); + FloorScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + + // finalize order 4 then tip custom amount + TicketScreen.do.selectOrder("-0004"); + ProductScreen.check.isShown(); + ProductScreen.check.totalAmountIs("8.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.clickValidate(); + TipScreen.check.isShown(); + TipScreen.check.totalAmountIs("8.0"); + TipScreen.check.percentAmountIs("15%", "1.20"); + TipScreen.check.percentAmountIs("20%", "1.60"); + TipScreen.check.percentAmountIs("25%", "2.00"); + TipScreen.do.setCustomTip("1.00"); + TipScreen.check.inputAmountIs("1.00"); + Chrome.do.backToFloor(); + FloorScreen.check.isShown(); + + // settle tips here + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.selectFilter("Tipping"); + TicketScreen.check.tipContains("1.00"); + TicketScreen.do.settleTips(); + TicketScreen.do.selectFilter("All active orders"); + TicketScreen.check.nthRowContains(2, "Ongoing"); + + // tip order2 during payment + // tip screen should not show after validating payment screen + TicketScreen.do.selectOrder("-0002"); + ProductScreen.check.isShown(); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickTipButton(); + NumberPopup.check.isShown(); + NumberPopup.do.enterValue("1"); + NumberPopup.check.inputShownIs("1"); + NumberPopup.do.clickConfirm(); + PaymentScreen.check.emptyPaymentlines("5.0"); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); + + // order 5 + // Click directly on "settle" without selecting a Tip + ReceiptScreen.do.clickNextOrder(); + FloorScreen.do.clickTable("2"); + ProductScreen.exec.addOrderline("Minute Maid", "3", "2"); + ProductScreen.check.totalAmountIs("6.0"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Bank"); + PaymentScreen.do.clickValidate(); + TipScreen.check.isShown(); + TipScreen.do.clickSettle(); + ReceiptScreen.check.isShown(); + ReceiptScreen.do.clickNextOrder(); + FloorScreen.check.isShown(); + return getSteps(); + } + }); diff --git a/addons/pos_restaurant/static/tests/tours/pos_restaurant.js b/addons/pos_restaurant/static/tests/tours/pos_restaurant.js index c4abd72c9ef..e9d94b26e9c 100644 --- a/addons/pos_restaurant/static/tests/tours/pos_restaurant.js +++ b/addons/pos_restaurant/static/tests/tours/pos_restaurant.js @@ -9,113 +9,124 @@ import { TicketScreen } from "@point_of_sale/../tests/tours/helpers/TicketScreen import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); - -// Create first order -FloorScreen.do.clickTable("5"); -ProductScreen.check.orderBtnIsPresent(); -ProductScreen.do.clickDisplayedProduct("Coca-Cola"); -ProductScreen.check.selectedOrderlineHas("Coca-Cola"); -ProductScreen.do.doubleClickOrderline("Coca-Cola"); -ProductScreen.do.clickDisplayedProduct("Water"); -ProductScreen.check.selectedOrderlineHas("Water"); -ProductScreen.check.orderlineIsToOrder("Water"); -ProductScreen.check.orderlineIsToSkip("Coca-Cola"); -ProductScreen.do.clickOrderButton(); -ProductScreen.check.orderlinesHaveNoChange(); -ProductScreen.check.isPrintingError(); -ProductScreen.check.totalAmountIs("4.40"); - -// Create 2nd order (paid) -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); -ProductScreen.do.clickDisplayedProduct("Coca-Cola"); -ProductScreen.check.selectedOrderlineHas("Coca-Cola"); -ProductScreen.do.clickDisplayedProduct("Minute Maid"); -ProductScreen.check.selectedOrderlineHas("Minute Maid"); -ProductScreen.check.totalAmountIs("4.40"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.do.clickNextOrder(); - -// After clicking next order, floor screen is shown. -// It should have 1 as number of draft synced order. -FloorScreen.check.orderCountSyncedInTableIs("5", "1"); -FloorScreen.do.clickTable("5"); -ProductScreen.check.totalAmountIs("4.40"); - -// Create another draft order and go back to floor -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.clickNewTicket(); -ProductScreen.do.clickDisplayedProduct("Coca-Cola"); -ProductScreen.check.selectedOrderlineHas("Coca-Cola"); -ProductScreen.do.clickDisplayedProduct("Minute Maid"); -ProductScreen.check.selectedOrderlineHas("Minute Maid"); -Chrome.do.backToFloor(); - -// At floor screen, there should be 2 synced draft orders -FloorScreen.check.orderCountSyncedInTableIs("5", "2"); - -// Delete the first order then go back to floor -FloorScreen.do.clickTable("5"); -ProductScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); -TicketScreen.do.deleteOrder("-0001"); -Chrome.do.confirmPopup(); -Chrome.check.isSyncStatusPending(); -Chrome.check.isSyncStatusConnected(); -TicketScreen.do.selectOrder("-0003"); -Chrome.do.backToFloor(); - -// There should be 1 synced draft order. -FloorScreen.check.orderCountSyncedInTableIs("5", "2"); registry .category("web_tour.tours") - .add("pos_restaurant_sync", { test: true, url: "/pos/ui", steps: getSteps() }); - -startSteps(); + .add("pos_restaurant_sync", { + test: true, + url: "/pos/ui", + steps: () => { + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + + // Create first order + FloorScreen.do.clickTable("5"); + ProductScreen.check.orderBtnIsPresent(); + ProductScreen.do.clickDisplayedProduct("Coca-Cola"); + ProductScreen.check.selectedOrderlineHas("Coca-Cola"); + ProductScreen.do.doubleClickOrderline("Coca-Cola"); + ProductScreen.do.clickDisplayedProduct("Water"); + ProductScreen.check.selectedOrderlineHas("Water"); + ProductScreen.check.orderlineIsToOrder("Water"); + ProductScreen.check.orderlineIsToSkip("Coca-Cola"); + ProductScreen.do.clickOrderButton(); + ProductScreen.check.orderlinesHaveNoChange(); + ProductScreen.check.isPrintingError(); + ProductScreen.check.totalAmountIs("4.40"); + + // Create 2nd order (paid) + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + ProductScreen.do.clickDisplayedProduct("Coca-Cola"); + ProductScreen.check.selectedOrderlineHas("Coca-Cola"); + ProductScreen.do.clickDisplayedProduct("Minute Maid"); + ProductScreen.check.selectedOrderlineHas("Minute Maid"); + ProductScreen.check.totalAmountIs("4.40"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.do.clickNextOrder(); + + // After clicking next order, floor screen is shown. + // It should have 1 as number of draft synced order. + FloorScreen.check.orderCountSyncedInTableIs("5", "1"); + FloorScreen.do.clickTable("5"); + ProductScreen.check.totalAmountIs("4.40"); + + // Create another draft order and go back to floor + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.clickNewTicket(); + ProductScreen.do.clickDisplayedProduct("Coca-Cola"); + ProductScreen.check.selectedOrderlineHas("Coca-Cola"); + ProductScreen.do.clickDisplayedProduct("Minute Maid"); + ProductScreen.check.selectedOrderlineHas("Minute Maid"); + Chrome.do.backToFloor(); + + // At floor screen, there should be 2 synced draft orders + FloorScreen.check.orderCountSyncedInTableIs("5", "2"); + + // Delete the first order then go back to floor + FloorScreen.do.clickTable("5"); + ProductScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + TicketScreen.do.deleteOrder("-0001"); + Chrome.do.confirmPopup(); + TicketScreen.do.selectOrder("-0003"); + Chrome.do.backToFloor(); + + // There should be 1 synced draft order. + FloorScreen.check.orderCountSyncedInTableIs("5", "2"); + return getSteps(); + } + }); + /* pos_restaurant_sync_second_login - * - * This tour should be run after the first tour is done. - */ - -// There is one draft synced order from the previous tour -FloorScreen.do.clickTable("5"); -ProductScreen.check.totalAmountIs("4.40"); - -// Test transfering an order -ProductScreen.do.clickTransferButton(); -FloorScreen.do.clickTable("4"); - -// Test if products still get merged after transfering the order -ProductScreen.do.clickDisplayedProduct("Coca-Cola"); -ProductScreen.check.selectedOrderlineHas("Coca-Cola", "2.0"); -ProductScreen.check.totalAmountIs("6.60"); -ProductScreen.do.pressNumpad("1"); -ProductScreen.check.totalAmountIs("4.40"); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod("Cash"); -PaymentScreen.do.clickValidate(); -ReceiptScreen.do.clickNextOrder(); -// At this point, there are no draft orders. - -FloorScreen.do.clickTable("2"); -ProductScreen.check.isShown(); -ProductScreen.check.orderIsEmpty(); -ProductScreen.do.clickTransferButton(); -FloorScreen.do.clickTable("4"); -ProductScreen.do.clickDisplayedProduct("Coca-Cola"); -ProductScreen.check.totalAmountIs("2.20"); -Chrome.do.backToFloor(); -FloorScreen.check.orderCountSyncedInTableIs("4", "1"); - +* +* This tour should be run after the first tour is done. +*/ registry .category("web_tour.tours") - .add("pos_restaurant_sync_second_login", { test: true, url: "/pos/ui", steps: getSteps() }); + .add("pos_restaurant_sync_second_login", { + test: true, + url: "/pos/ui", + steps: () => { + + startSteps(); + + + // There is one draft synced order from the previous tour + FloorScreen.do.clickTable("5"); + ProductScreen.check.totalAmountIs("4.40"); + + // Test transfering an order + ProductScreen.do.clickTransferButton(); + FloorScreen.do.clickTable("4"); + + // Test if products still get merged after transfering the order + ProductScreen.do.clickDisplayedProduct("Coca-Cola"); + ProductScreen.check.selectedOrderlineHas("Coca-Cola", "2.0"); + ProductScreen.check.totalAmountIs("6.60"); + ProductScreen.do.pressNumpad("1"); + ProductScreen.check.totalAmountIs("4.40"); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod("Cash"); + PaymentScreen.do.clickValidate(); + ReceiptScreen.do.clickNextOrder(); + // At this point, there are no draft orders. + + FloorScreen.do.clickTable("2"); + ProductScreen.check.isShown(); + ProductScreen.check.orderIsEmpty(); + ProductScreen.do.clickTransferButton(); + FloorScreen.do.clickTable("4"); + ProductScreen.do.clickDisplayedProduct("Coca-Cola"); + ProductScreen.check.totalAmountIs("2.20"); + Chrome.do.backToFloor(); + FloorScreen.check.orderCountSyncedInTableIs("4", "1"); + return getSteps(); + } + }); diff --git a/addons/pos_sale/static/tests/tours/PosSaleTour.js b/addons/pos_sale/static/tests/tours/PosSaleTour.js index 6ee6e2c144a..0bab1803ba8 100644 --- a/addons/pos_sale/static/tests/tours/PosSaleTour.js +++ b/addons/pos_sale/static/tests/tours/PosSaleTour.js @@ -8,93 +8,133 @@ import { TicketScreen } from "@point_of_sale/../tests/tours/helpers/TicketScreen import { getSteps, startSteps } from "@point_of_sale/../tests/tours/helpers/utils"; import { registry } from "@web/core/registry"; -// signal to start generating steps -// when finished, steps can be taken from getSteps -startSteps(); +registry + .category("web_tour.tours") + .add('PosSettleOrder', { + test: true, + url: '/pos/ui', + steps: () => { + // signal to start generating steps + // when finished, steps can be taken from getSteps + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickQuotationButton(); + ProductScreen.do.selectFirstOrder(); + ProductScreen.check.selectedOrderlineHas('Pizza Chicken', 9); + ProductScreen.do.pressNumpad('Qty 2'); // Change the quantity of the product to 2 + ProductScreen.check.selectedOrderlineHas('Pizza Chicken', 2); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod('Bank'); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); + Chrome.do.clickMenuButton(); + Chrome.do.clickTicketButton(); + return getSteps(); + } + }); + +registry + .category("web_tour.tours") + .add('PosSettleOrderIncompatiblePartner', { + test: true, + url: '/pos/ui', + steps: () => { + + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickQuotationButton(); + // The second item in the list is the first sale.order. + ProductScreen.do.selectNthOrder(2); + ProductScreen.check.selectedOrderlineHas('product1', 1); + ProductScreen.check.totalAmountIs("10.00"); + + ProductScreen.do.clickQuotationButton(); + // The first item in the list is the second sale.order. + // Selecting the 2nd sale.order should use a new order, + // therefore, the total amount will change. + ProductScreen.do.selectNthOrder(1); + ProductScreen.check.selectedOrderlineHas('product2', 1); + ProductScreen.check.totalAmountIs("11.00"); + return getSteps(); + } + }); -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickQuotationButton(); -ProductScreen.do.selectFirstOrder(); -ProductScreen.check.selectedOrderlineHas('Pizza Chicken', 9); -ProductScreen.do.pressNumpad('Qty 2'); // Change the quantity of the product to 2 -ProductScreen.check.selectedOrderlineHas('Pizza Chicken', 2); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod('Bank'); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.isShown(); -Chrome.do.clickMenuButton(); -Chrome.do.clickTicketButton(); +registry + .category("web_tour.tours") + .add('PosSettleOrder2', { + test: true, + url: '/pos/ui', + steps: () => { + + startSteps(); + + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickQuotationButton(); + ProductScreen.do.selectFirstOrder(); + ProductScreen.do.clickOrderline("Product A", "1"); + ProductScreen.check.selectedOrderlineHas('Product A', '1.00'); + ProductScreen.do.clickOrderline("Product B", "1"); + ProductScreen.do.pressNumpad('Qty 0'); + ProductScreen.check.selectedOrderlineHas('Product B', '0.00'); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod('Bank'); + PaymentScreen.check.remainingIs('0.0'); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); + return getSteps(); + } + }); -registry.category("web_tour.tours").add('PosSettleOrder', { test: true, url: '/pos/ui', steps: getSteps() }); +registry + .category("web_tour.tours") + .add('PosRefundDownpayment', { + test: true, + url: '/pos/ui', + steps: () => { + startSteps(); + + ProductScreen.do.clickQuotationButton(); + ProductScreen.do.downPaymentFirstOrder(); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod('Cash'); + PaymentScreen.do.clickValidate(); + ReceiptScreen.do.clickNextOrder(); + ProductScreen.do.clickRefund(); + // Filter should be automatically 'Paid'. + TicketScreen.check.filterIs('Paid'); + TicketScreen.do.selectOrder('-0001'); + TicketScreen.do.clickOrderline('Down Payment'); + TicketScreen.do.pressNumpad('1'); + TicketScreen.do.confirmRefund(); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod('Cash'); + PaymentScreen.do.clickValidate(); + ReceiptScreen.do.clickNextOrder(); + + return getSteps(); + } + }); -startSteps(); +registry + .category("web_tour.tours") + .add('PosSettleOrderRealTime', { + test: true, + url: '/pos/ui', + steps: () => { -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickQuotationButton(); -// The second item in the list is the first sale.order. -ProductScreen.do.selectNthOrder(2); -ProductScreen.check.selectedOrderlineHas('product1', 1); -ProductScreen.check.totalAmountIs("10.00"); + startSteps(); -ProductScreen.do.clickQuotationButton(); -// The first item in the list is the second sale.order. -// Selecting the 2nd sale.order should use a new order, -// therefore, the total amount will change. -ProductScreen.do.selectNthOrder(1); -ProductScreen.check.selectedOrderlineHas('product2', 1); -ProductScreen.check.totalAmountIs("11.00"); + ProductScreen.do.confirmOpeningPopup(); + ProductScreen.do.clickQuotationButton(); + ProductScreen.do.selectFirstOrder(); + ProductScreen.check.totalAmountIs(40); + ProductScreen.do.clickPayButton(); + PaymentScreen.do.clickPaymentMethod('Bank'); + PaymentScreen.do.clickValidate(); + ReceiptScreen.check.isShown(); -registry.category("web_tour.tours").add('PosSettleOrderIncompatiblePartner', { test: true, url: '/pos/ui', steps: getSteps() }); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickQuotationButton(); -ProductScreen.do.selectFirstOrder(); -ProductScreen.do.clickOrderline("Product A", "1"); -ProductScreen.check.selectedOrderlineHas('Product A', '1.00'); -ProductScreen.do.clickOrderline("Product B", "1"); -ProductScreen.do.pressNumpad('Qty 0'); -ProductScreen.check.selectedOrderlineHas('Product B', '0.00'); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod('Bank'); -PaymentScreen.check.remainingIs('0.0'); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.isShown(); - -registry.category("web_tour.tours").add('PosSettleOrder2', { test: true, url: '/pos/ui', steps: getSteps() }); - -startSteps(); - -ProductScreen.do.clickQuotationButton(); -ProductScreen.do.downPaymentFirstOrder(); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod('Cash'); -PaymentScreen.do.clickValidate(); -ReceiptScreen.do.clickNextOrder(); -ProductScreen.do.clickRefund(); -// Filter should be automatically 'Paid'. -TicketScreen.check.filterIs('Paid'); -TicketScreen.do.selectOrder('-0001'); -TicketScreen.do.clickOrderline('Down Payment'); -TicketScreen.do.pressNumpad('1'); -TicketScreen.do.confirmRefund(); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod('Cash'); -PaymentScreen.do.clickValidate(); -ReceiptScreen.do.clickNextOrder(); - -registry.category("web_tour.tours").add('PosRefundDownpayment', { test: true, url: '/pos/ui', steps: getSteps() }); - -startSteps(); - -ProductScreen.do.confirmOpeningPopup(); -ProductScreen.do.clickQuotationButton(); -ProductScreen.do.selectFirstOrder(); -ProductScreen.check.totalAmountIs(40); -ProductScreen.do.clickPayButton(); -PaymentScreen.do.clickPaymentMethod('Bank'); -PaymentScreen.do.clickValidate(); -ReceiptScreen.check.isShown(); - -registry.category("web_tour.tours").add('PosSettleOrderRealTime', { test: true, url: '/pos/ui', steps: getSteps() }); + return getSteps(); + } + }); diff --git a/addons/pos_self_order/static/tests/tours/self_order_after_each_cart_tour.js b/addons/pos_self_order/static/tests/tours/self_order_after_each_cart_tour.js index ac8afe1496b..2340d093503 100644 --- a/addons/pos_self_order/static/tests/tours/self_order_after_each_cart_tour.js +++ b/addons/pos_self_order/static/tests/tours/self_order_after_each_cart_tour.js @@ -5,7 +5,7 @@ import { PosSelf } from "./tour_utils"; registry.category("web_tour.tours").add("self_order_after_each_cart_tour", { test: true, - steps: [ + steps: () => [ // Verify if the self is open and My Orders is not displayed because we are in "meal" mode PosSelf.check.isNotNotification(), PosSelf.check.isNotPrimaryBtn("My Orders"), diff --git a/addons/pos_self_order/static/tests/tours/self_order_after_meal_cart_tour.js b/addons/pos_self_order/static/tests/tours/self_order_after_meal_cart_tour.js index 5c1e821b0ac..4c8a67ce9e9 100644 --- a/addons/pos_self_order/static/tests/tours/self_order_after_meal_cart_tour.js +++ b/addons/pos_self_order/static/tests/tours/self_order_after_meal_cart_tour.js @@ -5,7 +5,7 @@ import { PosSelf } from "./tour_utils"; registry.category("web_tour.tours").add("self_order_after_meal_cart_tour", { test: true, - steps: [ + steps: () => [ // Verify if the self is open and My Orders is not displayed because we are in "meal" mode PosSelf.check.isNotNotification(), PosSelf.check.isNotPrimaryBtn("My Orders"), diff --git a/addons/pos_self_order/static/tests/tours/self_order_after_meal_product_tour.js b/addons/pos_self_order/static/tests/tours/self_order_after_meal_product_tour.js index 5f73ac543fe..2b3b99b3eb7 100644 --- a/addons/pos_self_order/static/tests/tours/self_order_after_meal_product_tour.js +++ b/addons/pos_self_order/static/tests/tours/self_order_after_meal_product_tour.js @@ -5,7 +5,7 @@ import { PosSelf } from "./tour_utils"; registry.category("web_tour.tours").add("self_order_after_meal_product_tour", { test: true, - steps: [ + steps: () => [ // Verify if the self is open PosSelf.check.isNotNotification(), PosSelf.check.isNotPrimaryBtn("My Orders"), diff --git a/addons/pos_self_order/static/tests/tours/self_order_menu_only_tour.js b/addons/pos_self_order/static/tests/tours/self_order_menu_only_tour.js index 10226498d88..315f15c0881 100644 --- a/addons/pos_self_order/static/tests/tours/self_order_menu_only_tour.js +++ b/addons/pos_self_order/static/tests/tours/self_order_menu_only_tour.js @@ -5,7 +5,7 @@ import { PosSelf } from "./tour_utils"; registry.category("web_tour.tours").add("self_order_menu_only_tour", { test: true, - steps: [ + steps: () => [ PosSelf.check.isNotPrimaryBtn("My Orders"), PosSelf.check.isPrimaryBtn("View Menu"), PosSelf.action.clickPrimaryBtn("View Menu"), diff --git a/addons/project/static/src/js/tours/project.js b/addons/project/static/src/js/tours/project.js index c0e85e3d511..5205b2179dd 100644 --- a/addons/project/static/src/js/tours/project.js +++ b/addons/project/static/src/js/tours/project.js @@ -10,7 +10,7 @@ registry.category("web_tour.tours").add('project_tour', { sequence: 110, url: "/web", rainbowManMessage: _t("Congratulations, you are now a master of project management."), - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="project.menu_main_pm"]', content: Markup(_t('Want a better way to manage your projects? It starts here.')), position: 'right', diff --git a/addons/project/static/tests/tours/personal_stage_tour.js b/addons/project/static/tests/tours/personal_stage_tour.js index e3b6799c48e..262aae3784d 100644 --- a/addons/project/static/tests/tours/personal_stage_tour.js +++ b/addons/project/static/tests/tours/personal_stage_tour.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('personal_stage_tour', { test: true, url: '/web', - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="project.menu_main_pm"]', }, { content: "Open Pig Project", diff --git a/addons/project/static/tests/tours/project_burndown_chart_tour.js b/addons/project/static/tests/tours/project_burndown_chart_tour.js index 65bfc208528..492afe74739 100644 --- a/addons/project/static/tests/tours/project_burndown_chart_tour.js +++ b/addons/project/static/tests/tours/project_burndown_chart_tour.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('burndown_chart_tour', { test: true, url: '/web', - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="project.menu_main_pm"]', }, { content: 'Open "Burndown Chart Test" project menu', diff --git a/addons/project/static/tests/tours/project_sharing_tour.js b/addons/project/static/tests/tours/project_sharing_tour.js index f91acfaa846..e74ef58c870 100644 --- a/addons/project/static/tests/tours/project_sharing_tour.js +++ b/addons/project/static/tests/tours/project_sharing_tour.js @@ -93,11 +93,17 @@ const projectSharingSteps = [...stepUtils.goToAppSteps("project.menu_main_pm", ' registry.category("web_tour.tours").add('project_sharing_tour', { test: true, url: '/web', - steps: projectSharingSteps }); + steps: () => { + return projectSharingSteps; + } +}); -// The begining of the project sharing feature -const projectSharingStepIndex = projectSharingSteps.findIndex(s => s.id && s.id === 'project_sharing_feature'); -registry.category("web_tour.tours").add('portal_project_sharing_tour', { +registry.category("web_tour.tours").add("portal_project_sharing_tour", { test: true, - url: '/my/projects', - steps: projectSharingSteps.slice(projectSharingStepIndex, projectSharingSteps.length) }); + url: "/my/projects", + steps: () => { + // The begining of the project sharing feature + const projectSharingStepIndex = projectSharingSteps.findIndex(s => s?.id === 'project_sharing_feature'); + return projectSharingSteps.slice(projectSharingStepIndex, projectSharingSteps.length); + } +}); diff --git a/addons/project/static/tests/tours/project_update_tour_tests.js b/addons/project/static/tests/tours/project_update_tour_tests.js index 958c6926fd0..74a8ad44076 100644 --- a/addons/project/static/tests/tours/project_update_tour_tests.js +++ b/addons/project/static/tests/tours/project_update_tour_tests.js @@ -30,7 +30,7 @@ function openProjectUpdateAndReturnToTasks(view, viewClass) { registry.category("web_tour.tours").add('project_update_tour', { test: true, url: '/web', - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="project.menu_main_pm"]', }, { trigger: '.o-kanban-button-new', diff --git a/addons/purchase/static/src/js/tours/purchase.js b/addons/purchase/static/src/js/tours/purchase.js index 071544bc14a..9a4bc8b7d37 100644 --- a/addons/purchase/static/src/js/tours/purchase.js +++ b/addons/purchase/static/src/js/tours/purchase.js @@ -11,7 +11,7 @@ import PurchaseAdditionalTourSteps from "purchase.purchase_steps"; registry.category("web_tour.tours").add('purchase_tour' , { url: "/web", sequence: 40, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="purchase.menu_purchase_root"]', content: _t("Let's try the Purchase app to manage the flow from purchase to reception and invoice control."), position: 'right', diff --git a/addons/purchase_product_matrix/static/tests/tours/purchase_product_matrix_tour.js b/addons/purchase_product_matrix/static/tests/tours/purchase_product_matrix_tour.js index eca75966018..177a7654f52 100644 --- a/addons/purchase_product_matrix/static/tests/tours/purchase_product_matrix_tour.js +++ b/addons/purchase_product_matrix/static/tests/tours/purchase_product_matrix_tour.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('purchase_matrix_tour', { url: "/web", test: true, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="purchase.menu_purchase_root"]', }, { trigger: ".o_list_button_add", diff --git a/addons/sale/static/src/js/tours/sale.js b/addons/sale/static/src/js/tours/sale.js index f170c7d1109..57aec0f3c84 100644 --- a/addons/sale/static/src/js/tours/sale.js +++ b/addons/sale/static/src/js/tours/sale.js @@ -12,7 +12,7 @@ registry.category("web_tour.tours").add("sale_tour", { url: "/web", rainbowMan: false, sequence: 20, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: ".o_app[data-menu-xmlid='sale.sale_menu_root']", content: _t("Open Sales app to send your first quotation in a few clicks."), position: "right", @@ -85,7 +85,7 @@ registry.category("web_tour.tours").add("sale_quote_tour", { rainbowMan: true, rainbowManMessage: markup(_t("Congratulations, your first quotation is sent!
Check your email to validate the quote.")), sequence: 30, - steps: [{ + steps: () => [{ trigger: ".o_field_res_partner_many2one[name='partner_id']", extra_trigger: ".o_sale_order", content: _t("Write a company name to create one, or see suggestions."), diff --git a/addons/sale/static/tests/tours/sale_signature.js b/addons/sale/static/tests/tours/sale_signature.js index 946d9bde2a7..2830b886725 100644 --- a/addons/sale/static/tests/tours/sale_signature.js +++ b/addons/sale/static/tests/tours/sale_signature.js @@ -6,7 +6,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('sale_signature', { test: true, url: '/my/quotes', - steps: [ + steps: () => [ { content: "open the test SO", trigger: 'a:containsExact("test SO")', diff --git a/addons/sale_timesheet/static/tests/tours/sale_timesheet_tour.js b/addons/sale_timesheet/static/tests/tours/sale_timesheet_tour.js index 8d659313047..0e4d4b1ad5e 100644 --- a/addons/sale_timesheet/static/tests/tours/sale_timesheet_tour.js +++ b/addons/sale_timesheet/static/tests/tours/sale_timesheet_tour.js @@ -7,7 +7,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('sale_timesheet_tour', { test: true, url: '/web', - steps: [...stepUtils.goToAppSteps("sale.sale_menu_root", 'Go to the Sales App'), + steps: () => [...stepUtils.goToAppSteps("sale.sale_menu_root", 'Go to the Sales App'), { trigger: 'button.o_list_button_add', content: 'Click on CREATE button to create a quotation with service products.', diff --git a/addons/stock/static/tests/tours/stock_report_tests.js b/addons/stock/static/tests/tours/stock_report_tests.js index bdc6986b342..f421d57de33 100644 --- a/addons/stock/static/tests/tours/stock_report_tests.js +++ b/addons/stock/static/tests/tours/stock_report_tests.js @@ -4,7 +4,7 @@ registry.category("web_tour.tours").add('test_stock_route_diagram_report', { test: true, - steps: [ + steps: () => [ { trigger: '.o_kanban_record', extra_trigger: '.o_breadcrumb', diff --git a/addons/survey/static/src/js/tours/survey_tour.js b/addons/survey/static/src/js/tours/survey_tour.js index 51e852c81df..595cf4e1a54 100644 --- a/addons/survey/static/src/js/tours/survey_tour.js +++ b/addons/survey/static/src/js/tours/survey_tour.js @@ -10,7 +10,7 @@ registry.category("web_tour.tours").add('survey_tour', { url: "/web", rainbowManMessage: _t("Congratulations! You are now ready to collect feedback like a pro :-)"), sequence: 225, - steps: [ + steps: () => [ ...stepUtils.goToAppSteps('survey.menu_surveys', Markup(_t("Ready to change the way you gather data?"))), { trigger: '.btn-outline-primary.o_survey_load_sample', diff --git a/addons/survey/static/tests/tours/certification_failure.js b/addons/survey/static/tests/tours/certification_failure.js index 5fa6ef343ee..09dfd0e80d0 100644 --- a/addons/survey/static/tests/tours/certification_failure.js +++ b/addons/survey/static/tests/tours/certification_failure.js @@ -103,4 +103,4 @@ var lastSteps = [{ registry.category("web_tour.tours").add('test_certification_failure', { test: true, url: '/survey/start/4ead4bc8-b8f2-4760-a682-1fde8daaaaac', - steps: [].concat(failSteps, retrySteps, failSteps, lastSteps) }); + steps: () => [].concat(failSteps, retrySteps, failSteps, lastSteps) }); diff --git a/addons/survey/static/tests/tours/certification_success.js b/addons/survey/static/tests/tours/certification_success.js index 4439838e8fb..55430a56fdb 100644 --- a/addons/survey/static/tests/tours/certification_success.js +++ b/addons/survey/static/tests/tours/certification_success.js @@ -16,7 +16,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('test_certification_success', { test: true, url: '/survey/start/4ead4bc8-b8f2-4760-a682-1fde8daaaaac', - steps: [{ // Page-1 + steps: () => [{ // Page-1 content: "Clicking on Start Certification", trigger: 'button.btn.btn-primary.btn-lg:contains("Start Certification")', }, { // Question: Do we sell Acoustic Bloc Screens? diff --git a/addons/survey/static/tests/tours/survey.js b/addons/survey/static/tests/tours/survey.js index c75bcccd7c3..e60e5e5557f 100644 --- a/addons/survey/static/tests/tours/survey.js +++ b/addons/survey/static/tests/tours/survey.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('test_survey', { test: true, url: '/survey/start/b137640d-14d4-4748-9ef6-344caaaaaae', - steps: [ + steps: () => [ // Page-1 { content: 'Click on Start', diff --git a/addons/survey/static/tests/tours/survey_chained_conditional_questions.js b/addons/survey/static/tests/tours/survey_chained_conditional_questions.js index 40fca0fde9a..f9ddec406e0 100644 --- a/addons/survey/static/tests/tours/survey_chained_conditional_questions.js +++ b/addons/survey/static/tests/tours/survey_chained_conditional_questions.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('test_survey_chained_conditional_questions', { test: true, url: '/survey/start/3cfadce3-3f7e-41da-920d-10fa0eb19527', - steps: [ + steps: () => [ { content: 'Click on Start', trigger: 'button.btn:contains("Start")', diff --git a/addons/survey/static/tests/tours/survey_form.js b/addons/survey/static/tests/tours/survey_form.js index 6c15780f1d2..1506521634b 100644 --- a/addons/survey/static/tests/tours/survey_form.js +++ b/addons/survey/static/tests/tours/survey_form.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('survey_tour_test_survey_form_triggers', { test: true, url: '/web', - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: 'Go to Survey', diff --git a/addons/survey/static/tests/tours/survey_prefill.js b/addons/survey/static/tests/tours/survey_prefill.js index cf786339c01..b4f75ba5022 100644 --- a/addons/survey/static/tests/tours/survey_prefill.js +++ b/addons/survey/static/tests/tours/survey_prefill.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('test_survey_prefill', { test: true, url: '/survey/start/b137640d-14d4-4748-9ef6-344caaaaaae', - steps: [{ // Page-1 + steps: () => [{ // Page-1 trigger: 'button.btn.btn-primary.btn-lg:contains("Start Survey")', }, { // Question: Where do you live? trigger: 'div.js_question-wrapper:contains("Where do you live?") input', diff --git a/addons/survey/static/tests/tours/survey_tour_session_create.js b/addons/survey/static/tests/tours/survey_tour_session_create.js index 69bef5c92d5..f6546ace474 100644 --- a/addons/survey/static/tests/tours/survey_tour_session_create.js +++ b/addons/survey/static/tests/tours/survey_tour_session_create.js @@ -1,17 +1,24 @@ /** @odoo-module **/ import { registry } from "@web/core/registry"; -import surveySessionTools from "survey.session_tour_tools"; +import { accessSurveysteps } from "./survey_tour_session_tools"; /** * Small tour that will simply start the session and wait for attendees. */ -registry.category("web_tour.tours").add('test_survey_session_create_tour', { +registry.category("web_tour.tours").add("test_survey_session_create_tour", { url: "/web", test: true, - steps: [].concat(surveySessionTools.accessSurveySteps, [{ - trigger: 'button[name="action_start_session"]', -}, { - trigger: '.o_survey_session_attendees_count:contains("0")', - run: function () {} // check session is correctly started -}])}); + steps: () => { + return [ + ...accessSurveysteps, + { + trigger: 'button[name="action_start_session"]', + }, + { + trigger: '.o_survey_session_attendees_count:contains("0")', + run: function () {}, // check session is correctly started + }, + ]; + }, +}); diff --git a/addons/survey/static/tests/tours/survey_tour_session_manage.js b/addons/survey/static/tests/tours/survey_tour_session_manage.js index 82d23ba8976..b1e5a6d867c 100644 --- a/addons/survey/static/tests/tours/survey_tour_session_manage.js +++ b/addons/survey/static/tests/tours/survey_tour_session_manage.js @@ -3,8 +3,7 @@ import { registry } from "@web/core/registry"; import { zip } from "@web/core/utils/arrays"; import { TourError } from "@web_tour/tour_service/tour_utils"; - -import surveySessionTools from "survey.session_tour_tools"; +import { accessSurveysteps } from "./survey_tour_session_tools"; /** * Since the chart is rendered using SVG, we can't use jQuery triggers to check if everything @@ -140,7 +139,7 @@ const checkAnswersCount = (chartData, expectedCount) => { registry.category("web_tour.tours").add('test_survey_session_manage_tour', { url: "/web", test: true, - steps: [].concat(surveySessionTools.accessSurveySteps, [{ + steps: () => [].concat(accessSurveysteps, [{ trigger: 'button[name="action_open_session_manager"]', }, { trigger: 'h1:contains("Nickname")', diff --git a/addons/survey/static/tests/tours/survey_tour_session_start.js b/addons/survey/static/tests/tours/survey_tour_session_start.js index 2734a577cb8..d741a64e2be 100644 --- a/addons/survey/static/tests/tours/survey_tour_session_start.js +++ b/addons/survey/static/tests/tours/survey_tour_session_start.js @@ -1,7 +1,7 @@ /** @odoo-module **/ import { registry } from "@web/core/registry"; -import surveySessionTools from "survey.session_tour_tools"; +import { accessSurveysteps } from "./survey_tour_session_tools"; /** * Small tour that will open the session manager and check @@ -11,7 +11,7 @@ import surveySessionTools from "survey.session_tour_tools"; registry.category("web_tour.tours").add('test_survey_session_start_tour', { url: "/web", test: true, - steps: [].concat(surveySessionTools.accessSurveySteps, [{ + steps: () => [].concat(accessSurveysteps, [{ trigger: 'button[name="action_open_session_manager"]', }, { trigger: '.o_survey_session_attendees_count:contains("3")', diff --git a/addons/survey/static/tests/tours/survey_tour_session_tools.js b/addons/survey/static/tests/tours/survey_tour_session_tools.js index 79e2549df43..37c7b911361 100644 --- a/addons/survey/static/tests/tours/survey_tour_session_tools.js +++ b/addons/survey/static/tests/tours/survey_tour_session_tools.js @@ -1,18 +1,21 @@ -/** @odoo-module alias=survey.session_tour_tools **/ +/** @odoo-module **/ import { stepUtils } from "@web_tour/tour_service/tour_utils"; /** * Tool that gathers common steps to every 'survey session' tours. */ -export default { - accessSurveySteps: [stepUtils.showAppsMenuItem(), { +export const accessSurveysteps = [ + stepUtils.showAppsMenuItem(), + { trigger: '.o_app[data-menu-xmlid="survey.menu_surveys"]', - edition: 'community' - }, { + edition: "community", + }, + { trigger: '.o_app[data-menu-xmlid="survey.menu_surveys"]', - edition: 'enterprise' - }, { + edition: "enterprise", + }, + { trigger: '.oe_kanban_card:contains("User Session Survey")', - }] -}; + }, +]; diff --git a/addons/test_event_full/static/src/js/tours/wevent_performance_tour.js b/addons/test_event_full/static/src/js/tours/wevent_performance_tour.js index 237e8fe836b..c6d9ec92958 100644 --- a/addons/test_event_full/static/src/js/tours/wevent_performance_tour.js +++ b/addons/test_event_full/static/src/js/tours/wevent_performance_tour.js @@ -76,7 +76,7 @@ var registerSteps = [{ registry.category("web_tour.tours").add('wevent_performance_register', { test: true, - steps: [].concat( + steps: () => [].concat( registerSteps, ) }); diff --git a/addons/test_event_full/static/src/js/tours/wevent_register_tour.js b/addons/test_event_full/static/src/js/tours/wevent_register_tour.js index 642eebffc53..d5c3caf9a8b 100644 --- a/addons/test_event_full/static/src/js/tours/wevent_register_tour.js +++ b/addons/test_event_full/static/src/js/tours/wevent_register_tour.js @@ -156,7 +156,7 @@ var browseMeetSteps = [{ registry.category("web_tour.tours").add('wevent_register', { url: '/event', test: true, - steps: [].concat( + steps: () => [].concat( initTourSteps('Online Reveal'), browseTalksSteps, discoverTalkSteps('What This Event Is All About', true, true), diff --git a/addons/test_sale_product_configurators/static/tests/tours/event_sale_with_product_configurator_ui.js b/addons/test_sale_product_configurators/static/tests/tours/event_sale_with_product_configurator_ui.js index cedbdacab9a..ed0c787db20 100644 --- a/addons/test_sale_product_configurators/static/tests/tours/event_sale_with_product_configurator_ui.js +++ b/addons/test_sale_product_configurators/static/tests/tours/event_sale_with_product_configurator_ui.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('event_sale_with_product_configurator_tour', { url: '/web', test: true, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="sale.sale_menu_root"]', }, { trigger: '.o_list_button_add', diff --git a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_advanced_ui.js b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_advanced_ui.js index e18b804064b..9f446bec386 100644 --- a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_advanced_ui.js +++ b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_advanced_ui.js @@ -8,7 +8,7 @@ let optionVariantImage; registry.category("web_tour.tours").add('sale_product_configurator_advanced_tour', { url: '/web', test: true, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="sale.sale_menu_root"]', }, { trigger: '.o_list_button_add', diff --git a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_edition_ui.js b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_edition_ui.js index 20652b5f17f..ce1a66cda7c 100644 --- a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_edition_ui.js +++ b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_edition_ui.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('sale_product_configurator_edition_tour', { url: '/web', test: true, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="sale.sale_menu_root"]', }, { trigger: '.o_list_button_add', diff --git a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_optional_products_ui.js b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_optional_products_ui.js index bf1fb2d402b..6a72c7a5510 100644 --- a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_optional_products_ui.js +++ b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_optional_products_ui.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('sale_product_configurator_optional_products_tour', { url: '/web', test: true, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="sale.sale_menu_root"]', }, { trigger: '.o_list_button_add', diff --git a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_pricelist_ui.js b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_pricelist_ui.js index 7daa30e1e72..b43f6cb77a4 100644 --- a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_pricelist_ui.js +++ b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_pricelist_ui.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('sale_product_configurator_pricelist_tour', { url: '/web', test: true, - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: "navigate to the sale app", diff --git a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_single_custom_attribute_ui.js b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_single_custom_attribute_ui.js index 9ad5785b1f2..c9be8ac2b0d 100644 --- a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_single_custom_attribute_ui.js +++ b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_single_custom_attribute_ui.js @@ -6,7 +6,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('sale_product_configurator_single_custom_attribute_tour', { url: '/web', test: true, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="sale.sale_menu_root"]', }, { trigger: '.o_list_button_add', diff --git a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_ui.js b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_ui.js index 091f3bb062a..ba175436335 100644 --- a/addons/test_sale_product_configurators/static/tests/tours/product_configurator_ui.js +++ b/addons/test_sale_product_configurators/static/tests/tours/product_configurator_ui.js @@ -9,7 +9,7 @@ import { stepUtils } from "@web_tour/tour_service/tour_utils"; registry.category("web_tour.tours").add('sale_product_configurator_tour', { url: '/web', test: true, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="sale.sale_menu_root"]', }, { trigger: '.o_list_button_add', diff --git a/addons/test_sale_product_configurators/static/tests/tours/product_matrix_tour.js b/addons/test_sale_product_configurators/static/tests/tours/product_matrix_tour.js index 569dd7c5cf1..018ed7267e7 100644 --- a/addons/test_sale_product_configurators/static/tests/tours/product_matrix_tour.js +++ b/addons/test_sale_product_configurators/static/tests/tours/product_matrix_tour.js @@ -21,7 +21,7 @@ for (let no of ['PAV41', 'PAV42']) { registry.category("web_tour.tours").add('sale_matrix_tour', { url: '/web', test: true, - steps: [stepUtils.showAppsMenuItem(), { + steps: () => [stepUtils.showAppsMenuItem(), { trigger: '.o_app[data-menu-xmlid="sale.sale_menu_root"]', }, { trigger: '.o_list_button_add', diff --git a/addons/test_website/static/tests/tours/error_views.js b/addons/test_website/static/tests/tours/error_views.js index fe78ce7c6f1..6049930d7d2 100644 --- a/addons/test_website/static/tests/tours/error_views.js +++ b/addons/test_website/static/tests/tours/error_views.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('test_error_website', { test: true, url: '/test_error_view', - steps: [ + steps: () => [ // RPC ERROR { content: "trigger rpc user error", diff --git a/addons/test_website/static/tests/tours/json_auth.js b/addons/test_website/static/tests/tours/json_auth.js index d0504a70752..2ee741a3992 100644 --- a/addons/test_website/static/tests/tours/json_auth.js +++ b/addons/test_website/static/tests/tours/json_auth.js @@ -5,7 +5,7 @@ import session from "web.session"; registry.category("web_tour.tours").add('test_json_auth', { test: true, - steps: [{ + steps: () => [{ trigger: 'body', run: async function () { await session.rpc('/test_get_dbname').then( function (result){ diff --git a/addons/test_website/static/tests/tours/website_settings.js b/addons/test_website/static/tests/tours/website_settings.js index 8886c22965a..c1a5a0d6263 100644 --- a/addons/test_website/static/tests/tours/website_settings.js +++ b/addons/test_website/static/tests/tours/website_settings.js @@ -8,7 +8,7 @@ const websiteName = "Website Test Settings"; registry.category("web_tour.tours").add("website_settings_m2o_dirty", { test: true, url: "/web", - steps: [ + steps: () => [ stepUtils.showAppsMenuItem(), { content: "open settings", diff --git a/addons/test_website_modules/static/tests/tours/configurator_flow.js b/addons/test_website_modules/static/tests/tours/configurator_flow.js index cd363f6d129..3796244ed50 100644 --- a/addons/test_website_modules/static/tests/tours/configurator_flow.js +++ b/addons/test_website_modules/static/tests/tours/configurator_flow.js @@ -6,7 +6,7 @@ import wTourUtils from "website.tour_utils"; registry.category("web_tour.tours").add('configurator_flow', { test: true, url: '/web#action=website.action_website_configuration', - steps: [ + steps: () => [ { content: "click on create new website", trigger: 'button[name="action_website_create_new"]', diff --git a/addons/test_website_slides_full/static/tests/tours/slides_certification_member.js b/addons/test_website_slides_full/static/tests/tours/slides_certification_member.js index eaf79731ff4..e4480476cf3 100644 --- a/addons/test_website_slides_full/static/tests/tours/slides_certification_member.js +++ b/addons/test_website_slides_full/static/tests/tours/slides_certification_member.js @@ -144,7 +144,7 @@ var profileSteps = [{ registry.category("web_tour.tours").add('certification_member', { url: '/slides', test: true, - steps: [].concat( + steps: () => [].concat( initTourSteps, buyCertificationSteps, failCertificationSteps, diff --git a/addons/web/__manifest__.py b/addons/web/__manifest__.py index 65cb5f57358..bb58bf57d3a 100644 --- a/addons/web/__manifest__.py +++ b/addons/web/__manifest__.py @@ -587,6 +587,7 @@ This module provides the core of the Odoo Web Client. ('after', 'web/static/src/owl2_compatibility/app.js', 'web/static/tests/owl2_compatibility_app.js'), ], 'web.tests_assets': [ + 'web/static/tests/patch_translations.js', 'web/static/lib/qunit/qunit-2.9.1.css', 'web/static/lib/qunit/qunit-2.9.1.js', 'web/static/tests/legacy/helpers/**/*', diff --git a/addons/web/static/src/core/l10n/localization_service.js b/addons/web/static/src/core/l10n/localization_service.js index 3b91799e72f..27f5d0c25ad 100644 --- a/addons/web/static/src/core/l10n/localization_service.js +++ b/addons/web/static/src/core/l10n/localization_service.js @@ -5,7 +5,7 @@ import { browser } from "../browser/browser"; import { registry } from "../registry"; import { strftimeToLuxonFormat } from "./dates"; import { localization } from "./localization"; -import { _t, translatedTerms } from "./translation"; +import { _t, translatedTerms, translationLoaded, translationIsReady } from "./translation"; const { Settings } = luxon; @@ -54,7 +54,9 @@ export const localizationService = { } } - Object.setPrototypeOf(translatedTerms, terms); + Object.assign(translatedTerms, terms); + translatedTerms[translationLoaded] = true; + translationIsReady.resolve(true); env._t = _t; // Setup lang inside luxon. The locale codes received from the server contain "_", diff --git a/addons/web/static/src/core/l10n/translation.js b/addons/web/static/src/core/l10n/translation.js index f191773c080..35030668cf1 100644 --- a/addons/web/static/src/core/l10n/translation.js +++ b/addons/web/static/src/core/l10n/translation.js @@ -1,7 +1,11 @@ /** @odoo-module **/ -export const translatedTerms = {}; - +import { Deferred } from "@web/core/utils/concurrency"; +export const translationLoaded = Symbol("translationLoaded"); +export const translatedTerms = { + [translationLoaded]: false, +}; +export const translationIsReady = new Deferred(); /** * Translate a term, or return the term if no translation can be found. * @@ -14,16 +18,10 @@ export const translatedTerms = {}; * @returns {string} */ export function _t(term) { - return translatedTerms[term] || term; -} - -class LazyTranslatedString extends String { - valueOf() { - const str = super.valueOf(); - return _t(str); - } - toString() { - return this.valueOf(); + if (translatedTerms[translationLoaded]) { + return translatedTerms[term] || term; + } else { + return new LazyTranslatedString(term); } } @@ -37,8 +35,20 @@ class LazyTranslatedString extends String { * @param {string} term * @returns {LazyTranslatedString} */ -export function _lt(term) { - return new LazyTranslatedString(term); +export const _lt = (term) => _t(term); + +class LazyTranslatedString extends String { + valueOf() { + const term = super.valueOf(); + if (translatedTerms[translationLoaded]) { + return translatedTerms[term] || term; + } else { + throw new Error(`translation error`); + } + } + toString() { + return this.valueOf(); + } } /* diff --git a/addons/web/static/src/webclient/actions/reports/utils.js b/addons/web/static/src/webclient/actions/reports/utils.js index 2d8af86e264..34ea207955d 100644 --- a/addons/web/static/src/webclient/actions/reports/utils.js +++ b/addons/web/static/src/webclient/actions/reports/utils.js @@ -33,22 +33,26 @@ export function getReportUrl(action, type, userContext) { } // messages that might be shown to the user dependening on the state of wkhtmltopdf -const link = '

wkhtmltopdf.org'; // FIXME missing markup -const WKHTMLTOPDF_MESSAGES = { - broken: - _t( - "Your installation of Wkhtmltopdf seems to be broken. The report will be shown in html." - ) + link, - install: - _t("Unable to find Wkhtmltopdf on this system. The report will be shown in html.") + link, - upgrade: - _t( - "You should upgrade your version of Wkhtmltopdf to at least 0.12.0 in order to get a correct display of headers and footers as well as support for table-breaking between pages." - ) + link, - workers: _t( - "You need to start Odoo with at least two workers to print a pdf version of the reports." - ), -}; +function getWKHTMLTOPDF_MESSAGES(status) { + const link = '

wkhtmltopdf.org'; // FIXME missing markup + const _status = { + broken: + _t( + "Your installation of Wkhtmltopdf seems to be broken. The report will be shown in html." + ) + link, + install: + _t("Unable to find Wkhtmltopdf on this system. The report will be shown in html.") + + link, + upgrade: + _t( + "You should upgrade your version of Wkhtmltopdf to at least 0.12.0 in order to get a correct display of headers and footers as well as support for table-breaking between pages." + ) + link, + workers: _t( + "You need to start Odoo with at least two workers to print a pdf version of the reports." + ), + }; + return _status[status]; +} /** * Launches download action of the report @@ -66,7 +70,7 @@ export async function downloadReport(rpc, action, type, userContext) { // checked once, but we can reset it between tests to test multiple statuses. downloadReport.wkhtmltopdfStatusProm ||= rpc("/report/check_wkhtmltopdf"); const status = await downloadReport.wkhtmltopdfStatusProm; - message = WKHTMLTOPDF_MESSAGES[status]; + message = getWKHTMLTOPDF_MESSAGES(status); if (!["upgrade", "ok"].includes(status)) { return { success: false, message }; } diff --git a/addons/web/static/tests/core/l10n/translation_tests.js b/addons/web/static/tests/core/l10n/translation_tests.js index 987508d40f6..c241d3a29b1 100644 --- a/addons/web/static/tests/core/l10n/translation_tests.js +++ b/addons/web/static/tests/core/l10n/translation_tests.js @@ -6,7 +6,7 @@ import { makeFakeLocalizationService } from "@web/../tests/helpers/mock_services import { getFixture, mount, patchWithCleanup } from "@web/../tests/helpers/utils"; import { browser } from "@web/core/browser/browser"; import { localizationService } from "@web/core/l10n/localization_service"; -import { translatedTerms, _lt } from "@web/core/l10n/translation"; +import { translatedTerms, translationLoaded, _t } from "@web/core/l10n/translation"; import { registry } from "@web/core/registry"; import { patch, unpatch } from "@web/core/utils/patch"; import { session } from "@web/session"; @@ -67,16 +67,18 @@ QUnit.test("can translate a text node", async (assert) => { }); QUnit.test("can lazy translate", async (assert) => { + // Can't use patchWithCleanup cause it doesn't support Symbol + translatedTerms[translationLoaded] = false; assert.expect(3); - TestComponent.template = xml`
`; - TestComponent.someLazyText = _lt("Hello"); - assert.strictEqual(TestComponent.someLazyText.toString(), "Hello"); - assert.strictEqual(TestComponent.someLazyText.valueOf(), "Hello"); + TestComponent.someLazyText = _t("Hello"); + assert.throws(() => TestComponent.someLazyText.toString()); + assert.throws(() => TestComponent.someLazyText.valueOf()); serviceRegistry.add("localization", makeFakeLocalizationService()); const env = await makeTestEnv(); patch(translatedTerms, "add translations", terms); + translatedTerms[translationLoaded] = true; const target = getFixture(); await mount(TestComponent, target, { env }); assert.strictEqual(target.innerText, "Bonjour"); diff --git a/addons/web/static/tests/patch_translations.js b/addons/web/static/tests/patch_translations.js new file mode 100644 index 00000000000..e89ecc49d81 --- /dev/null +++ b/addons/web/static/tests/patch_translations.js @@ -0,0 +1,5 @@ +/** @odoo-module */ + +import { translatedTerms, translationLoaded } from "@web/core/l10n/translation"; + +translatedTerms[translationLoaded] = true; diff --git a/addons/web_tour/static/src/tour_service/tour_service.js b/addons/web_tour/static/src/tour_service/tour_service.js index e2ac0880043..7528b97d46d 100644 --- a/addons/web_tour/static/src/tour_service/tour_service.js +++ b/addons/web_tour/static/src/tour_service/tour_service.js @@ -20,7 +20,7 @@ import { callWithUnloadCheck } from "./tour_utils"; * * @typedef Tour * @property {string} url - * @property {TourStep[]} steps + * @property {() => TourStep[]} steps * @property {boolean} [rainbowMan] * @property {number} [sequence] * @property {boolean} [test] @@ -68,10 +68,15 @@ export const tourService = { tours[name] = { name: tour.saveAs || name, get steps() { - return tour.steps.map((step) => { - step.shadow_dom = step.shadow_dom ?? tour.shadow_dom; - return step; - }); + if(typeof tour.steps === "function") { + return tour.steps().map((step) => { + step.shadow_dom = step.shadow_dom ?? tour.shadow_dom; + return step; + }); + } + else { + throw new Error(`tour.steps has to be a function that returns TourStep[]`) + } }, shadow_dom: tour.shadow_dom, url: tour.url, diff --git a/addons/web_tour/static/tests/tour_service_tests.js b/addons/web_tour/static/tests/tour_service_tests.js index 443a9dd7a15..6852a81d5c7 100644 --- a/addons/web_tour/static/tests/tour_service_tests.js +++ b/addons/web_tour/static/tests/tour_service_tests.js @@ -104,7 +104,7 @@ QUnit.module("Tour service", (hooks) => { QUnit.test("points to next step", async function (assert) { registry.category("web_tour.tours").add("tour1", { sequence: 10, - steps: [ + steps: () => [ { trigger: "button.inc", }, @@ -138,7 +138,7 @@ QUnit.module("Tour service", (hooks) => { QUnit.test("perform edit on next step", async function (assert) { registry.category("web_tour.tours").add("tour1", { sequence: 10, - steps: [ + steps:() => [ { trigger: ".interval input", }, @@ -178,7 +178,7 @@ QUnit.module("Tour service", (hooks) => { QUnit.test("trigger an event when a step is consummed", async function (assert) { registry.category("web_tour.tours").add("tour1", { sequence: 10, - steps: [{ trigger: ".interval input" }], + steps: () => [{ trigger: ".interval input" }], }); const env = await makeTestEnv({}); @@ -210,7 +210,7 @@ QUnit.module("Tour service", (hooks) => { QUnit.test("should show only 1 pointer at a time", async function (assert) { registry.category("web_tour.tours").add("tour1", { sequence: 10, - steps: [ + steps: () => [ { trigger: ".interval input", }, @@ -218,7 +218,7 @@ QUnit.module("Tour service", (hooks) => { }); registry.category("web_tour.tours").add("tour2", { sequence: 10, - steps: [ + steps: () => [ { trigger: "button.inc", }, @@ -254,7 +254,7 @@ QUnit.module("Tour service", (hooks) => { QUnit.test("hovering to the anchor element should show the content", async function (assert) { registry.category("web_tour.tours").add("tour1", { sequence: 10, - steps: [ + steps: () => [ { content: "content", trigger: "button.inc", diff --git a/addons/website/static/src/js/tours/tour_utils.js b/addons/website/static/src/js/tours/tour_utils.js index f7b4b195bdb..05b60aa8f58 100644 --- a/addons/website/static/src/js/tours/tour_utils.js +++ b/addons/website/static/src/js/tours/tour_utils.js @@ -343,7 +343,7 @@ function registerWebsitePreviewTour(name, options, steps) { tourSteps[0].timeout = 20000; } - return registry.category("web_tour.tours").add(name, Object.assign({}, options, { url, steps: tourSteps})); + return registry.category("web_tour.tours").add(name, Object.assign({}, options, { url, steps: () => tourSteps})); } function registerThemeHomepageTour(name, steps) { @@ -374,7 +374,7 @@ function registerBackendAndFrontendTour(name, options, steps) { return registry.category("web_tour.tours").add(name, { url: options.url, - steps, + steps: () => steps, }); } diff --git a/addons/website/static/tests/tours/client_action_redirect.js b/addons/website/static/tests/tours/client_action_redirect.js index c37c64d1522..3d0cf5c5f15 100644 --- a/addons/website/static/tests/tours/client_action_redirect.js +++ b/addons/website/static/tests/tours/client_action_redirect.js @@ -43,7 +43,7 @@ const checkEditorSteps = [{ registry.category("web_tour.tours").add('client_action_redirect', { test: true, url: testUrl, - steps: [ + steps: () => [ // Case 1: From frontend, click on `enable_editor=1` link without `/@/` in it ...goToFrontendSteps, { diff --git a/addons/website/static/tests/tours/conditional_visibility_frontend.js b/addons/website/static/tests/tours/conditional_visibility_frontend.js index 4eb3f4b028c..3060499d4e2 100644 --- a/addons/website/static/tests/tours/conditional_visibility_frontend.js +++ b/addons/website/static/tests/tours/conditional_visibility_frontend.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('conditional_visibility_2', { test: true, url: '/?utm_medium=Email', - steps: [{ + steps: () => [{ content: 'The content previously hidden should now be visible', trigger: 'body #wrap', run: function (actions) { diff --git a/addons/website/static/tests/tours/configurator_translation.js b/addons/website/static/tests/tours/configurator_translation.js index e43df05729a..6f08fe4edd1 100644 --- a/addons/website/static/tests/tours/configurator_translation.js +++ b/addons/website/static/tests/tours/configurator_translation.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('configurator_translation', { test: true, url: '/website/configurator', - steps: [ + steps: () => [ // Configurator first screen { content: "click next", diff --git a/addons/website/static/tests/tours/edit_translated_page.js b/addons/website/static/tests/tours/edit_translated_page.js index dde26b2180a..6ff2576c9c7 100644 --- a/addons/website/static/tests/tours/edit_translated_page.js +++ b/addons/website/static/tests/tours/edit_translated_page.js @@ -6,7 +6,7 @@ import wTourUtils from "website.tour_utils"; registry.category("web_tour.tours").add('edit_translated_page_redirect', { test: true, url: '/nl/contactus', - steps: [ + steps: () => [ { content: "Enter backend", trigger: 'a.o_frontend_to_backend_edit_btn', diff --git a/addons/website/static/tests/tours/hide_chat_window_on_preview.js b/addons/website/static/tests/tours/hide_chat_window_on_preview.js index 2762ee8166e..aa90b0e3926 100644 --- a/addons/website/static/tests/tours/hide_chat_window_on_preview.js +++ b/addons/website/static/tests/tours/hide_chat_window_on_preview.js @@ -6,7 +6,7 @@ import wTourUtils from "website.tour_utils"; registry.category("web_tour.tours").add("test_hide_chat_window_on_preview", { test: true, - steps: [ + steps: () => [ { trigger: ".o-mail-ChatWindow", run() { diff --git a/addons/website/static/tests/tours/public_user_editor.js b/addons/website/static/tests/tours/public_user_editor.js index 0c923ba29b5..03072fdfef3 100644 --- a/addons/website/static/tests/tours/public_user_editor.js +++ b/addons/website/static/tests/tours/public_user_editor.js @@ -4,7 +4,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('public_user_editor', { test: true, - steps: [{ + steps: () => [{ trigger: '.note-editable', run: function () {}, // Simple check }]}); diff --git a/addons/website/static/tests/tours/reset_password.js b/addons/website/static/tests/tours/reset_password.js index 3f731e89a32..98b4d32b191 100644 --- a/addons/website/static/tests/tours/reset_password.js +++ b/addons/website/static/tests/tours/reset_password.js @@ -4,7 +4,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('website_reset_password', { test: true, - steps: [ + steps: () => [ { content: "fill new password", trigger: '.oe_reset_password_form input[name="password"]', diff --git a/addons/website/static/tests/tours/snippets_all_drag_and_drop.js b/addons/website/static/tests/tours/snippets_all_drag_and_drop.js index 5170a1201fe..50ded941a10 100644 --- a/addons/website/static/tests/tours/snippets_all_drag_and_drop.js +++ b/addons/website/static/tests/tours/snippets_all_drag_and_drop.js @@ -77,7 +77,7 @@ registry.category("web_tour.tours").add("snippets_all_drag_and_drop", { // To run the tour locally, you need to insert the URL sent by the python // tour here. There is currently an issue with tours which don't have an URL // url: '/?enable_editor=1&snippets_names=s_showcase,s_numbers,s_...', - steps: [ + steps: () => [ ...websiteTourUtils.clickOnEditAndWaitEditMode(), { content: "Ensure snippets are actually passed at the test.", diff --git a/addons/website/static/tests/tours/specific_website_editor.js b/addons/website/static/tests/tours/specific_website_editor.js index 8804ff9d455..516d4a6472e 100644 --- a/addons/website/static/tests/tours/specific_website_editor.js +++ b/addons/website/static/tests/tours/specific_website_editor.js @@ -18,7 +18,7 @@ wTourUtils.registerWebsitePreviewTour("generic_website_editor", { // unknown reason. registry.category("web_tour.tours").add('specific_website_editor', { test: true, - steps: [ + steps: () => [ ...wTourUtils.clickOnEditAndWaitEditMode(), { trigger: 'iframe body[data-hello="world"]', diff --git a/addons/website/static/tests/tours/unsplash_beacon.js b/addons/website/static/tests/tours/unsplash_beacon.js index 8a97659f638..6a6acebc3a0 100644 --- a/addons/website/static/tests/tours/unsplash_beacon.js +++ b/addons/website/static/tests/tours/unsplash_beacon.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add("test_unsplash_beacon", { test: true, url: "/", - steps: [{ + steps: () => [{ content: "Verify whether beacon was sent.", trigger: 'img[data-beacon="sent"]', isCheck: true, diff --git a/addons/website/static/tests/tours/website_backend_menus_redirect.js b/addons/website/static/tests/tours/website_backend_menus_redirect.js index 8a153b6572d..d167bdb07ae 100644 --- a/addons/website/static/tests/tours/website_backend_menus_redirect.js +++ b/addons/website/static/tests/tours/website_backend_menus_redirect.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('website_backend_menus_redirect', { test: true, url: '/', - steps: [ + steps: () => [ { content: 'Need at least a step so the tour is not failing in enterprise', trigger: 'body', diff --git a/addons/website/static/tests/tours/website_form_editor_frontend.js b/addons/website/static/tests/tours/website_form_editor_frontend.js index bd6f62242d0..b31c9d59630 100644 --- a/addons/website/static/tests/tours/website_form_editor_frontend.js +++ b/addons/website/static/tests/tours/website_form_editor_frontend.js @@ -4,7 +4,7 @@ import rpc from 'web.rpc'; registry.category("web_tour.tours").add("website_form_editor_tour_submit", { test: true, - steps: [ + steps: () => [ { content: "Try to send the form with some required fields not filled in", extra_trigger: "form[data-model_name='mail.mail']" + @@ -154,7 +154,7 @@ registry.category("web_tour.tours").add("website_form_editor_tour_submit", { registry.category("web_tour.tours").add("website_form_editor_tour_results", { test: true, - steps: [ + steps: () => [ { content: "Check mail.mail records have been created", trigger: "body", @@ -187,7 +187,7 @@ registry.category("web_tour.tours").add("website_form_editor_tour_results", { registry.category("web_tour.tours").add('website_form_contactus_submit', { test: true, url: '/contactus', - steps: [ + steps: () => [ // As the demo portal user, only two inputs needs to be filled to send // the email { diff --git a/addons/website/static/tests/tours/website_navbar_menu.js b/addons/website/static/tests/tours/website_navbar_menu.js index e309401a418..7a05aa2592b 100644 --- a/addons/website/static/tests/tours/website_navbar_menu.js +++ b/addons/website/static/tests/tours/website_navbar_menu.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add("website_navbar_menu", { test: true, url: "/", - steps: [ + steps: () => [ { content: "Ensure menus are in DOM", trigger: '#top_menu .nav-item a:contains("Test Tour Menu")', diff --git a/addons/website_blog/static/tests/tours/blog_search_with_date.js b/addons/website_blog/static/tests/tours/blog_search_with_date.js index 11a42d60ffa..5e284886fc5 100644 --- a/addons/website_blog/static/tests/tours/blog_search_with_date.js +++ b/addons/website_blog/static/tests/tours/blog_search_with_date.js @@ -8,7 +8,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add("blog_autocomplete_with_date", { test: true, url: '/blog', - steps: [{ + steps: () => [{ content: "Select first month", trigger: 'select[name=archive]', run: 'text option 2', diff --git a/addons/website_crm/static/tests/tours/website_crm.js b/addons/website_crm/static/tests/tours/website_crm.js index 748cc6f6b2a..bd4221c8886 100644 --- a/addons/website_crm/static/tests/tours/website_crm.js +++ b/addons/website_crm/static/tests/tours/website_crm.js @@ -29,7 +29,7 @@ registry.category("web_tour.tours").add('website_crm_tour', { test: true, url: '/contactus', - steps: [{ + steps: () => [{ content: "Complete name", trigger: "input[name=contact_name]", run: "text John Smith", @@ -64,7 +64,7 @@ registry.category("web_tour.tours").add('website_crm_catch_logged_partner_info_tour', { test: true, url: '/contactus', - steps: [{ + steps: () => [{ content: "Complete Subject", trigger: "input[name=name]", run: "text Useless subject" diff --git a/addons/website_event/static/tests/tours/tickets_questions.js b/addons/website_event/static/tests/tours/tickets_questions.js index c6d014df220..c7c85b4f07f 100644 --- a/addons/website_event/static/tests/tours/tickets_questions.js +++ b/addons/website_event/static/tests/tours/tickets_questions.js @@ -4,7 +4,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('test_tickets_questions', { test: true, url: '/event', - steps: [{ + steps: () => [{ content: "Click on the Design Fair event", trigger: 'article:contains("Design Fair New York")', }, { diff --git a/addons/website_event/static/tests/tours/website_event_pages_seo.js b/addons/website_event/static/tests/tours/website_event_pages_seo.js index ac20225ec9f..156bdcabcaa 100644 --- a/addons/website_event/static/tests/tours/website_event_pages_seo.js +++ b/addons/website_event/static/tests/tours/website_event_pages_seo.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add('website_event_pages_seo', { test: true, // The tour must start on an event's custom page (not register page) // url: `/event/openwood-collection-online-reveal-8/page/introduction-openwood-collection-online-reveal`, - steps: [ + steps: () => [ { content: "Open the site menu", trigger: '[data-menu-xmlid="website.menu_site"]', diff --git a/addons/website_event_booth_exhibitor/static/tests/tours/website_event_booth_exhibitor.js b/addons/website_event_booth_exhibitor/static/tests/tours/website_event_booth_exhibitor.js index ac990191e4d..e4c8041bc95 100644 --- a/addons/website_event_booth_exhibitor/static/tests/tours/website_event_booth_exhibitor.js +++ b/addons/website_event_booth_exhibitor/static/tests/tours/website_event_booth_exhibitor.js @@ -7,7 +7,7 @@ registry.category("web_tour.tours").add("webooth_exhibitor_register", { test: true, url: "/event", - steps: [{ + steps: () => [{ content: 'Go on "Online Reveal" page', trigger: 'a[href*="/event"]:contains("Online Reveal"):first', }, { diff --git a/addons/website_event_booth_sale/static/tests/tours/website_event_booth.js b/addons/website_event_booth_sale/static/tests/tours/website_event_booth.js index abd4baac667..640aa5739d9 100644 --- a/addons/website_event_booth_sale/static/tests/tours/website_event_booth.js +++ b/addons/website_event_booth_sale/static/tests/tours/website_event_booth.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('website_event_booth_tour', { test: true, url: '/event', - steps: [ + steps: () => [ { content: 'Open "Test Event Booths" event', trigger: 'h5.card-title span:contains("Test Event Booths")', diff --git a/addons/website_event_booth_sale/static/tests/tours/website_event_booth_sale_pricelists.js b/addons/website_event_booth_sale/static/tests/tours/website_event_booth_sale_pricelists.js index dd91509ad36..1654198a494 100644 --- a/addons/website_event_booth_sale/static/tests/tours/website_event_booth_sale_pricelists.js +++ b/addons/website_event_booth_sale/static/tests/tours/website_event_booth_sale_pricelists.js @@ -6,7 +6,7 @@ import { getPriceListChecksSteps } from 'website_event_booth_sale.tour.WebsiteEv registry.category("web_tour.tours").add('event_booth_sale_pricelists_different_currencies', { test: true, url: '/event', - steps: [ + steps: () => [ // Init: registering the booth { content: 'Open "Test Event Booths" event', diff --git a/addons/website_event_sale/static/tests/tours/website_event_sale.js b/addons/website_event_sale/static/tests/tours/website_event_sale.js index 429021c66c9..0f1b1196f39 100644 --- a/addons/website_event_sale/static/tests/tours/website_event_sale.js +++ b/addons/website_event_sale/static/tests/tours/website_event_sale.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('event_buy_tickets', { test: true, url: '/event', - steps: [ + steps: () => [ { content: "Go to the `Events` page", trigger: 'a[href*="/event"]:contains("Conference for Architects TEST"):first', diff --git a/addons/website_event_sale/static/tests/tours/website_event_sale_last_ticket.js b/addons/website_event_sale/static/tests/tours/website_event_sale_last_ticket.js index 8d4932ba0df..e78fd6b5582 100644 --- a/addons/website_event_sale/static/tests/tours/website_event_sale_last_ticket.js +++ b/addons/website_event_sale/static/tests/tours/website_event_sale_last_ticket.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('event_buy_last_ticket', { test: true, url: '/event', - steps: [{ + steps: () => [{ content: "Open the Last ticket test event page", trigger: '.o_wevent_events_list a:contains("Last ticket test")', }, diff --git a/addons/website_event_sale/static/tests/tours/website_event_sale_pricelists.js b/addons/website_event_sale/static/tests/tours/website_event_sale_pricelists.js index 214fcb26a7a..5dfbff3525e 100644 --- a/addons/website_event_sale/static/tests/tours/website_event_sale_pricelists.js +++ b/addons/website_event_sale/static/tests/tours/website_event_sale_pricelists.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add('event_sale_pricelists_different_currencies', { test: true, url: '/event', - steps: [ + steps: () => [ // Register for tickets { content: "Open the Pycon event", diff --git a/addons/website_forum/static/tests/tours/website_forum_question.js b/addons/website_forum/static/tests/tours/website_forum_question.js index 5897bd5b1f2..ff133e1ece2 100644 --- a/addons/website_forum/static/tests/tours/website_forum_question.js +++ b/addons/website_forum/static/tests/tours/website_forum_question.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('forum_question', { test: true, url: '/forum/help-1', - steps: [ + steps: () => [ { content: "Ask the question in this forum by clicking on the button.", trigger: '.o_wforum_ask_btn', diff --git a/addons/website_hr_recruitment/static/tests/tours/website_hr_recruitment.js b/addons/website_hr_recruitment/static/tests/tours/website_hr_recruitment.js index 1c6e9c5fe35..38b8526cd81 100644 --- a/addons/website_hr_recruitment/static/tests/tours/website_hr_recruitment.js +++ b/addons/website_hr_recruitment/static/tests/tours/website_hr_recruitment.js @@ -38,7 +38,7 @@ registry.category("web_tour.tours").add('website_hr_recruitment_tour', { test: true, url: '/jobs', - steps: [ + steps: () => [ ...applyForAJob('Guru', { name: 'John Smith', email: 'john@smith.com', diff --git a/addons/website_links/static/tests/tours/website_links.js b/addons/website_links/static/tests/tours/website_links.js index 5ad6f94eb37..0ba5a0280e1 100644 --- a/addons/website_links/static/tests/tours/website_links.js +++ b/addons/website_links/static/tests/tours/website_links.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('website_links_tour', { test: true, url: '/r', - steps: [ + steps: () => [ // 1. Create a tracked URL { content: "check that existing links are shown", diff --git a/addons/website_livechat/static/tests/tours/website_livechat_chatbot_flow.js b/addons/website_livechat/static/tests/tours/website_livechat_chatbot_flow.js index 1ee6da476e9..27099df4d2b 100644 --- a/addons/website_livechat/static/tests/tours/website_livechat_chatbot_flow.js +++ b/addons/website_livechat/static/tests/tours/website_livechat_chatbot_flow.js @@ -7,7 +7,7 @@ const messagesContain = (text) => `.o-mail-Message:contains("${text}")`; registry.category("web_tour.tours").add("website_livechat_chatbot_flow_tour", { test: true, shadow_dom: ".o-livechat-root", - steps: [ + steps: () => [ { trigger: messagesContain("Hello! I'm a bot!"), }, diff --git a/addons/website_livechat/static/tests/tours/website_livechat_rating.js b/addons/website_livechat/static/tests/tours/website_livechat_rating.js index 886d8de1c07..ffc377e30dc 100644 --- a/addons/website_livechat/static/tests/tours/website_livechat_rating.js +++ b/addons/website_livechat/static/tests/tours/website_livechat_rating.js @@ -16,40 +16,40 @@ registry.category("web_tour.tours").add("website_livechat_complete_flow_tour", { test: true, url: "/", shadow_dom: ".o-livechat-root", - steps: [].concat(start, endDiscussion, okRating, feedback, transcript, close), + steps: () => [].concat(start, endDiscussion, okRating, feedback, transcript, close), }); registry.category("web_tour.tours").add("website_livechat_happy_rating_tour", { test: true, url: "/", shadow_dom: ".o-livechat-root", - steps: [].concat(start, endDiscussion, goodRating, feedback), + steps: () => [].concat(start, endDiscussion, goodRating, feedback), }); registry.category("web_tour.tours").add("website_livechat_ok_rating_tour", { test: true, url: "/", shadow_dom: ".o-livechat-root", - steps: [].concat(start, endDiscussion, okRating, feedback), + steps: () => [].concat(start, endDiscussion, okRating, feedback), }); registry.category("web_tour.tours").add("website_livechat_sad_rating_tour", { test: true, url: "/", shadow_dom: ".o-livechat-root", - steps: [].concat(start, endDiscussion, sadRating, feedback), + steps: () => [].concat(start, endDiscussion, sadRating, feedback), }); registry.category("web_tour.tours").add("website_livechat_no_rating_tour", { test: true, url: "/", shadow_dom: ".o-livechat-root", - steps: [].concat(start, endDiscussion, transcript, close), + steps: () => [].concat(start, endDiscussion, transcript, close), }); registry.category("web_tour.tours").add("website_livechat_no_rating_no_close_tour", { test: true, url: "/", shadow_dom: ".o-livechat-root", - steps: [].concat(start), + steps: () => [].concat(start), }); diff --git a/addons/website_livechat/static/tests/tours/website_livechat_request.js b/addons/website_livechat/static/tests/tours/website_livechat_request.js index 939f06371a3..bda4004ef4c 100644 --- a/addons/website_livechat/static/tests/tours/website_livechat_request.js +++ b/addons/website_livechat/static/tests/tours/website_livechat_request.js @@ -46,12 +46,12 @@ registry.category("web_tour.tours").add("website_livechat_chat_request_part_1_no test: true, url: "/", shadow_dom: ".o-livechat-root", - steps: [].concat(chatRequest), + steps: () => [].concat(chatRequest), }); registry.category("web_tour.tours").add("website_livechat_chat_request_part_2_end_session_tour", { test: true, url: "/", shadow_dom: ".o-livechat-root", - steps: [].concat(endDiscussion, okRating, feedback, transcript, close), + steps: () => [].concat(endDiscussion, okRating, feedback, transcript, close), }); diff --git a/addons/website_livechat/static/tests/tours/website_livechat_session_user_changes.js b/addons/website_livechat/static/tests/tours/website_livechat_session_user_changes.js index 358321e59fc..a89833aac03 100644 --- a/addons/website_livechat/static/tests/tours/website_livechat_session_user_changes.js +++ b/addons/website_livechat/static/tests/tours/website_livechat_session_user_changes.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add("website_livechat_login_after_chat_start test: true, url: "/", shadow_dom: ".o-livechat-root", - steps: [ + steps: () => [ { trigger: ".o-livechat-LivechatButton", run: "click", @@ -65,7 +65,7 @@ registry.category("web_tour.tours").add("website_livechat_logout_after_chat_star test: true, url: "/", shadow_dom: ".o-livechat-root", - steps: [ + steps: () => [ { trigger: ".o-livechat-LivechatButton", run: "click", diff --git a/addons/website_mass_mailing/static/tests/tours/snippet_newsletter_popup_use.js b/addons/website_mass_mailing/static/tests/tours/snippet_newsletter_popup_use.js index 6be79a10374..e3389122889 100644 --- a/addons/website_mass_mailing/static/tests/tours/snippet_newsletter_popup_use.js +++ b/addons/website_mass_mailing/static/tests/tours/snippet_newsletter_popup_use.js @@ -20,7 +20,7 @@ function ensurePopupNotVisible() { registry.category("web_tour.tours").add('snippet_newsletter_popup_use', { test: true, url: '/', - steps: [ + steps: () => [ { content: "Check the modal is not yet opened and force it opened", trigger: 'body:has(.o_newsletter_popup)', diff --git a/addons/website_sale/static/src/js/tours/tour_utils.js b/addons/website_sale/static/src/js/tours/tour_utils.js index 2c9f2070e6f..1fb813148bc 100644 --- a/addons/website_sale/static/src/js/tours/tour_utils.js +++ b/addons/website_sale/static/src/js/tours/tour_utils.js @@ -1,119 +1,119 @@ /** @odoo-module alias=website_sale.tour_utils **/ - import core from "web.core"; - const _t = core._t; - import wTourUtils from "website.tour_utils"; - import "web.legacy_tranlations_loaded"; +import core from "web.core"; +const _t = core._t; +import wTourUtils from "website.tour_utils"; +import "web.legacy_tranlations_loaded"; - function addToCart({productName, search = true, productHasVariants = false}) { - const steps = []; - if (search) { - steps.push(...searchProduct(productName)); - } - steps.push(wTourUtils.clickOnElement(productName, `a:contains(${productName})`)); - steps.push(wTourUtils.clickOnElement('Add to cart', '#add_to_cart')); - if (productHasVariants) { - steps.push(wTourUtils.clickOnElement('Continue Shopping', 'button:contains("Continue Shopping")')); - } - return steps; +function addToCart({productName, search = true, productHasVariants = false}) { + const steps = []; + if (search) { + steps.push(...searchProduct(productName)); } - - function assertCartContains({productName, backend, notContains = false} = {}) { - let trigger = `a:contains(${productName})`; - - if (notContains) { - trigger = `:not(${trigger})`; - } - return { - content: `Checking if ${productName} is in the cart`, - trigger: `${backend ? "iframe" : ""} ${trigger}`, - run: () => {} - }; + steps.push(wTourUtils.clickOnElement(productName, `a:contains(${productName})`)); + steps.push(wTourUtils.clickOnElement('Add to cart', '#add_to_cart')); + if (productHasVariants) { + steps.push(wTourUtils.clickOnElement('Continue Shopping', 'button:contains("Continue Shopping")')); } + return steps; +} - /** - * Used to assert if the price attribute of a given product is correct on the /shop view - */ - function assertProductPrice(attribute, value, productName) { - return { - content: `The ${attribute} of the ${productName} is ${value}`, - trigger: `div:contains("${productName}") [data-oe-expression="template_price_vals['${attribute}']"] .oe_currency_value:contains("${value}")`, - run: () => {} - }; +function assertCartContains({productName, backend, notContains = false} = {}) { + let trigger = `a:contains(${productName})`; + + if (notContains) { + trigger = `:not(${trigger})`; } - - function fillAdressForm(adressParams = { - name: "John Doe", - phone: "123456789", - email: "johndoe@gmail.com", - street: "1 rue de la paix", - city: "Paris", - zip: "75000" - }) { - let steps = []; - steps.push({ - content: "Address filling", - trigger: 'select[name="country_id"]', - run: () => { - $('input[name="name"]').val(adressParams.name); - $('input[name="phone"]').val(adressParams.phone); - $('input[name="email"]').val(adressParams.email); - $('input[name="street"]').val(adressParams.street); - $('input[name="city"]').val(adressParams.city); - $('input[name="zip"]').val(adressParams.zip); - $('#country_id option:eq(1)').attr('selected', true); - } - }); - steps.push({ - content: "Next", - trigger: '.oe_cart .btn:contains("Next")', - }); - return steps; - } - - function goToCart({quantity = 1, position = "bottom", backend = false} = {}) { - return { - content: _t("Go to cart"), - trigger: `${backend ? "iframe" : ""} a:has(.my_cart_quantity:containsExact(${quantity}))`, - position: position, - run: "click", - }; - } - - function searchProduct(productName) { - return [ - wTourUtils.clickOnElement('Shop', 'a:contains("Shop")'), - { - content: "Search for the product", - trigger: 'form input[name="search"]', - run: `text ${productName}` - }, - wTourUtils.clickOnElement('Search', 'form:has(input[name="search"]) .oe_search_button'), - ]; - } - - /** - * Used to select a pricelist on the /shop view - */ - function selectPriceList(pricelist) { - return [ - { - content: "Click on pricelist dropdown", - trigger: "div.o_pricelist_dropdown a[data-bs-toggle=dropdown]", - }, - { - content: "Click on pricelist", - trigger: `span:contains(${pricelist})`, - }, - ]; - } - - export default { - addToCart, - assertCartContains, - assertProductPrice, - fillAdressForm, - goToCart, - selectPriceList, - searchProduct, + return { + content: `Checking if ${productName} is in the cart`, + trigger: `${backend ? "iframe" : ""} ${trigger}`, + run: () => {} }; +} + +/** + * Used to assert if the price attribute of a given product is correct on the /shop view + */ +function assertProductPrice(attribute, value, productName) { + return { + content: `The ${attribute} of the ${productName} is ${value}`, + trigger: `div:contains("${productName}") [data-oe-expression="template_price_vals['${attribute}']"] .oe_currency_value:contains("${value}")`, + run: () => {} + }; +} + +function fillAdressForm(adressParams = { + name: "John Doe", + phone: "123456789", + email: "johndoe@gmail.com", + street: "1 rue de la paix", + city: "Paris", + zip: "75000" +}) { + let steps = []; + steps.push({ + content: "Address filling", + trigger: 'select[name="country_id"]', + run: () => { + $('input[name="name"]').val(adressParams.name); + $('input[name="phone"]').val(adressParams.phone); + $('input[name="email"]').val(adressParams.email); + $('input[name="street"]').val(adressParams.street); + $('input[name="city"]').val(adressParams.city); + $('input[name="zip"]').val(adressParams.zip); + $('#country_id option:eq(1)').attr('selected', true); + } + }); + steps.push({ + content: "Next", + trigger: '.oe_cart .btn:contains("Next")', + }); + return steps; +} + +function goToCart({quantity = 1, position = "bottom", backend = false} = {}) { + return { + content: _t("Go to cart"), + trigger: `${backend ? "iframe" : ""} a:has(.my_cart_quantity:containsExact(${quantity}))`, + position: position, + run: "click", + }; +} + +function searchProduct(productName) { + return [ + wTourUtils.clickOnElement('Shop', 'a:contains("Shop")'), + { + content: "Search for the product", + trigger: 'form input[name="search"]', + run: `text ${productName}` + }, + wTourUtils.clickOnElement('Search', 'form:has(input[name="search"]) .oe_search_button'), + ]; +} + +/** + * Used to select a pricelist on the /shop view + */ +function selectPriceList(pricelist) { + return [ + { + content: "Click on pricelist dropdown", + trigger: "div.o_pricelist_dropdown a[data-bs-toggle=dropdown]", + }, + { + content: "Click on pricelist", + trigger: `span:contains(${pricelist})`, + }, + ]; +} + +export default { + addToCart, + assertCartContains, + assertProductPrice, + fillAdressForm, + goToCart, + selectPriceList, + searchProduct, +}; diff --git a/addons/website_sale/static/tests/tours/website_free_delivery.js b/addons/website_sale/static/tests/tours/website_free_delivery.js index 62373008b38..4fcf1e15b79 100644 --- a/addons/website_sale/static/tests/tours/website_free_delivery.js +++ b/addons/website_sale/static/tests/tours/website_free_delivery.js @@ -6,7 +6,7 @@ import tourUtils from "website_sale.tour_utils"; registry.category("web_tour.tours").add('check_free_delivery', { test: true, url: '/shop?search=office chair black', - steps: [ + steps: () => [ // Part 1: Check free delivery { content: "select office chair black", diff --git a/addons/website_sale/static/tests/tours/website_sale_buy.js b/addons/website_sale/static/tests/tours/website_sale_buy.js index be7a5f8298c..b2c6729a345 100644 --- a/addons/website_sale/static/tests/tours/website_sale_buy.js +++ b/addons/website_sale/static/tests/tours/website_sale_buy.js @@ -6,7 +6,7 @@ import tourUtils from "website_sale.tour_utils"; registry.category("web_tour.tours").add('shop_buy_product', { test: true, url: '/shop', - steps: [ + steps: () => [ { content: "search conference chair", trigger: 'form input[name="search"]', diff --git a/addons/website_sale/static/tests/tours/website_sale_cart_popover.js b/addons/website_sale/static/tests/tours/website_sale_cart_popover.js index 62550ff8783..9587c6612f3 100644 --- a/addons/website_sale/static/tests/tours/website_sale_cart_popover.js +++ b/addons/website_sale/static/tests/tours/website_sale_cart_popover.js @@ -6,7 +6,7 @@ import wTourUtils from 'website.tour_utils'; registry.category("web_tour.tours").add('website_sale_cart_popover_tour', { test: true, url: '/shop', - steps: [ + steps: () => [ { content: "Search for the product", trigger: 'form input[name="search"]', diff --git a/addons/website_sale/static/tests/tours/website_sale_category_page_and_products_snippet.js b/addons/website_sale/static/tests/tours/website_sale_category_page_and_products_snippet.js index 855ec3a72e0..3ba380bc86a 100644 --- a/addons/website_sale/static/tests/tours/website_sale_category_page_and_products_snippet.js +++ b/addons/website_sale/static/tests/tours/website_sale_category_page_and_products_snippet.js @@ -32,7 +32,7 @@ wTourUtils.registerWebsitePreviewTour('category_page_and_products_snippet_editio registry.category("web_tour.tours").add('category_page_and_products_snippet_use', { test: true, url: `/shop/category/${PRODUCT_CATEGORY_ID}`, - steps: [ + steps: () => [ { content: "Check that the snippet displays the right products", // Wait for at least one shown product diff --git a/addons/website_sale/static/tests/tours/website_sale_complete_flow.js b/addons/website_sale/static/tests/tours/website_sale_complete_flow.js index b46d8e3aba5..12787e6a20a 100644 --- a/addons/website_sale/static/tests/tours/website_sale_complete_flow.js +++ b/addons/website_sale/static/tests/tours/website_sale_complete_flow.js @@ -8,7 +8,7 @@ test: true, checkDelay: 250, url: '/shop?search=Storage Box Test', - steps: [ + steps: () => [ // Testing b2c with Tax-Excluded Prices { content: "Open product page", @@ -327,7 +327,7 @@ registry.category("web_tour.tours").add('website_sale_tour_2', { test: true, url: '/shop/cart', - steps: [ + steps: () => [ { content: "Open Dropdown for logout", extra_trigger: '.progress-wizard-step:contains("Extra Info")', diff --git a/addons/website_sale/static/tests/tours/website_sale_google_analytics.js b/addons/website_sale/static/tests/tours/website_sale_google_analytics.js index 1bef46416c4..a51dfa72500 100644 --- a/addons/website_sale/static/tests/tours/website_sale_google_analytics.js +++ b/addons/website_sale/static/tests/tours/website_sale_google_analytics.js @@ -18,7 +18,7 @@ websiteSaleTracking.include({ registry.category("web_tour.tours").add('google_analytics_view_item', { test: true, url: '/shop?search=Customizable Desk', - steps: [ + steps: () => [ { content: "select customizable desk", trigger: '.oe_product_cart a:contains("Customizable Desk")', @@ -50,7 +50,7 @@ registry.category("web_tour.tours").add('google_analytics_view_item', { registry.category("web_tour.tours").add('google_analytics_add_to_cart', { test: true, url: '/shop?search=Acoustic Bloc Screens', - steps: [ + steps: () => [ { content: "select Acoustic Bloc Screens", trigger: '.oe_product_cart a:contains("Acoustic Bloc Screens")', diff --git a/addons/website_sale/static/tests/tours/website_sale_reorder_from_portal.js b/addons/website_sale/static/tests/tours/website_sale_reorder_from_portal.js index 0ad6b10713a..755bcfc1a34 100644 --- a/addons/website_sale/static/tests/tours/website_sale_reorder_from_portal.js +++ b/addons/website_sale/static/tests/tours/website_sale_reorder_from_portal.js @@ -7,7 +7,7 @@ import wTourUtils from 'website.tour_utils'; registry.category("web_tour.tours").add('website_sale_reorder_from_portal', { test: true, url: '/my/orders', - steps: [ + steps: () => [ // Initial reorder, nothing in cart { content: 'Select first order', diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_archived_variant_multi.js b/addons/website_sale/static/tests/tours/website_sale_shop_archived_variant_multi.js index 01bdfe542b8..99d9f5087e5 100644 --- a/addons/website_sale/static/tests/tours/website_sale_shop_archived_variant_multi.js +++ b/addons/website_sale/static/tests/tours/website_sale_shop_archived_variant_multi.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('tour_shop_archived_variant_multi', { test: true, url: '/shop?search=Test Product 2', - steps: [ + steps: () => [ { content: "select Test Product", trigger: '.oe_product_cart a:containsExact("Test Product 2")', diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_cart_recovery.js b/addons/website_sale/static/tests/tours/website_sale_shop_cart_recovery.js index 0cc1c5efe81..32a45701f55 100644 --- a/addons/website_sale/static/tests/tours/website_sale_shop_cart_recovery.js +++ b/addons/website_sale/static/tests/tours/website_sale_shop_cart_recovery.js @@ -10,7 +10,7 @@ var recoveryLinkKey = 'website_sale.tour_shop_cart_recovery.recoveryLink'; registry.category("web_tour.tours").add('shop_cart_recovery', { test: true, url: '/shop?search=Acoustic Bloc Screens', - steps: [ + steps: () => [ { content: "select Acoustic Bloc Screens", trigger: '.oe_product_cart a:containsExact("Acoustic Bloc Screens")', diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_compare_list_price_pricelist.js b/addons/website_sale/static/tests/tours/website_sale_shop_compare_list_price_pricelist.js index 6d0512a9af1..45fac825fa6 100644 --- a/addons/website_sale/static/tests/tours/website_sale_shop_compare_list_price_pricelist.js +++ b/addons/website_sale/static/tests/tours/website_sale_shop_compare_list_price_pricelist.js @@ -6,7 +6,7 @@ import tourUtils from 'website_sale.tour_utils'; registry.category("web_tour.tours").add('compare_list_price_price_list_display', { test: true, url: '/shop?search=test_product', - steps: [ + steps: () => [ tourUtils.assertProductPrice("price_reduce", "1,000", "test_product_default"), tourUtils.assertProductPrice("price_reduce", "2,000", "test_product_with_compare_list_price"), tourUtils.assertProductPrice("base_price", "2,500", "test_product_with_compare_list_price"), diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_custom_attribute_value.js b/addons/website_sale/static/tests/tours/website_sale_shop_custom_attribute_value.js index 9a27279c604..8f1c3d83784 100644 --- a/addons/website_sale/static/tests/tours/website_sale_shop_custom_attribute_value.js +++ b/addons/website_sale/static/tests/tours/website_sale_shop_custom_attribute_value.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add("shop_custom_attribute_value", { url: "/shop?search=Customizable Desk", test: true, - steps: [{ + steps: () => [{ content: "click on Customizable Desk", trigger: '.oe_product_cart a:contains("Customizable Desk (TEST)")', }, { diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_deleted_archived_variants.js b/addons/website_sale/static/tests/tours/website_sale_shop_deleted_archived_variants.js index e92f9dc7c04..f03048a1876 100644 --- a/addons/website_sale/static/tests/tours/website_sale_shop_deleted_archived_variants.js +++ b/addons/website_sale/static/tests/tours/website_sale_shop_deleted_archived_variants.js @@ -6,7 +6,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('tour_shop_deleted_archived_variants', { test: true, url: '/shop?search=Test Product 2', - steps: [ + steps: () => [ { content: "check price on /shop (template price)", trigger: '.oe_product_cart .oe_currency_value:contains("1.00")', diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_dynamic_variants.js b/addons/website_sale/static/tests/tours/website_sale_shop_dynamic_variants.js index c1bfb6f34c9..b64e07276f9 100644 --- a/addons/website_sale/static/tests/tours/website_sale_shop_dynamic_variants.js +++ b/addons/website_sale/static/tests/tours/website_sale_shop_dynamic_variants.js @@ -7,7 +7,7 @@ import tourUtils from "website_sale.tour_utils"; registry.category("web_tour.tours").add('tour_shop_dynamic_variants', { test: true, url: '/shop?search=Dynamic Product', - steps: [ + steps: () => [ { content: "select Dynamic Product", trigger: '.oe_product_cart a:containsExact("Dynamic Product")', diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_mail.js b/addons/website_sale/static/tests/tours/website_sale_shop_mail.js index 3315443c125..6d03ff722ac 100644 --- a/addons/website_sale/static/tests/tours/website_sale_shop_mail.js +++ b/addons/website_sale/static/tests/tours/website_sale_shop_mail.js @@ -7,7 +7,7 @@ import tourUtils from "website_sale.tour_utils"; registry.category("web_tour.tours").add('shop_mail', { test: true, url: '/', - steps: [ + steps: () => [ { content: "Change the domain of the websites and go to shop", trigger: 'body', diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_no_variant_attribute.js b/addons/website_sale/static/tests/tours/website_sale_shop_no_variant_attribute.js index e2f2827feab..849dc9e7d44 100644 --- a/addons/website_sale/static/tests/tours/website_sale_shop_no_variant_attribute.js +++ b/addons/website_sale/static/tests/tours/website_sale_shop_no_variant_attribute.js @@ -7,7 +7,7 @@ import tourUtils from "website_sale.tour_utils"; registry.category("web_tour.tours").add('tour_shop_no_variant_attribute', { test: true, url: '/shop?search=Test Product 3', - steps: [ + steps: () => [ { content: "select Test Product 3", trigger: '.oe_product_cart a:containsExact("Test Product 3")', diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_pricelist_tour.js b/addons/website_sale/static/tests/tours/website_sale_shop_pricelist_tour.js index 6b5c105be72..71eae28830d 100644 --- a/addons/website_sale/static/tests/tours/website_sale_shop_pricelist_tour.js +++ b/addons/website_sale/static/tests/tours/website_sale_shop_pricelist_tour.js @@ -7,7 +7,7 @@ registry.category("web_tour.tours").add( { test: true, url: '/shop', - steps: [ + steps: () => [ { content: "Check pricelist", trigger: ".o_pricelist_dropdown .dropdown-toggle:not(:contains('User Pricelist'))", diff --git a/addons/website_sale/static/tests/tours/website_sale_shop_zoom.js b/addons/website_sale/static/tests/tours/website_sale_shop_zoom.js index 1bce190c230..42fa9f59746 100644 --- a/addons/website_sale/static/tests/tours/website_sale_shop_zoom.js +++ b/addons/website_sale/static/tests/tours/website_sale_shop_zoom.js @@ -10,7 +10,7 @@ var nameGreen = "Forest Green"; registry.category("web_tour.tours").add('shop_zoom', { test: true, url: '/shop?debug=1&search=' + imageName, - steps: [ + steps: () => [ { content: "select " + imageName, trigger: '.oe_product_cart a:containsExact("' + imageName + '")', diff --git a/addons/website_sale_autocomplete/static/tests/autocomplete_tour.js b/addons/website_sale_autocomplete/static/tests/autocomplete_tour.js index 0eb0f4b4c3b..46cc48f1d15 100644 --- a/addons/website_sale_autocomplete/static/tests/autocomplete_tour.js +++ b/addons/website_sale_autocomplete/static/tests/autocomplete_tour.js @@ -12,7 +12,7 @@ function fail (errorMessage) { registry.category("web_tour.tours").add('autocomplete_tour', { test: true, url: '/shop', // /shop/address is redirected if no sales order - steps: [{ + steps: () => [{ content: "search test product", trigger: 'form input[name="search"]', run: "text A test product", diff --git a/addons/website_sale_comparison/static/tests/tours/website_sale_comparison.js b/addons/website_sale_comparison/static/tests/tours/website_sale_comparison.js index 73c1c2f2cb1..4062a714f80 100644 --- a/addons/website_sale_comparison/static/tests/tours/website_sale_comparison.js +++ b/addons/website_sale_comparison/static/tests/tours/website_sale_comparison.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add('product_comparison', { test: true, url: "/shop", - steps: [ + steps: () => [ // test from shop page { content: "add first product 'Warranty' in a comparison list", diff --git a/addons/website_sale_loyalty/static/tests/tours/test_gift_card_tour.js b/addons/website_sale_loyalty/static/tests/tours/test_gift_card_tour.js index 8bc53167efd..f487f56edb9 100644 --- a/addons/website_sale_loyalty/static/tests/tours/test_gift_card_tour.js +++ b/addons/website_sale_loyalty/static/tests/tours/test_gift_card_tour.js @@ -6,7 +6,7 @@ import tourUtils from 'website_sale.tour_utils'; registry.category("web_tour.tours").add('shop_sale_gift_card', { test: true, url: '/shop?search=Small%20Drawer', - steps: [ + steps: () => [ // Add a small drawer to the order (50$) { content: 'select Small Drawer', diff --git a/addons/website_sale_loyalty/static/tests/tours/test_promo_main_tour.js b/addons/website_sale_loyalty/static/tests/tours/test_promo_main_tour.js index 5b85fc9fa3d..f8e7ccf12a5 100644 --- a/addons/website_sale_loyalty/static/tests/tours/test_promo_main_tour.js +++ b/addons/website_sale_loyalty/static/tests/tours/test_promo_main_tour.js @@ -7,7 +7,7 @@ import tourUtils from 'website_sale.tour_utils'; registry.category("web_tour.tours").add('shop_sale_loyalty', { test: true, url: '/shop?search=Small%20Cabinet', - steps: [ + steps: () => [ /* 1. Buy 1 Small Cabinet, enable coupon code & insert 10% code */ { content: "select Small Cabinet", diff --git a/addons/website_sale_loyalty/static/tests/tours/website_sale_delivery_gift_card.js b/addons/website_sale_loyalty/static/tests/tours/website_sale_delivery_gift_card.js index 00e9606cde2..f1b35fe8b5f 100644 --- a/addons/website_sale_loyalty/static/tests/tours/website_sale_delivery_gift_card.js +++ b/addons/website_sale_loyalty/static/tests/tours/website_sale_delivery_gift_card.js @@ -6,7 +6,7 @@ import wsTourUtils from "website_sale.tour_utils"; registry.category("web_tour.tours").add('shop_sale_loyalty_delivery', { test: true, url: '/shop?search=Accoustic', - steps: [ + steps: () => [ { content: "select Small Cabinet", trigger: '.oe_product a:contains("Acoustic Bloc Screens")', diff --git a/addons/website_sale_picking/static/tests/tours/onsite_payment_tour.js b/addons/website_sale_picking/static/tests/tours/onsite_payment_tour.js index 294f9270bc0..b0e5f7d1184 100644 --- a/addons/website_sale_picking/static/tests/tours/onsite_payment_tour.js +++ b/addons/website_sale_picking/static/tests/tours/onsite_payment_tour.js @@ -7,7 +7,7 @@ import wsTourUtils from 'website_sale.tour_utils'; registry.category("web_tour.tours").add('onsite_payment_tour', { test: true, url: '/web', - steps: [ + steps: () => [ ...wsTourUtils.addToCart({productName: 'Chair floor protection'}), wsTourUtils.goToCart(), wTourUtils.clickOnElement('Proceed to checkout', 'a:contains(Process Checkout)'), diff --git a/addons/website_sale_product_configurator/static/tests/tours/website_sale_buy.js b/addons/website_sale_product_configurator/static/tests/tours/website_sale_buy.js index 7b82bbed114..48cd291cc09 100644 --- a/addons/website_sale_product_configurator/static/tests/tours/website_sale_buy.js +++ b/addons/website_sale_product_configurator/static/tests/tours/website_sale_buy.js @@ -4,11 +4,17 @@ * by the product configurator module. */ import { registry } from "@web/core/registry"; +import { patch } from "@web/core/utils/patch"; import "website_sale.tour"; -var addCartStepIndex = registry.category("web_tour.tours").get("shop_buy_product").steps.findIndex(step => step.id === 'add_cart_step'); - -registry.category("web_tour.tours").get("shop_buy_product").steps.splice(addCartStepIndex + 1, 1, { - content: "click in modal on 'Proceed to checkout' button", - trigger: 'button:contains("Proceed to Checkout")', +patch(registry.category("web_tour.tours").get("shop_buy_product"), "patch_shop_buy_product", { + steps() { + const originalSteps = this._super(); + const addCartStepIndex = originalSteps.findIndex((step) => step.id === "add_cart_step"); + originalSteps.splice(addCartStepIndex + 1, 1, { + content: "click in modal on 'Proceed to checkout' button", + trigger: 'button:contains("Proceed to Checkout")', + }); + return originalSteps; + }, }); diff --git a/addons/website_sale_product_configurator/static/tests/tours/website_sale_preconfigured_variant_price.js b/addons/website_sale_product_configurator/static/tests/tours/website_sale_preconfigured_variant_price.js index 79a7f87e4b7..136666d1ef0 100644 --- a/addons/website_sale_product_configurator/static/tests/tours/website_sale_preconfigured_variant_price.js +++ b/addons/website_sale_product_configurator/static/tests/tours/website_sale_preconfigured_variant_price.js @@ -4,7 +4,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('website_sale_product_configurator_optional_products_tour', { test: true, - steps: [{ + steps: () => [{ name: 'Click Aluminium Option', trigger: 'ul.js_add_cart_variants span:contains("Aluminium")', extra_trigger: 'ul.js_add_cart_variants span:contains("Aluminium") ~ span.badge:contains("50.40")', diff --git a/addons/website_sale_product_configurator/static/tests/tours/website_sale_shop_custom_attributes_value.js b/addons/website_sale_product_configurator/static/tests/tours/website_sale_shop_custom_attributes_value.js index aaf339d9a22..85e3c3d71d5 100644 --- a/addons/website_sale_product_configurator/static/tests/tours/website_sale_shop_custom_attributes_value.js +++ b/addons/website_sale_product_configurator/static/tests/tours/website_sale_shop_custom_attributes_value.js @@ -6,7 +6,7 @@ var optionVariantImage; registry.category("web_tour.tours").add("a_shop_custom_attribute_value", { url: "/shop?search=Customizable Desk", test: true, - steps: [{ + steps: () => [{ content: "click on Customizable Desk", trigger: '.oe_product_cart a:contains("Customizable Desk (TEST)")', }, { diff --git a/addons/website_sale_product_configurator/static/tests/tours/website_sale_variants_modal_window.js b/addons/website_sale_product_configurator/static/tests/tours/website_sale_variants_modal_window.js index 2822e292a83..abf2a5f1557 100644 --- a/addons/website_sale_product_configurator/static/tests/tours/website_sale_variants_modal_window.js +++ b/addons/website_sale_product_configurator/static/tests/tours/website_sale_variants_modal_window.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add('tour_variants_modal_window', { test: true, url: '/shop?search=Short (TEST)', - steps: [ + steps: () => [ { content: "Select the Short (TEST) product", trigger: '.oe_product_cart a:containsExact("Short (TEST)")', diff --git a/addons/website_sale_slides/static/tests/tours/slides_course_member_invited_logged.js b/addons/website_sale_slides/static/tests/tours/slides_course_member_invited_logged.js index 4d3a96426e2..82770d7af7e 100644 --- a/addons/website_sale_slides/static/tests/tours/slides_course_member_invited_logged.js +++ b/addons/website_sale_slides/static/tests/tours/slides_course_member_invited_logged.js @@ -5,7 +5,7 @@ import { registry } from '@web/core/registry'; registry.category('web_tour.tours').add('invited_on_payment_course_logged', { test: true, - steps: [ + steps: () => [ { trigger: 'a:contains("Add to Cart")', content: 'Check that the course can be bought but not joined', diff --git a/addons/website_sale_slides/static/tests/tours/slides_course_member_invited_public.js b/addons/website_sale_slides/static/tests/tours/slides_course_member_invited_public.js index c93abe668bf..da1ded9538e 100644 --- a/addons/website_sale_slides/static/tests/tours/slides_course_member_invited_public.js +++ b/addons/website_sale_slides/static/tests/tours/slides_course_member_invited_public.js @@ -5,7 +5,7 @@ import { registry } from '@web/core/registry'; registry.category('web_tour.tours').add('invited_on_payment_course_public', { test: true, - steps: [ + steps: () => [ { trigger: '.o_wslides_identification_banner a:contains("Log in")', content: 'Check that there is an identification banner', diff --git a/addons/website_sale_stock/static/src/js/tours/website_sale_stock_reorder_from_portal.js b/addons/website_sale_stock/static/src/js/tours/website_sale_stock_reorder_from_portal.js index 935e8ccc3d4..0ac28fd1ecc 100644 --- a/addons/website_sale_stock/static/src/js/tours/website_sale_stock_reorder_from_portal.js +++ b/addons/website_sale_stock/static/src/js/tours/website_sale_stock_reorder_from_portal.js @@ -6,7 +6,7 @@ import wTourUtils from 'website.tour_utils'; registry.category("web_tour.tours").add('website_sale_stock_reorder_from_portal', { test: true, url: '/my/orders', - steps: [ + steps: () => [ { content: 'Select first order', trigger: '.o_portal_my_doc_table a:first', diff --git a/addons/website_sale_stock/static/tests/tours/website_sale_stock_message_after_close_configurator_modal.js b/addons/website_sale_stock/static/tests/tours/website_sale_stock_message_after_close_configurator_modal.js index 8045856ab51..3742fafac2f 100644 --- a/addons/website_sale_stock/static/tests/tours/website_sale_stock_message_after_close_configurator_modal.js +++ b/addons/website_sale_stock/static/tests/tours/website_sale_stock_message_after_close_configurator_modal.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add('website_sale_stock_message_after_close_ // This tour relies on a data created from the python test. test: true, url: '/shop?search=Product With Optional (TEST)', - steps: [{ + steps: () => [{ content: "Select Customizable Desk", trigger: '.oe_product_cart a:contains("Product With Optional (TEST)")', },{ @@ -32,7 +32,7 @@ registry.category("web_tour.tours").add('website_sale_stock_message_after_close_ // This tour relies on a data created from the python test. test: true, url: '/shop?search=Product Without Optional (TEST)', - steps: [{ + steps: () => [{ content: "Select Office Lamp", trigger: '.oe_product_cart a:contains("Product Without Optional (TEST)")', },{ diff --git a/addons/website_sale_stock/static/tests/tours/website_sale_stock_multilang.js b/addons/website_sale_stock/static/tests/tours/website_sale_stock_multilang.js index 6585c08146d..45f0fca5abc 100644 --- a/addons/website_sale_stock/static/tests/tours/website_sale_stock_multilang.js +++ b/addons/website_sale_stock/static/tests/tours/website_sale_stock_multilang.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('website_sale_stock_multilang', { test: true, url: '/fr/shop?search=unavailable', - steps: [{ + steps: () => [{ content: "Open unavailable product page", trigger: 'a[content="unavailable_product"]', }, { diff --git a/addons/website_sale_stock/static/tests/tours/website_sale_stock_stock_notification.js b/addons/website_sale_stock/static/tests/tours/website_sale_stock_stock_notification.js index d836a4f3921..0a024c1404f 100644 --- a/addons/website_sale_stock/static/tests/tours/website_sale_stock_stock_notification.js +++ b/addons/website_sale_stock/static/tests/tours/website_sale_stock_stock_notification.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('back_in_stock_notification_product', { test: true, url: '/shop?search=Macbook%20Pro', - steps: [ + steps: () => [ { content: "Open product page", trigger: 'a:contains("Macbook Pro")', diff --git a/addons/website_sale_stock_wishlist/static/tests/tours/website_sale_stock_wishlist_stock_notification.js b/addons/website_sale_stock_wishlist/static/tests/tours/website_sale_stock_wishlist_stock_notification.js index eebf8b470bd..2c91c535754 100644 --- a/addons/website_sale_stock_wishlist/static/tests/tours/website_sale_stock_wishlist_stock_notification.js +++ b/addons/website_sale_stock_wishlist/static/tests/tours/website_sale_stock_wishlist_stock_notification.js @@ -5,7 +5,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('stock_notification_wishlist', { test: true, url: '/shop/wishlist', - steps: [ + steps: () => [ { content: "Click on 'Be notified when back in stock'", trigger: '#wishlist_stock_notification_message', diff --git a/addons/website_sale_wishlist/static/tests/tours/website_sale_wishlist.js b/addons/website_sale_wishlist/static/tests/tours/website_sale_wishlist.js index f0a23033fe5..fc45f69444c 100644 --- a/addons/website_sale_wishlist/static/tests/tours/website_sale_wishlist.js +++ b/addons/website_sale_wishlist/static/tests/tours/website_sale_wishlist.js @@ -7,7 +7,7 @@ registry.category("web_tour.tours").add('shop_wishlist', { test: true, checkDelay: 250, url: '/shop?search=Customizable Desk', - steps: [ + steps: () => [ { content: "click on add to wishlist", trigger: '.o_add_wishlist', diff --git a/addons/website_slides/static/tests/tours/slides_course_member.js b/addons/website_slides/static/tests/tours/slides_course_member.js index 534a635d656..b8e720d4894 100644 --- a/addons/website_slides/static/tests/tours/slides_course_member.js +++ b/addons/website_slides/static/tests/tours/slides_course_member.js @@ -14,7 +14,7 @@ import { registry } from "@web/core/registry"; registry.category("web_tour.tours").add('course_member', { url: '/slides', test: true, - steps: [ + steps: () => [ // eLearning: go on free course and join it { trigger: 'a:contains("Basics of Gardening - Test")' diff --git a/addons/website_slides/static/tests/tours/slides_course_member_invited_logged.js b/addons/website_slides/static/tests/tours/slides_course_member_invited_logged.js index 7e6f01fce60..82404a20fc7 100644 --- a/addons/website_slides/static/tests/tours/slides_course_member_invited_logged.js +++ b/addons/website_slides/static/tests/tours/slides_course_member_invited_logged.js @@ -5,7 +5,7 @@ import { registry } from '@web/core/registry'; registry.category('web_tour.tours').add('invite_check_channel_preview_as_logged', { test: true, - steps: [ + steps: () => [ { trigger: 'a:contains("Gardening: The Know-How")', content: 'Check that the previews are accessible', diff --git a/addons/website_slides/static/tests/tours/slides_course_member_invited_public.js b/addons/website_slides/static/tests/tours/slides_course_member_invited_public.js index db230c92886..7eabcd600c7 100644 --- a/addons/website_slides/static/tests/tours/slides_course_member_invited_public.js +++ b/addons/website_slides/static/tests/tours/slides_course_member_invited_public.js @@ -5,7 +5,7 @@ import { registry } from '@web/core/registry'; registry.category('web_tour.tours').add('invite_check_channel_preview_as_public', { test: true, - steps: [ + steps: () => [ { trigger: '.o_wslides_identification_banner', content: 'Check that there is an identification banner', diff --git a/addons/website_slides/static/tests/tours/slides_course_member_yt.js b/addons/website_slides/static/tests/tours/slides_course_member_yt.js index a2381257144..1e5d58a2788 100644 --- a/addons/website_slides/static/tests/tours/slides_course_member_yt.js +++ b/addons/website_slides/static/tests/tours/slides_course_member_yt.js @@ -31,7 +31,7 @@ FullScreen.include({ registry.category("web_tour.tours").add('course_member_youtube', { url: '/slides', test: true, - steps: [ + steps: () => [ // eLearning: go on /all, find free course and join it { trigger: 'a.o_wslides_home_all_slides' diff --git a/addons/website_slides/static/tests/tours/slides_course_reviews.js b/addons/website_slides/static/tests/tours/slides_course_reviews.js index 0f82186480b..78fe687fa03 100644 --- a/addons/website_slides/static/tests/tours/slides_course_reviews.js +++ b/addons/website_slides/static/tests/tours/slides_course_reviews.js @@ -10,7 +10,7 @@ import { registry } from '@web/core/registry'; registry.category('web_tour.tours').add('course_reviews', { url: '/slides', test: true, - steps: [ + steps: () => [ { trigger: 'a:contains("Basics of Gardening - Test")', }, { diff --git a/odoo/addons/base/static/tests/test_ir_model_fields_translation.js b/odoo/addons/base/static/tests/test_ir_model_fields_translation.js index 37633b0aba8..99095c37461 100644 --- a/odoo/addons/base/static/tests/test_ir_model_fields_translation.js +++ b/odoo/addons/base/static/tests/test_ir_model_fields_translation.js @@ -28,11 +28,11 @@ function checkLoginColumn(translation) { registry.category("web_tour.tours").add('ir_model_fields_translation_tour', { test: true, url: '/web', - steps: checkLoginColumn('Identifiant') + steps: () => checkLoginColumn('Identifiant') }); registry.category("web_tour.tours").add('ir_model_fields_translation_tour2', { test: true, url: '/web', - steps: checkLoginColumn('Identifiant2') + steps: () => checkLoginColumn('Identifiant2') }); diff --git a/odoo/addons/test_apikeys/static/tests/apikey_flow.js b/odoo/addons/test_apikeys/static/tests/apikey_flow.js index c9a212ffa7d..6280aca4b7f 100644 --- a/odoo/addons/test_apikeys/static/tests/apikey_flow.js +++ b/odoo/addons/test_apikeys/static/tests/apikey_flow.js @@ -6,7 +6,7 @@ import ajax from "web.ajax"; registry.category("web_tour.tours").add('apikeys_tour_setup', { test: true, url: '/web?debug=1', // Needed as API key part is now only displayed in debug mode - steps: [{ + steps: () => [{ content: 'Open user account menu', trigger: '.o_user_menu .dropdown-toggle', run: 'click', @@ -65,7 +65,7 @@ registry.category("web_tour.tours").add('apikeys_tour_setup', { registry.category("web_tour.tours").add('apikeys_tour_teardown', { test: true, url: '/web?debug=1', // Needed as API key part is now only displayed in debug mode - steps: [{ + steps: () => [{ content: 'Open preferences', trigger: '.o_user_menu .dropdown-toggle', }, { diff --git a/odoo/addons/test_main_flows/static/tests/tours/main_flow.js b/odoo/addons/test_main_flows/static/tests/tours/main_flow.js index ab28450c37c..ecd5cfec880 100644 --- a/odoo/addons/test_main_flows/static/tests/tours/main_flow.js +++ b/odoo/addons/test_main_flows/static/tests/tours/main_flow.js @@ -9,7 +9,7 @@ import "web.legacy_tranlations_loaded"; registry.category("web_tour.tours").add('main_flow_tour', { test: true, url: "/web", - steps: [ + steps: () => [ ...stepUtils.goToAppSteps('sale.sale_menu_root', Markup(_t('Organize your sales activities with the Sales app.'))), stepUtils.openBurgerMenu(".o_breadcrumb .active:contains('Quotations')"), { diff --git a/odoo/addons/test_new_api/static/tests/tours/constraint.js b/odoo/addons/test_new_api/static/tests/tours/constraint.js index 7121ad312a7..4c643b70ca5 100644 --- a/odoo/addons/test_new_api/static/tests/tours/constraint.js +++ b/odoo/addons/test_new_api/static/tests/tours/constraint.js @@ -6,7 +6,7 @@ registry.category("web_tour.tours").add('sql_constaint', { url: '/web?debug=1#action=test_new_api.action_categories', test: true, - steps: [ + steps: () => [ { content: "wait web client", trigger: '.o_breadcrumb:contains(Categories)', diff --git a/odoo/addons/test_new_api/static/tests/tours/x2many.js b/odoo/addons/test_new_api/static/tests/tours/x2many.js index 17ce6937193..4e80b622a5c 100644 --- a/odoo/addons/test_new_api/static/tests/tours/x2many.js +++ b/odoo/addons/test_new_api/static/tests/tours/x2many.js @@ -7,7 +7,7 @@ registry.category("web_tour.tours").add('widget_x2many', { url: '/web?debug=tests#action=test_new_api.action_discussions', test: true, - steps: [ + steps: () => [ ///////////////////////////////////////////////////////////////////////////////////////////// // Discussions /////////////////////////////////////////////////////////////////////////////////////////////