hover method

Future<void> hover(
  1. dynamic target, {
  2. Duration? hold,
  3. Shot? shot,
  4. Settle? settle,
})

Parks the mouse over target and holds it there, so whatever the app only shows to a mouse — a tooltip, a hover tint, a control that appears under the pointer — is on the screen the step captures.

The hold is hold of the fake clock, 600ms unless it says otherwise, and it is why this is more than a hover event. A settle follows frames, and what a hover usually starts is a Timer — Tooltip.waitDuration — which schedules no frame until it fires, so a hover that only settled would capture a quiet screen with nothing on it. Its frames are the step's own, so a recording shows the tooltip arriving.

The mouse stays where it is put, as a real one does. A tap that follows still finds target hovered — which is what is wanted when the thing to tap only appears on hover — and unhover ends it. Every scenario starts with no mouse on the screen, and so does every branch of a split.

The live drive's hover, with the same target, hold and pointer, so a step worked out against the running app ports as written.

Implementation

Future<void> hover(
  dynamic target, {
  Duration? hold,
  Shot? shot,
  Settle? settle,
}) => _step(
  shot,
  settle,
  () async {
    var finder = await _resolve(target, 'hover');
    var at = _aimFor(target, finder);
    await _approach('hover');
    await _mouse.moveTo(at, over: describeTarget(target));
    await _elapse(hold ?? _hoverHold);
  },
  verb: 'hover',
  target: describeTarget(target),
);