[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) <tde@openerp.com>
This commit is contained in:
Julien Banken
2023-07-05 10:12:58 +02:00
parent 5b1bc2e1da
commit dbba7403aa
@@ -425,6 +425,7 @@ export function compileTourToMacro(tour, options) {
action() {
tourState.clear(tour.name);
onTourEnd(tour);
clearTimeout(tourTimeout);
},
},
]),