summaryrefslogtreecommitdiff
path: root/addons/pos_restaurant
diff options
context:
space:
mode:
authorJoseph Caburnay <jcb@odoo.com>2020-09-02 07:33:44 +0000
committerJoseph Caburnay <jcb@odoo.com>2020-09-02 11:52:28 +0000
commit2ef73bb64cd0730d1e078a47f2ea9e1290b0df6c (patch)
treeecc8e653dae87b8a52f428498b5543e3bae62608 /addons/pos_restaurant
parent6da14a3aadeb3efc40f145f6c11fc33314b2f15e (diff)
[FIX] point_of_sale,pos_restaurant: remove step_delay in pos test tours
Tours with `step_delay` potentially hide errors because of missing tour steps. This is mainly caused by unfinished renders within the `step_delay` between two steps. It is possible that the render after the 1st trigger is not yet finished but the 2nd step trigger already existed in the screen. Because the render result of 1st step is late and the 2nd step is already triggered, the 3rd step will fail. Note that the 3rd step will occassionally fail because render of the 1st step is most of the time faster than step_delay but there is no guarantee that the render is always faster because of occassional cpu slow downs. Runbot will eventually catch these tour errors which it did with the ticket screen tour. In this commit, we removed the `step_delay` in the pos tours. We also supplemented the missing step in the ticket screen tour which was the cause of random runbot error when there was `step_delay`. We also figured that value property of input element is not observed by the tour service's mutation observer, which result to an indeterministic error in a step in tip screen. To fix this, we introduce an attribute to the input element which is used in the step trigger. closes odoo/odoo#56949 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons/pos_restaurant')
-rw-r--r--addons/pos_restaurant/static/src/xml/Screens/TipScreen.xml2
-rw-r--r--addons/pos_restaurant/static/tests/tours/TicketScreen.tour.js2
-rw-r--r--addons/pos_restaurant/static/tests/tours/helpers/TipScreenTourMethods.js8
-rw-r--r--addons/pos_restaurant/tests/test_frontend.py6
4 files changed, 8 insertions, 10 deletions
diff --git a/addons/pos_restaurant/static/src/xml/Screens/TipScreen.xml b/addons/pos_restaurant/static/src/xml/Screens/TipScreen.xml
index 9142977513e..8244ca0bddc 100644
--- a/addons/pos_restaurant/static/src/xml/Screens/TipScreen.xml
+++ b/addons/pos_restaurant/static/src/xml/Screens/TipScreen.xml
@@ -45,7 +45,7 @@
<div class="custom-amount-form">
<div class="item label">Amount</div>
<div class="item input">
- <input type="text" t-model="state.inputTipAmount" />
+ <input type="text" t-model="state.inputTipAmount" t-att-data-amount="state.inputTipAmount" />
<div class="currency">
<t t-esc="env.pos.getCurrencySymbol()" />
</div>
diff --git a/addons/pos_restaurant/static/tests/tours/TicketScreen.tour.js b/addons/pos_restaurant/static/tests/tours/TicketScreen.tour.js
index 6f176d84173..0f80cd95b55 100644
--- a/addons/pos_restaurant/static/tests/tours/TicketScreen.tour.js
+++ b/addons/pos_restaurant/static/tests/tours/TicketScreen.tour.js
@@ -17,6 +17,8 @@ odoo.define('pos_restaurant.tour.TicketScreen', function (require) {
// Deleting the last order in the table brings back to floorscreen
FloorScreen.do.clickTable('T4');
+ // Clicking ticket button without checking if floor screen is shown causes an error
+ FloorScreen.check.isShown();
Chrome.do.clickTicketButton();
TicketScreen.check.nthRowContains(2, '-0001');
TicketScreen.do.deleteOrder('-0001');
diff --git a/addons/pos_restaurant/static/tests/tours/helpers/TipScreenTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/TipScreenTourMethods.js
index e0ba53ecb63..8895d566c31 100644
--- a/addons/pos_restaurant/static/tests/tours/helpers/TipScreenTourMethods.js
+++ b/addons/pos_restaurant/static/tests/tours/helpers/TipScreenTourMethods.js
@@ -49,12 +49,8 @@ odoo.define('pos_restaurant.tour.TipScreenTourMethods', function (require) {
inputAmountIs(amount) {
return [
{
- trigger: `.tip-screen .custom-amount-form input`,
- run: function() {
- if (this.$anchor.val().indexOf(amount) === -1) {
- throw new Error(`".tip-screen .custom-amount-form input" element does not contain ${amount}.`)
- };
- },
+ trigger: `.tip-screen .custom-amount-form input[data-amount="${amount}"]`,
+ run: () => {},
}
]
}
diff --git a/addons/pos_restaurant/tests/test_frontend.py b/addons/pos_restaurant/tests/test_frontend.py
index 710e226b678..dfb5a13adda 100644
--- a/addons/pos_restaurant/tests/test_frontend.py
+++ b/addons/pos_restaurant/tests/test_frontend.py
@@ -178,16 +178,16 @@ class TestFrontend(odoo.tests.HttpCase):
def test_03_order_management_integration(self):
self.pos_config.write({'manage_orders': True})
self.pos_config.with_user(self.env.ref('base.user_admin')).open_session_cb(check_coa=False)
- self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'PosResOrderManagementScreenTour', login="admin", step_delay=50)
+ self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'PosResOrderManagementScreenTour', login="admin")
def test_04_ticket_screen(self):
self.pos_config.with_user(self.env.ref('base.user_admin')).open_session_cb(check_coa=False)
- self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'PosResTicketScreenTour', login="admin", step_delay=50)
+ self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'PosResTicketScreenTour', login="admin")
def test_05_tip_screen(self):
self.pos_config.write({'set_tip_after_payment': True, 'iface_tipproduct': True, 'tip_product_id': self.env.ref('point_of_sale.product_product_tip')})
self.pos_config.with_user(self.env.ref('base.user_admin')).open_session_cb(check_coa=False)
- self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'PosResTipScreenTour', login="admin", step_delay=50)
+ self.start_tour("/pos/ui?config_id=%d" % self.pos_config.id, 'PosResTipScreenTour', login="admin")
order1 = self.env['pos.order'].search([('pos_reference', 'ilike', '%-0001')])
order2 = self.env['pos.order'].search([('pos_reference', 'ilike', '%-0002')])