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

I'm getting an error when trying to use swipe to pull to refresh #1743

Closed
eliezer-castro opened this issue Sep 22, 2023 · 3 comments
Closed

Comments

@eliezer-castro
Copy link

eliezer-castro commented Sep 22, 2023

Steps to reproduce

I need to reload my information throw "pull to refresh". I'm using the swipe_test.dart file present in the example project as a base, but it shows the error: Patrol action failed: GrpcError: swipe() failed with code UNKNOWN

Actual results

No device specified, using the first one (emulator-5554)
• Building apk with entrypoint test_bundle.dart...
✓ Completed building apk with entrypoint test_bundle.dart (21.3s)
• Executing tests of apk with entrypoint test_bundle.dart on emulator-5554...
See the report at: file:///C:/Users/ELIEZER.CASTRO/Development/kothe_modules/build/app/reports/androidTests/connected/index.html
✗ Failed to execute tests of apk with entrypoint test_bundle.dart on emulator-5554 (Gradle test execution failed with code 1) (51.1s)
Exception: Gradle test execution failed with code 1
See the logs above to learn what happened. Also consider running with --verbose. If the logs still aren't useful, then it's a bug - please report it.

Logs

Logs
java.lang.AssertionError: Dart test failed: tests.modalidades.entrega.1_auth.login_test
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════
The following PatrolActionException was thrown running a test:
Patrol action failed: GrpcError: swipe() failed with code UNKNOWN
(unknown error has occurred
java.lang.IllegalArgumentException: endY represents a percentage
and must be between 0 and 1
at pl.leancode.patrol.Automator.swipe(Automator.kt:262)
at
pl.leancode.patrol.AutomatorServer.swipe(AutomatorServer.kt:174)
at
pl.leancode.patrol.contracts.NativeAutomatorGrpcKt$NativeAutomatorCoroutineImplBase$bindService$13.invoke(ContractsGrpcKt.kt:1592)
at
pl.leancode.patrol.contracts.NativeAutomatorGrpcKt$NativeAutomatorCoroutineImplBase$bindService$13.invoke(ContractsGrpcKt.kt:1592)
at
io.grpc.kotlin.ServerCalls$unaryServerMethodDefinition$2$invoke$$inlined$map$1$2.emit(Emitters.kt:224)
at
kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at
kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at
kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87)
at
kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66)
at
io.grpc.kotlin.HelpersKt$singleOrStatusFlow$1$1.emit(Helpers.kt:65)
at
kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at
kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at
kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87)
at
kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66)
at
io.grpc.kotlin.ServerCalls$serverCallListener$requests$1.invokeSuspend(ServerCalls.kt:228)
at
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
)

When the exception was thrown, this was the stack:
#0      NativeAutomator._wrapRequest (package:patrol/src/native/native_automator.dart:237:7)
<asynchronous suspension>
#1      NativeAutomator.swipe (package:patrol/src/native/native_automator.dart:647:5)
<asynchronous suspension>
#2      main.<anonymous closure> (file:///C:/Users/ELIEZER.CASTRO/Development/kothe_modules/integration_test/tests/modalidades/entrega/1_auth/login_test.dart:22:5)
<asynchronous suspension>
#3      patrolTest.<anonymous closure> (package:patrol/src/common.dart:142:7)
<asynchronous suspension>
#4      testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:171:15)
<asynchronous suspension>
#5      TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:841:5)
<asynchronous suspension>

The test description was:
Deve realizar o login com sucesso
═════════════════════════════════════════════════════════════════

at pl.leancode.patrol.PatrolJUnitRunner.runDartTest(PatrolJUnitRunner.java:130)
at br.com.kothe.kothe.MainActivityTest.runDartTest(MainActivityTest.java:29)</summary>

Patrol version

patrol: ^2.2.4

Patrol Doctor output

Patrol Doctor output
You're using Patrol CLI 2.0, which has breaking changes.
Read the migration guide at https://patrol.leancode.co/v2.
Disable this warning by setting the PATROL_MIGRATED environment variable.

Patrol CLI version: 2.1.2
Program adb found in C:\Users\ELIEZER.CASTRO\AppData\Local\Android\Sdk\platform-tools\adb.exe
Env var $ANDROID_HOME set to C:\Users\ELIEZER.CASTRO\AppData\Local\Android\Sdk

Flutter Doctor output

Flutter Doctor output
[√] Flutter (Channel stable, 3.3.10, on Microsoft Windows [versÆo 10.0.22621.2283], locale pt-BR)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.4)
[√] Android Studio (version 2022.3)
[√] IntelliJ IDEA Community Edition (version 2022.3)
[√] VS Code (version 1.74.3)
[√] Connected device (4 available)
[√] HTTP Host Availability
@bartekpacia
Copy link
Contributor

Hi @eliezer-castro!

In the logs you have:

java.lang.IllegalArgumentException: endY represents a percentage
and must be between 0 and 1

The values you pass to swipe() aren't contained by the inclusive 0-1 range.

@bartekpacia
Copy link
Contributor

If the "swipe to refresh" widget is in your Flutter app, then you should not be using Patrol's native automation feature (aka $.native) to automate it.

You should do it by using Flutter finders (either the default ones from package:flutter_test or the improved ones from package:patrol_finders). See this SO question to learn more.

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants