Repository: flutter/flutter
File: packages/flutter/test/material/tooltip_test.dart (Dart)

Code before:
    const BoxConstraints tooltipConstraints = BoxConstraints.tightFor(width: 500, height: 250);
    await tester.pumpWidget(
      MaterialApp(
        theme: ThemeData(tooltipTheme: const TooltipThemeData(constraints: themeConstraints)),
        home: Tooltip(
          key: tooltipKey,
          message: tooltipText,
          constraints: tooltipConstraints,
          padding: EdgeInsets.zero,
          child: const ColoredBox(color: Colors.green),
        ),
      ),
    );

    tooltipKey.currentState?.ensureTooltipVisible();
    await tester.pump(const Duration(seconds: 2));

    final Finder textAncestors = find.ancestor(
      of: find.text(tooltipText),
      matching: find.byWidgetPredicate((_) => true),
    );
    expect(tester.element(textAncestors.first).size, equals(tooltipConstraints.biggest));
  });

  testWidgets('Tooltip does not show while transitioning from another page', (
    WidgetTester tester,
  ) async {
    await tester.pumpWidget(
      MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            leading: const Center(child: Tooltip(message: 'Hello', child: Text('World'))),
          ),
          body: Builder(
            builder: (BuildContext context) {
              return TextButton(
                onPressed:
                    () => Navigator.push(
                      context,
                      CupertinoPageRoute<void>(
                        builder:
                            (BuildContext context) =>
                                Scaffold(appBar: AppBar(title: const Text('Second Page'))),
                      ),
                    ),
                child: const Text('Go to Second Page'),
              );
            },
          ),
        ),
      ),

Review comment (suggestion):
Extreme nit, for this case I think it needs a link to the issue it is checking against.
```suggestion
  // This is a regression test for https://github.com/flutter/flutter/issues/167359.
  testWidgets('Tooltip does not show while transitioning from another page', (
```

Code after:
    const BoxConstraints tooltipConstraints = BoxConstraints.tightFor(width: 500, height: 250);
    await tester.pumpWidget(
      MaterialApp(
        theme: ThemeData(tooltipTheme: const TooltipThemeData(constraints: themeConstraints)),
        home: Tooltip(
          key: tooltipKey,
          message: tooltipText,
          constraints: tooltipConstraints,
          padding: EdgeInsets.zero,
          child: const ColoredBox(color: Colors.green),
        ),
      ),
    );

    tooltipKey.currentState?.ensureTooltipVisible();
    await tester.pump(const Duration(seconds: 2));

    final Finder textAncestors = find.ancestor(
      of: find.text(tooltipText),
      matching: find.byWidgetPredicate((_) => true),
    );
    expect(tester.element(textAncestors.first).size, equals(tooltipConstraints.biggest));
  });

  // This is a regression test for https://github.com/flutter/flutter/issues/167359.
  testWidgets('Tooltip does not show while transitioning from another page', (
    WidgetTester tester,
  ) async {
    await tester.pumpWidget(
      MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            leading: const Center(child: Tooltip(message: 'Hello', child: Text('World'))),
          ),
          body: Builder(
            builder: (BuildContext context) {
              return TextButton(
                onPressed:
                    () => Navigator.push(
                      context,
                      CupertinoPageRoute<void>(
                        builder:
                            (BuildContext context) =>
                                Scaffold(appBar: AppBar(title: const Text('Second Page'))),
                      ),
                    ),
                child: const Text('Go to Second Page'),
              );
            },
          ),
        ),