leancodepl / patrol

Flutter-first UI testing framework. Ready for action!
https://patrol.leancode.co
Apache License 2.0
898 stars 135 forks source link

Test got stuck if the pumpAndSettle add with duration #2022

Closed ckxddd0324 closed 10 months ago

ckxddd0324 commented 10 months ago

Steps to reproduce

  1. Create Test
  2. add duration to pumpAndsettle
  3. the test got stuck and never go to next step

Actual results

Test got stuck and never ending itself or proceed to next step in the test. I was trying to writing test with Patrol, but our app takes sometimes to load, so I added duration to pumpAndSettle but then the test would stuck in Test Starting... or in a white screen.

Is there better way to do it? Because if I tried to interact with the app, the app content would show/render it. But on the iOS simulator, the app would just render with white screen


  patrolTest(
    'counter state is the same after going to home and switching apps',
    ($) async {
      // Replace later with your app's main widget
      app.main();
      await $.pumpAndSettle();
      // await $.pumpAndSettle();
      // await Future.delayed(Duration(seconds: 30));
      expect($('Accept All'), findsOneWidget);
      expect($('Manage Settings'), findsOneWidget);
      expect($(#appOnboardingKey1), findsOneWidget);
    },
  );

Logs

Logs ``` 2023-12-18 15:09:59.509310-0500 RunnerUITests-Runner[9360:42469623] Running tests... 2023-12-18 15:10:01.163218-0500 RunnerUITests-Runner[9360:42469915] ℹ️ INFO ℹ️ General [Logger.swift:11-259-main] log level set to 🔕 OFF 2023-12-18 15:10:01.173586-0500 RunnerUITests-Runner[9360:42469915] ℹ️ INFO 😎 AgentSession [DTXAgentBootController.m:16-259-main] ### Dynatrace OneAgent (iOS) 8.275.1.1006 built on 2023-09-12 20:17:15 +0000 ### 2023-12-18 15:10:01.173782-0500 RunnerUITests-Runner[9360:42469915] ℹ️ INFO ℹ️ General [DynatraceCore.swift:9-259-main] ### Dynatrace Core (iOS) 8.275.1.1002 built on 2023-09-12 ### TRACE: KSCrashMonitor_AppState.c (383): void DTX_kscrashstate_notifyObjCLoad(void): KSCrash has been loaded! 2023-12-18 15:10:02.549816-0500 RunnerUITests-Runner[9360:42469623] PatrolServer: INFO: PATROL_PORT is null, falling back to default (8081) 2023-12-18 15:10:02.550335-0500 RunnerUITests-Runner[9360:42469623] PatrolServer: INFO: PatrolServer constructor called 2023-12-18 15:10:02.550712-0500 RunnerUITests-Runner[9360:42469623] PatrolServer: INFO: PATROL_ENABLED flag is defined 2023-12-18 15:10:02.566427-0500 RunnerUITests-Runner[9360:42469623] PatrolServer: INFO: Starting server... 2023-12-18 15:10:02.582286-0500 RunnerUITests-Runner[9360:42469623] PatrolServer: INFO: Server started on http://0.0.0.0:8081 2023-12-18 15:10:02.582684-0500 RunnerUITests-Runner[9360:42469623] PatrolAppServiceClient: created, port: 8082 t = nans Checking existence of `"Allow" Button` t = nans Open com.lonoperationsllc.breadmobile t = nans Launch com.lonoperationsllc.breadmobile t = nans Setting up automation session t = nans Wait for com.lonoperationsllc.breadmobile to idle 2023-12-18 15:10:08.224005-0500 RunnerUITests-Runner[9360:42469909] PatrolServer: INFO: App reported that it is ready 2023-12-18 15:10:09.013389-0500 RunnerUITests-Runner[9360:42469623] PatrolAppServiceClient.listDartTests() 2023-12-18 15:10:09.207605-0500 RunnerUITests-Runner[9360:42469915] [connection] nw_socket_handle_socket_event [C1.1.1:2] Socket SO_ERROR [61: Connection refused] 2023-12-18 15:10:10.052846-0500 RunnerUITests-Runner[9360:42469623] Got 1 Dart tests: ( "example_test counter state is the same after going to home and switching apps" ) 2023-12-18 15:10:10.054417-0500 RunnerUITests-Runner[9360:42469623] RunnerUITests.testInvocations(): selectorName = exampleTest___counterStateIsTheSameAfterGoingToHomeAndSwitchingApps, signature: Test Suite 'All tests' started at 2023-12-18 15:10:10.060 Test Suite 'RunnerUITests.xctest' started at 2023-12-18 15:10:10.061 Test Suite 'RunnerUITests' started at 2023-12-18 15:10:10.061 Test Case '-[RunnerUITests exampleTest___counterStateIsTheSameAfterGoingToHomeAndSwitchingApps]' started. t = 0.00s Start Test at 2023-12-18 15:10:10.064 t = 0.02s Set Up t = 0.02s Open com.lonoperationsllc.breadmobile t = 0.04s Launch com.lonoperationsllc.breadmobile t = 0.04s Terminate com.lonoperationsllc.breadmobile:9414 t = 1.29s Setting up automation session t = 2.74s Wait for com.lonoperationsllc.breadmobile to idle 2023-12-18 15:10:14.371651-0500 RunnerUITests-Runner[9360:42469911] PatrolServer: INFO: App reported that it is ready 2023-12-18 15:10:15.629622-0500 RunnerUITests-Runner[9360:42469623] PatrolAppServiceClient.runDartTest(example_test counter state is the same after going to home and switching apps) 2023-12-18 15:10:15.642530-0500 RunnerUITests-Runner[9360:42469912] [connection] nw_socket_handle_socket_event [C2.1.1:2] Socket SO_ERROR [61: Connection refused] ```

Patrol version

patrol_cli v2.2.2 patrol: ^2.3.2

Patrol Doctor output

Patrol Doctor output ``` Patrol CLI version: 2.2.2 Program adb found in /Users/a820757/library/Android/sdk/platform-tools/adb Env var $ANDROID_HOME set to /Users/a820757/library/Android/sdk Program xcodebuild found in /usr/bin/xcodebuild Program ideviceinstaller found in /opt/homebrew/bin/ideviceinstaller ```

Flutter Doctor output

Flutter Doctor output ``` Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.10.6, on macOS 13.5.2 22G91 darwin-arm64, locale en-US) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] IntelliJ IDEA Ultimate Edition (version 2023.2.4) [✓] IntelliJ IDEA Community Edition (version 2021.2.3) [✓] VS Code (version 1.82.2) [✓] Connected device (4 available) [✓] Network resources ```
piotruela commented 10 months ago

Hi @ckxddd0324, I cannot check this issue without a reproducible example but my first thought is that there is a infinite animation that prevents pumpAndSettle from finishing. You can try replacing pumpAndSettle with pump as suggested in this reply.

github-actions[bot] commented 10 months ago

Without additional information, we can't resolve this issue. We're therefore reluctantly going to close it. Feel free to open a new issue with all the required information provided, including a minimal, reproducible sample. Make sure to diligently fill out the issue template. Thanks for your contribution.

github-actions[bot] commented 9 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.