when method

Future<Online> when(
  1. Waitable waitable,
  2. MapFunc<Online, dynamic> action, {
  3. Duration? timeout,
})

When / Then eg. wait for a context menu to appear and select the 'Spreadsheet' option from the context menu when(Css('divrole="menu"'), (x) => x.click(Css('divrole="menu"')))

Implementation

Future<Online> when(Waitable waitable, MapFunc<Online, dynamic> action,
    {Duration? timeout}) async {
  Show.waiting_for(waitable.toString(), "to be ready");
  await waitable.wait(this);

  await action(this);
  return this;
}