From 0cf51928ac7236e9e7b52c472ea69c073080d680 Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Mon, 21 Sep 2020 12:27:39 +0000 Subject: [PATCH] [FIX] pos_restaurant: runbot random error on clicking table Checking the log of the runbot error, there is an extra `create_from_ui` rpc call for `restaurant.floor`. This is because when table T4 is clicked, it is still an `EditableTable`. It is possible that the full rendering after toggling edit mode isn't complete and the tour proceeds because it sees table T4 in the dom, when in fact the table we want to click should not be `EditableTable` instead a `TableWidget`. This is random because the tour may proceed as long at it sees the trigger element, even if the owl rendering is not finished. In this commit, we make sure that we click the correct element which is an unselected table. So we check if table T4 is unselected before clicking table T4 to open the product screen. To reproduce, follow instructions here: https://gist.github.com/caburj/ef311076a24d898132ed9c6b99367581 closes odoo/odoo#58151 X-original-commit: 238a65f59202d279d2c9327dd7937f125d80175b Signed-off-by: pimodoo --- .../static/tests/tours/FloorScreen.tour.js | 2 +- .../static/tests/tours/helpers/FloorScreenTourMethods.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/pos_restaurant/static/tests/tours/FloorScreen.tour.js b/addons/pos_restaurant/static/tests/tours/FloorScreen.tour.js index f4e12080305..af52936264c 100644 --- a/addons/pos_restaurant/static/tests/tours/FloorScreen.tour.js +++ b/addons/pos_restaurant/static/tests/tours/FloorScreen.tour.js @@ -93,7 +93,7 @@ odoo.define('pos_restaurant.tour.FloorScreen', function (require) { // Opening product screen in main floor should go back to main floor FloorScreen.do.clickEdit(); FloorScreen.check.editModeIsActive(false); - FloorScreen.check.hasTable('T4'); + FloorScreen.check.tableIsNotSelected('T4'); FloorScreen.do.clickTable('T4'); ProductScreen.check.isShown(); Chrome.check.backToFloorTextIs('Main Floor', 'T4'); diff --git a/addons/pos_restaurant/static/tests/tours/helpers/FloorScreenTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/FloorScreenTourMethods.js index b6e614357f0..733fd26d90a 100644 --- a/addons/pos_restaurant/static/tests/tours/helpers/FloorScreenTourMethods.js +++ b/addons/pos_restaurant/static/tests/tours/helpers/FloorScreenTourMethods.js @@ -140,6 +140,15 @@ odoo.define('pos_restaurant.tour.FloorScreenTourMethods', function (require) { }, ]; } + tableIsNotSelected(name) { + return [ + { + content: `table '${name}' is not selected`, + trigger: `.floor-map .table:not(.selected) .label:contains("${name}")`, + run: function () {}, + }, + ]; + } } class Execute {}