From ebbb81f2de802ee9d47b170253d0abcc86644474 Mon Sep 17 00:00:00 2001 From: "Adrien Guilliams (adgu)" Date: Thu, 29 Jun 2023 08:14:50 +0000 Subject: [PATCH] [FIX] pos_restaurant: assertion of restaurant tour not ok The pos_restaurant first test (test_01_pos_restaurant) has an assertion that failed due to the fact that the deleteion of an order is not awaited in the frontend. This led to the tour finishing very fast after the orm call and the assertion done just after that. We add steps in this test to see if the orm call has been done propely before ending the tour. Runbot Error: 22613, 22614 closes odoo/odoo#126779 Signed-off-by: Joseph Caburnay (jcb) --- .../tests/tours/helpers/ChromeTourMethods.js | 20 ++++++++++++++++++- .../static/tests/tours/pos_restaurant.js | 10 ++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/addons/pos_restaurant/static/tests/tours/helpers/ChromeTourMethods.js b/addons/pos_restaurant/static/tests/tours/helpers/ChromeTourMethods.js index 0fddfe38978..3e4802228dd 100644 --- a/addons/pos_restaurant/static/tests/tours/helpers/ChromeTourMethods.js +++ b/addons/pos_restaurant/static/tests/tours/helpers/ChromeTourMethods.js @@ -14,7 +14,25 @@ class DoExt extends Do { } } -class Check {} +class Check { + isSyncStatusPending() { + return [ + { + trigger: ".pos-topheader .pos-rightheader .status-buttons .oe_status:has(.js_msg)", + run: () => {}, + }, + ]; + } + isSyncStatusConnected() { + return [ + { + trigger: + ".pos-topheader .pos-rightheader .status-buttons .oe_status:has(.js_connected)", + run: () => {}, + }, + ]; + } +} class Execute {} diff --git a/addons/pos_restaurant/static/tests/tours/pos_restaurant.js b/addons/pos_restaurant/static/tests/tours/pos_restaurant.js index c7c13586fb9..c4abd72c9ef 100644 --- a/addons/pos_restaurant/static/tests/tours/pos_restaurant.js +++ b/addons/pos_restaurant/static/tests/tours/pos_restaurant.js @@ -68,12 +68,16 @@ 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() }); +registry + .category("web_tour.tours") + .add("pos_restaurant_sync", { test: true, url: "/pos/ui", steps: getSteps() }); startSteps(); @@ -112,4 +116,6 @@ ProductScreen.check.totalAmountIs("2.20"); Chrome.do.backToFloor(); FloorScreen.check.orderCountSyncedInTableIs("4", "1"); -registry.category("web_tour.tours").add("pos_restaurant_sync_second_login", { test: true, url: "/pos/ui", steps: getSteps() }); +registry + .category("web_tour.tours") + .add("pos_restaurant_sync_second_login", { test: true, url: "/pos/ui", steps: getSteps() });