deserializeCommand method

Command deserializeCommand(
  1. Map<String, String> params,
  2. DeserializeFinderFactory finderFactory
)

Deserializes the finder from JSON generated by Command.serialize or CommandWithTarget.serialize.

Implementation

Command deserializeCommand(Map<String, String> params, DeserializeFinderFactory finderFactory) {
  return switch (params['command']) {
    'get_health'                    => GetHealth.deserialize(params),
    'get_layer_tree'                => GetLayerTree.deserialize(params),
    'get_render_tree'               => GetRenderTree.deserialize(params),
    'enter_text'                    => EnterText.deserialize(params),
    'send_text_input_action'        => SendTextInputAction.deserialize(params),
    'get_text'                      => GetText.deserialize(params, finderFactory),
    'request_data'                  => RequestData.deserialize(params),
    'scroll'                        => Scroll.deserialize(params, finderFactory),
    'scrollIntoView'                => ScrollIntoView.deserialize(params, finderFactory),
    'set_frame_sync'                => SetFrameSync.deserialize(params),
    'set_semantics'                 => SetSemantics.deserialize(params),
    'set_text_entry_emulation'      => SetTextEntryEmulation.deserialize(params),
    'tap'                           => Tap.deserialize(params, finderFactory),
    'waitFor'                       => WaitFor.deserialize(params, finderFactory),
    'waitForAbsent'                 => WaitForAbsent.deserialize(params, finderFactory),
    'waitForTappable'               => WaitForTappable.deserialize(params, finderFactory),
    'waitForCondition'              => WaitForCondition.deserialize(params),
    'waitUntilNoTransientCallbacks' => WaitForCondition.deserialize(params),
    'waitUntilNoPendingFrame'       => WaitForCondition.deserialize(params),
    'waitUntilFirstFrameRasterized' => WaitForCondition.deserialize(params),
    'get_semantics_id'              => GetSemanticsId.deserialize(params, finderFactory),
    'get_offset'                    => GetOffset.deserialize(params, finderFactory),
    'get_diagnostics_tree'          => GetDiagnosticsTree.deserialize(params, finderFactory),
    final String? kind => throw DriverError('Unsupported command kind $kind'),
  };
}