alchemist icon indicating copy to clipboard operation
alchemist copied to clipboard

fix: test widget with animation and image

Open vlkonoshenko opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Version

0.10.0

Description

The error occurs when trying to test a widget with an image and infinite animation

Steps to reproduce

  1. When testing a widget with an image and an endless animation,
  2. If it is a precacheImages function, and it has a command at the end, await tester.pumpAndSettle(), then it waits for the end of the frame rendering, but this doesn't happen because there's an endless animation on the screen.
  3. Perhaps we should extend the precacheImages function with a flag to turn off await tester.pumpAndSettle()?

Expected behavior

The test was completed successfully.

Screenshots

Снимок экрана 2024-11-15 в 11 20 08

Additional context and comments

Example

goldenTest(
    'Animation with image',
    fileName: 'example',
    pumpBeforeTest: precacheImages,
    pumpWidget: (tester, widget) async {
      await tester.pumpWidget(widget);
      await tester.pump(Durations.medium4);
    },
    builder: () {
      return GoldenTestGroup(
        scenarioConstraints:
            const BoxConstraints(maxWidth: 1200, minWidth: 600),
        children: [
          GoldenTestScenario(
            name: 'Animation',
            child: const Column(
              children: [
                CircularProgressIndicator(
                  color: Colors.red,
                ),
                SizedBox.square(
                  dimension: 120,
                  child: Image(image: AssetImage(UiKitImages.cluster)),
                ),
              ],
            ),
          ),
        ],
      );
    },
  );

vlkonoshenko avatar Nov 15 '24 08:11 vlkonoshenko

https://github.com/Betterment/alchemist/pull/137

vlkonoshenko avatar Nov 15 '24 08:11 vlkonoshenko