From dbba7403aa3ab3dee33e8f9ce3ec084c21d9aba1 Mon Sep 17 00:00:00 2001 From: Julien Banken Date: Thu, 15 Jun 2023 14:02:34 +0000 Subject: [PATCH] [FIX] web_tour: clear timeout on last step The timeout mechanism of the tours works as follow: When a step is executed, the step will clear the timeout set by the previous step and set a new timeout for itself. If the next step does not clear that timeout in time, the callback function of the timeout will be executed and will print an error message in the console indicating that the step fails. Currently, the last step we add to clear the tour state and call the `onTourEnd` callback does not clear the latest timeout set. As a result, the last step will eventually timeout and the system will log an error message in the console indicating that the last step fails even if the tour has previously been reported as successful. To fix the issue, the last step we add to clear the tour state and call the `onTourEnd` will now also clear the last timeout. The system will now no longer print an error message in the console. Steps to reproduce the error: Go on the runbot: 1. Enable the developer mode with test assets 2. Click on the bug icon of the odoo navbar to run a test tour 3. Open the console (F12) 4. Run a test tour like `knowledge_index_command_tour` (with automatic steps). 5. Wait for the tour to finish (the test should be successful) 6. Wait 10 seconds after the end of the tour => An error message is shown in the console. TOBE: If the test is reported as successful, there shouldn't be any timeout. task-3373853 closes odoo/odoo#127317 X-original-commit: cb46032f8d74505b792b06c90565e7a4741d921c Signed-off-by: Thibault Delavallee (tde) --- addons/web_tour/static/src/tour_service/tour_compilers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web_tour/static/src/tour_service/tour_compilers.js b/addons/web_tour/static/src/tour_service/tour_compilers.js index 73bf91acef1..f9da0055e44 100644 --- a/addons/web_tour/static/src/tour_service/tour_compilers.js +++ b/addons/web_tour/static/src/tour_service/tour_compilers.js @@ -425,6 +425,7 @@ export function compileTourToMacro(tour, options) { action() { tourState.clear(tour.name); onTourEnd(tour); + clearTimeout(tourTimeout); }, }, ]),