[FIX] web_tour: never run default action for a tour's final step

A number of steps have a last step which may trigger some async
operation (e.g. reopen a menu, close a modal, ...).

This async operation can span over the cleanup of the browser, in
which case its callback will try running in a seriously broken state.

It's simpler to just assume that the last step's side-effects should
not matter to the test's success and interpret it as a "wait" (used
only for its trigger to wait until a proper end-state).

There was a question of whether we should ignore all final actions,
all non-function actions, or all implicit (default) actions. The
latter seems the least disruptive as hopefully developers having
provided a `run` in the final action have a good use case for it.
This commit is contained in:
Xavier Morel
2020-01-21 06:56:15 +00:00
parent b66a7feb0f
commit 9733f6e1ab
@@ -414,11 +414,14 @@ return core.Class.extend(mixins.EventDispatcherMixin, ServicesMixin, {
var action_helper = new RunningTourActionHelper(tip.widget);
do_before_unload(self._consume_tip.bind(self, tip, tour_name));
var tour = self.tours[tour_name];
if (typeof tip.run === "function") {
tip.run.call(tip.widget, action_helper);
} else if (tip.run !== undefined) {
var m = tip.run.match(/^([a-zA-Z0-9_]+) *(?:\(? *(.+?) *\)?)?$/);
action_helper[m[1]](m[2]);
} else if (tour.current_step === tour.steps.length - 1) {
console.log('Tour %s: ignoring action (auto) of last step', tour_name);
} else {
action_helper.auto();
}