playbook-ui/playbook-flutter

add custom hook into TestTool

lcdsmao opened this issue · 0 comments

e.g.

abstract class TestTool {
  Future<void> run(
    Playbook playbook, 
    PlaybookBuilder builder,
    {Future<void> Fucntion(WidgetTester)? setUp,}
  );
}


testWidgets('Snapshot for ${story.title} ${scenario.title}', (tester) async {
  // ... existed setup
  setUp?.call(tester);

  await expectLater(
    find.byWidget(scenario.child),
    matchesGoldenFile('$ensuredDirectoryPath/${story.title}/${scenario.title}.png'),
  );
});