From 930a1fedc5e7a72c70013660fdf0449508e2b6b7 Mon Sep 17 00:00:00 2001 From: Romeo Fragomeli Date: Thu, 22 Oct 2020 10:14:51 +0000 Subject: [PATCH] [FIX] test_main_flows: fix main flow on Mobile (on changing month) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On mobile, when tours are run on changing month, the "Register Payment" step often fails with the following error: AssertionError: The test code "odoo.startTour('main_flow_tour')" failed Tour main_flow_tour failed at step Register Payment (trigger: .o_statusbar_buttons button:enabled:contains('Register Payment')) Please note before going further: * The main flow is a tour. The tour manager waits for the trigger and the extra trigger to be reachable before executing the step. * On mobile the status bar buttons are wrapped in a dropdown. So the stepUtils.statusbarButtonsSteps is composed by two actions: 1 - Open the dropdown if present. 2 - Click on the button. Before this commit, the extra trigger doesn't look like the best one: when this tour is executed during month change, the account module has to perform some heavier (and longer) processes. When the "Validate" call button is made (previous step), a lot of RPC are made and, usually, the previous extra trigger works fine. But for some reasons, the _renderStatusbarButtons is called between the two steps in the statusbarButtonsSteps. So this is the flow: - Running the tour until... - Click "Validate" button (this generates a bunch of RPC). - Open the dropdown. - Some RPC respond, which refresh the "state" and call _renderStatusbarButtons (dropdown is not open anymore). - Try to click on "Register Payment" => BUG (button is present but not visible, so unreachable). After this commit, the extra trigger is changed to force waiting for the RPC that change the "state" and call _renderStatusbarButtons before executing the "Register Payment" step. closes odoo/odoo#61085 X-original-commit: dacc1703c486c8affb44df679ab5e8e2ba724867 Signed-off-by: Adrien Dieudonné (adr) Signed-off-by: rfr-odoo --- odoo/addons/test_main_flows/static/tests/tours/main_flow.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5cb4dd71ea2..faf250401ae 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 @@ -941,7 +941,7 @@ tour.stepUtils.mobileModifier(tour.stepUtils.autoExpandMoreButtons('.o_control_p position: "bottom", }, ...tour.stepUtils.statusbarButtonsSteps('Confirm', _t("Validate"), ".breadcrumb-item.active:contains('Draft Invoice')"), -...tour.stepUtils.statusbarButtonsSteps('Register Payment', _t("Register Payment"), ".breadcrumb-item.active:contains('INV/')"), +...tour.stepUtils.statusbarButtonsSteps('Register Payment', _t("Register Payment"), ".o_statusbar_status .btn.dropdown-toggle:contains('Posted')"), { trigger: ".modal-footer .btn-primary", content: _t("Validate"),