From cab75e7969a086dae7ba282a24150677dd68405c Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Thu, 3 Sep 2020 14:05:15 +0000 Subject: [PATCH] [FIX] pos_restaurant: order management screen random runbot error Initial rendering of order management screen shows the list of orders based on the previous render. This is done so that during fetching of new orders from the server, a list of orders are already shown. This optimization causes a random runbot error when transferring an order from one table to the other. The moment the order management screen is open, it will render orders with the old table, but right after fetching of orders, the listed orders are immediately updated. To rectify the random error, we modify the test so that instead of immediately clicking the transferred order, we wait for its new table to show before selecting it. closes odoo/odoo#57104 X-original-commit: 713dd3777ca0ce9d121d5162a3d63de3237509f4 Signed-off-by: pimodoo Signed-off-by: Joseph Caburnay (jcb) --- .../tours/helpers/OrderManagementScreenTourMethods.js | 8 ++++++-- .../static/tests/tours/OrderManagementScreen.tour.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/tests/tours/helpers/OrderManagementScreenTourMethods.js b/addons/point_of_sale/static/tests/tours/helpers/OrderManagementScreenTourMethods.js index b00453e0b4d..26e48589134 100644 --- a/addons/point_of_sale/static/tests/tours/helpers/OrderManagementScreenTourMethods.js +++ b/addons/point_of_sale/static/tests/tours/helpers/OrderManagementScreenTourMethods.js @@ -12,11 +12,15 @@ odoo.define('point_of_sale.tour.OrderManagementScreenTourMethods', function (req }, ]; } - clickOrder(name) { + clickOrder(name, [otherCol, otherColVal] = [null, null]) { + let trigger = `.order-management-screen .order-list .order-row .item.name:contains("${name}")`; + if (otherCol) { + trigger = `${trigger} ~ .item.${otherCol}:contains("${otherColVal}")`; + } return [ { content: `clicking order '${name}' from orderlist`, - trigger: `.order-management-screen .order-list .order-row .item:contains("${name}")`, + trigger, }, ]; } diff --git a/addons/pos_restaurant/static/tests/tours/OrderManagementScreen.tour.js b/addons/pos_restaurant/static/tests/tours/OrderManagementScreen.tour.js index cac1822f4af..bc64f36829c 100644 --- a/addons/pos_restaurant/static/tests/tours/OrderManagementScreen.tour.js +++ b/addons/pos_restaurant/static/tests/tours/OrderManagementScreen.tour.js @@ -106,7 +106,7 @@ odoo.define('pos_restaurant.tour.OrderManagementScreen', function (require) { OrderManagementScreen.check.isShown(); // select order 0004 and check if it is now in T2 - OrderManagementScreen.do.clickOrder('-0004'); + OrderManagementScreen.do.clickOrder('-0004', ['table', 'T2']); ProductScreen.check.isShown(); ProductScreen.check.totalAmountIs('278'); Chrome.check.backToFloorTextIs('Main Floor', 'T2');