Text blanked out in Flutter flutter_test widget test golden screenshot

Viewed 104

When I try widget testing my flutter app, I am unable to locate the desired widgets by their ID. As a result, I took a golden screenshot to see what was happening and it appears every instance of Text is being blanked out (in the same color as the text color should be).

See side-by-side of expected app appearance and then golden screenshot.

I've simplified my problem down to a finer grained example, see the code here:

testGoldens('Example', (WidgetTester tester) async {
  tester.binding.window.physicalSizeTestValue = Size(1284, 2778);
  addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
  Widget exampleWidget = Scaffold(
    appBar: AppBar(),
    body: Text('example', style: TextStyle(color: Colors.red)));
  await tester.pumpWidget(MaterialApp(home: exampleWidget));
  await expectLater(
    find.byType(MaterialApp), matchesGoldenFile('signIn.png'));
});

And this produces this screenshot. (Notice even the debug sash is blanked out).

Anyone seen this before? Thanks

0 Answers
Related