uxifiit/UXC

Step completition on close

mariusrak opened this issue · 4 comments

In Timeline step definition I would expect also possibility to define step completition with closing an app. E.g. when browser or a program that is the step is closed, UXC should continue to next step. Or this is meant by default?
Thanks.

Such step is already implemented, but has not been documented. See class CloseProgramActionSettings (use CloseProgram in actionType parameter in session definition JSON) in SessionStepActionSettings file in the UXC.Core.Sessions library. Which program to close is decided based on the value of the Tag property (string), which should match the value in LaunchProgram action.

The default behavior of the Launch Program action is as follows:

  • the step completes when the user closes the program, or
  • the program is closed automatically by UXC, if the step completion was defined explicitly (timeout or key press).

But the behavior was extended further, see the source code file for other options:

  • keep running the program, do not wait for its completion - the step is completed immediately (requires CloseProgram action to be used later and ShowDesktop to let user interact with the program),
  • wait till the program starts, optionally with explicit timeout, and show content (another session step), e.g., instructions with message ("starting the application"),
  • force close the program on the step completion (kill process) instead of normal close which may request participant's action or confirmation,
  • use session settings as parameters in the launch arguments.

These options allows this scenario:

  • launch program, keep it running until it is explicitly closed
  • show desktop, so participants can interact with the program
  • show other stimuli (instructions or questionary) through stimuli insertion into the timeline using the local UXC API
  • show desktop to return to the app
  • close the app

Show desktop step can be completed using the key shortcut (if explicitly defined in the session step definition), or requested by the program through local UXC API (continue step action).

Thanks for the reply. I have next, relating issue. I have this session definition: https://pastebin.com/1x3JUzVz
Chrome is opened correctly, but in few seconds, it is closed and postSessionSteps occurs.

I see you have used --new-window argument for Chrome and I guess you have Chrome running before the session start. I tested it this way and it seems to be the source of the problem. If the Chrome is not running before the session is started, the session goes as expected (UXC waits during the use of the program until it is closed). But when the program is already running before starting the session, the behavior depends on how the program handles multiple instances. In this case, the newly created Chrome process by the UXC is immediately terminated due to behavior of Chrome (the arguments are passed to the currently running instance).

If you need to have Chrome running before the session, use runInBackground or keepRunning options instead and add a ShowDesktop session step to allow interaction with the browser. Otherwise, ensure Chrome is not running before starting the session.

Thanks for the explanation.