querySelectorAll<O extends Element> method

UITestChainNode<U, List<O>, T> querySelectorAll<O extends Element>(
  1. String? selectors, {
  2. bool expected = false,
})

Implementation

UITestChainNode<U, List<O>, T> querySelectorAll<O extends Element>(
    String? selectors,
    {bool expected = false}) {
  var e = element;

  List<O> elems;
  if (e is UIComponent) {
    elems = e.querySelectorAll<O>(selectors);
  } else if (e is Element) {
    elems = selectors != null ? e.querySelectorAll<O>(selectors) : <O>[];
  } else if (e is Iterable<Element>) {
    elems = selectors != null
        ? e.expand((e) => e.querySelectorAll<O>(selectors)).toList()
        : <O>[];
  } else {
    elems = uiRoot.querySelectorAll<O>(selectors);
  }

  if (expected) {
    expect(elems.isNotEmpty, isTrue,
        reason: "Can't find selected elements: $selectors");
  }

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