expectProperty method
void
expectProperty(
- String id,
- String property,
- 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 label = _readSemantics(() => tester.getSemantics(finder).label);
if (label != expected?.toString()) {
throw EnsembleTestFailure(
'Expected label "$expected", got "$label".',
);
}
return;
}
throw EnsembleTestFailure('Unsupported property "$property".');
}