expectProperty method

void expectProperty(
  1. String id,
  2. String property,
  3. dynamic expected
)

Implementation

void expectProperty(String id, String property, dynamic expected) {
  final finder = finderForId(id);
  if (finder.evaluate().isEmpty) {
    throw EnsembleTestFailure('expectProperty: widget "$id" not found.');
  }
  if (property == 'label') {
    final semantics = tester.getSemantics(finder);
    final label = semantics.label;
    if (label != expected?.toString()) {
      throw EnsembleTestFailure(
        'Expected label "$expected", got "$label".',
      );
    }
    return;
  }
  throw EnsembleTestFailure('Unsupported property "$property".');
}