toReportSection method
Implementation
String toReportSection(List<InteractionResult> results) {
final buffer = StringBuffer();
buffer.writeln('INTERACTION TEST RESULTS:');
final executed = results.where((r) => r.executed).toList();
final skipped = results.where((r) => !r.executed).toList();
final janky =
executed.where((r) => (r.performance?.jankyFrames ?? 0) > 0).toList();
buffer.writeln('- Total interactions: ${results.length}');
buffer.writeln('- Executed: ${executed.length}');
buffer.writeln('- Skipped (risky): ${skipped.length}');
buffer.writeln('- Interactions with jank: ${janky.length}');
if (janky.isNotEmpty) {
buffer.writeln('');
buffer.writeln('JANKY INTERACTIONS (worst first):');
janky.sort((a, b) => (b.performance?.jankyFrames ?? 0)
.compareTo(a.performance?.jankyFrames ?? 0));
for (final r in janky.take(5)) {
buffer.writeln(
' - ${r.interaction.widgetType} at '
'${r.interaction.file}:${r.interaction.line} — '
'${r.performance?.jankyFrames} janky frames',
);
}
}
if (skipped.isNotEmpty) {
buffer.writeln('');
buffer.writeln('SKIPPED (manual testing needed):');
for (final r in skipped.take(5)) {
buffer.writeln(' - ${r.interaction.widgetType}: ${r.outcome}');
}
}
return buffer.toString();
}