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

Exception: Guarded function conflict error during tap in latest RC 3.0.0-rc.9 #231

Closed
amitkumar-qa opened this issue Jun 20, 2022 · 14 comments

Comments

@amitkumar-qa
Copy link

amitkumar-qa commented Jun 20, 2022

@jonsamwell Getting error while taping on element in android ,
Below function gives error:
Future selectClientDetails(String contactName) async { await appDriver.tap(clientDropdown); }
In above function appDriver is object of AppDriverAdapter.

Error below:

I/flutter ( 7983): × Then User selects client "[test@test.com](mailto:test@test.com)" # :0 took 3ms I/flutter ( 7983): Exception: Guarded function conflict. I/flutter ( 7983): You must use "await" with all Future-returning test APIs. I/flutter ( 7983): The guarded method "pumpAndSettle" from class WidgetTester was called from package:flutter_gherkin/src/flutter/adapters/widget_tester_app_driver_adapter.dart on line 21. I/flutter ( 7983): Then, the "selectClientDetails" method from class InvoiceDetailsPage was called from file:///Users/ak/repo/integration_test/gherkin/steps/invoice_steps/invoice_details_page_steps.dart on line 10. I/flutter ( 7983): The first method (WidgetTester.pumpAndSettle) had not yet finished executing at the time that the second method (InvoiceDetailsPage.selectClientDetails) was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first. I/flutter ( 7983): I/flutter ( 7983): When the first method (WidgetTester.

@jonsamwell
Copy link
Owner

@amitkumar-qa could you add your code here for that step. I can't see any unawaited calls to pumpAndSettle

@jonsamwell
Copy link
Owner

Actually I think this is solved by this PR #230

You could try that branch and see if you experience the same issue

@amitkumar-qa
Copy link
Author

@jonsamwell Yes might be, leme try this branch

@jonsamwell
Copy link
Owner

@amitkumar-qa could you give this a go in the latest rc relesae 3.0.0-rc.10?

@amitkumar-qa
Copy link
Author

@jonsamwell Sure , let me check

@jonsamwell
Copy link
Owner

Thanks

@WernerRaathAtPolymorph
Copy link

FYI If you create your own step file using the exact same code as for tap_widget_with_text_step.dart, rename all cases of tap to something like click and omit the await context.world.appDriver.waitForAppToSettle(); line, it actually succeeds.

I believe the issue here is with await context.world.appDriver.waitForAppToSettle();. @amitkumar-qa could you try this and see if it solves your issue?

@WernerRaathAtPolymorph
Copy link

I can confirm that this error happens before Scenarios as well. This issue is also intermittent. Could be a race condition?

jonsamwell added a commit that referenced this issue Jun 24, 2022
…n the pre-defined steps in favour of the implicit `pumpAndSettle` calls used in the `WidgetTesterAppDriverAdapter`.

  - Added ability to add a `appLifecyclePumpHandler` to override the default handler that determines how the app is pumped during lifecycle events.  Useful if your app has a long splash screen etc. Parameter is on `executeTestSuite`.
  - Added ability to ensure feature paths are relative when generating reports `useAbsolutePaths` on the `GherkinTestSuite` attribute

* BREAKING CHANGE: The parameters on `executeTestSuite` are now keyed to allow for the above changes
@jonsamwell
Copy link
Owner

Should be fixed in Fixed in 3.0,0-rc-11

@amitkumar-qa
Copy link
Author

Hi @jonsamwell This issue still persists in 3.0,0-rc-11 also , and its all about "context.world.appDriver.waitForAppToSettle()" , it might be because pumpandsettle is stuck if app page has infinite animation.
So @WernerRaathAtPolymorph solution mentioned above works where i need to omit waitForAppToSettle().
Thank you so much guys.
I encountered one more issue related to screenshot in 3.0,0-rc-11, have raised it separately-#235

@jonsamwell
Copy link
Owner

jonsamwell commented Jun 24, 2022 via email

@amitkumar-qa
Copy link
Author

@jonsamwell I tried with waitImplicitlyAfterAction`=true.
Even after i am getting below error

══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════ The following assertion was thrown running a test: Guarded function conflict. You must use "await" with all Future-returning test APIs. The guarded method "pumpAndSettle" from class WidgetTester was called from package:flutter_gherkin/src/flutter/adapters/widget_tester_app_driver_adapter.dart on line 42. Then, it was called from package:flutter_gherkin/src/flutter/runners/gherkin_integration_test_runner.dart on line 530. The first method had not yet finished executing at the time that the second method was called. Since both are guarded, and the second was not a nested call inside the first, the first must complete its execution before the second can be called. Typically, this is achieved by putting an "await" statement in front of the call to the first.

jonsamwell added a commit that referenced this issue Jun 29, 2022
…ng tests which can affect how frames are painted and the speed of the test run, I've removed the default value which might be responsible for #231
@jonsamwell
Copy link
Owner

@amitkumar-qa try the new rc-15 release, I've removed the default frame binding policy as it was set to benchmarking which can not schedule all frames.

@amitkumar-qa
Copy link
Author

@jonsamwell I will check and update you on this soon

jonsamwell added a commit that referenced this issue Jul 1, 2022
…on Android (thanks to @youssef-t for the solution)

  - Fix #216 - ensure step exceptions and `expect` failure results are added as errors to the json report
  - Scenarios can now have descriptions which also appear in the json reporter output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants