action #125378

action #125300: Support creating demo videos with pauses and mouse moving

[timeboxed:20h] Proof of concept for supporting creating demo videos with pauses and mouse moving size:M

Added by tinita 3 months ago. Updated 2 months ago.

Feature requests
Target version:
Start date:
Due date:
% Done:


Estimated time:



Additionally to testing, openQA can be used to create demonstration videos, and ideally the same
test code can be used, just that there should be certain pauses, and we would want to see the mouse
moving and have a little pause before clicking.

Testing of course still has the higher priotity, and the os-autoinst code should not get more
complicated, but for creating simple demo videos we probably don't need much new code.

Acceptance criteria

  • AC1: A PR for showing a demo mode exists and is enabled via a setting like DEMO_MODE, which can be used for videos targeted at human beings learning about something


  • Provide an easy way to delay/sleep around needle matches (assuming this is usually what a user would want to take a look at)
  • Move the mouse pointer gradually rather than instantaneously


#1 Updated by tinita 3 months ago

  • Parent task set to #125300

#2 Updated by tinita 3 months ago

  • Status changed from New to In Progress

Since I did that for the Perl Workshop, here is a first suggestion:

We would need more sleep calls in various occasions I guess, but that can be also done later.

Test and needles:

#3 Updated by tinita 3 months ago

  • Status changed from In Progress to Feedback

I updated the readme with a link to the example video and a short usage.
I updated the PR with the suggestions from Marius.

#4 Updated by okurz 2 months ago

  • Due date changed from 2023-03-17 to 2023-03-24

discussed in daily 2023-03-21. We should be able to resolve this ticket this week

#5 Updated by cdywan 2 months ago

  • Subject changed from [timeboxed:20h] Proof of concept for supporting creating demo videos with pauses and mouse moving to [timeboxed:20h] Proof of concept for supporting creating demo videos with pauses and mouse moving size:M

#6 Updated by tinita 2 months ago

  • Status changed from Feedback to Resolved

I looked through the testapi functions for what we would have to do for a simple demo mode.
Only a few functions would need to be adjusted IMHO, because I imagine that if a user writes a test that is supposed
to be run in demo mode, then they might want to decide themselves where to put a sleep.

Optionally add a factor for the default demo mode sleep amount.

Functions to be adjusted


set a default delay in demo mode


  • sleep 1s by defaut after needle match before clicking
  • Alternatively let people specify a callback to execute after needle match

See also assert_and_dclick

assert_screen, check_screen

Add a sleep after the needle match by default, but let people configure it because it might not always be wanted here.
Or also add a callback.


I can imagine that it could be useful to show a little popup in case a key or key combination is pressed, for example pressing ctrl-f5 to close some window can be unexpected

New functions

It might not be a good idea to change all existing functions.


Will move the mouse slowly from the current position (or optionally from the
specified position) to the new position


mouse_drag is simply implemented by setting the mouse to the new position
after clicking. Either add a new option or add a new function that will slowly
move the mouse

sleep or demosleep

Will sleep $long seconds in demo mode, and if defined, $short seconds in normal mode.

sub demosleep ($long, $short) {
    sleep $long && return if get_var('DEMO_MODE');
    sleep $short if defined $short;
  • function to get last match coordinates

When playing with assert_and_click, I found out that there is no way
for testapi users to get the position of the last needle match (except the
undocumented way of accessing the global package vars).
That would have avoided having to change assert_and_click; I could
have just used assert_screen; (x,y) get_match_position; mouse_move(x,y).

Also available in: Atom PDF