Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case doesn't enters text in pinput package field #1409

Open
AshuSharma7 opened this issue Jun 27, 2023 · 2 comments
Open

Test case doesn't enters text in pinput package field #1409

AshuSharma7 opened this issue Jun 27, 2023 · 2 comments
Labels
bug Something isn't working package:patrol_finders Related to the patrol_finders package package: patrol Related to the patrol package (native automation, test bundling)

Comments

@AshuSharma7
Copy link

Steps to reproduce

  1. Clone this repo https://github.com/AshuSharma7/pinput_test
  2. run the test using "patrol test --target integration_test/pin_test.dart"

I've tried using key method
$(#pin).enterText("1234");

and also by tapping on pinput field and then entering text
await $(#pin).tap();
TestTextInput().enterText("1234");

Actual results

Test case doesn't enters the text in the pinput field and throws error that pumpAndSettle Timedout

Logs

Logs
java.lang.Exception: ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════
The following assertion was thrown running a test:
pumpAndSettle timed out

When the exception was thrown, this was the stack:
#0      WidgetTester.pumpAndSettle.<anonymous closure> (package:flutter_test/src/widget_tester.dart:677:11)
<asynchronous suspension>
#1      TestAsyncUtils.guard.<anonymous closure> (package:flutter_test/src/test_async_utils.dart:117:7)
<asynchronous suspension>

The test description was:
Pin view
═════════════════════════════════════════════════════════════════

at pl.leancode.patrol.PatrolTestRunner.run(PatrolTestRunner.kt:76)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:67)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:58)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:446)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2367)

Patrol version

patrol: ^1.1.0

Patrol Doctor output

Patrol Doctor output
Program adb found in /Users/ashusharma/Library/Android/sdk/platform-tools/adb
Env var $ANDROID_HOME set to /Users/ashusharma/Library/Android/sdk/
Program xcodebuild found in /usr/bin/xcodebuild
Program ideviceinstaller found in /opt/homebrew/bin/ideviceinstaller
Program ios-deploy found in /opt/homebrew/bin/ios-deploy

Flutter Doctor output

Flutter Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.12, on macOS 13.4 22F66 darwin-arm64, locale
    en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.78.0)
[✓] Connected device (2 available)
    ! Device 192.168.29.222:5555 is offline.
[✓] HTTP Host Availability

• No issues found!
@bartekpacia
Copy link
Contributor

Thanks for reporting. I can reproduce the issue with patrol: ^1.0.0 and patrol_cli: ^1.0.0.

It's probably because the Pinput widget isn't a normal Text, so the WidgetTester.enterText() doesn't work with it.

This requires further investigation.

@bartekpacia bartekpacia added package: patrol Related to the patrol package (native automation, test bundling) package:patrol_finders Related to the patrol_finders package bug Something isn't working labels Jun 27, 2023
@szymondobrzanski
Copy link

It's because of cursor in Pinput widget, by default the cursor keeps blinking so animation never stops. You can disable animation and keep cursor visible by setting isCursorAnimationEnabled flag to false. With it your test should pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:patrol_finders Related to the patrol_finders package package: patrol Related to the patrol package (native automation, test bundling)
Projects
None yet
Development

No branches or pull requests

3 participants