selectFirstWhere<O extends Element> method

UITestChainNode<U, O?, T> selectFirstWhere<O extends Element>(
  1. String? selectors,
  2. bool test(
    1. Element element
    ), {
  3. bool expected = false,
})

Alias to querySelectorAll + firstWhereOrNull.

Implementation

UITestChainNode<U, O?, T> selectFirstWhere<O extends Element>(
    String? selectors, bool Function(Element element) test,
    {bool expected = false}) {
  var sel = querySelectorAll<O>(selectors);
  var elem = sel.element.whereType<O>().firstWhereOrNull(test);

  if (expected) {
    expect(elem, pkg_test.isNotNull,
        reason: "Can't find selected element: $selectors");
  }

  return UITestChainNode(testChainRoot, elem, this as T);
}