patrol
patrol copied to clipboard
Cannot find text inside native TextField on iOS
Steps to reproduce
- Clone https://github.com/leancodepl/patrol.git and checkout to
bug/ios-reproduce-examples - run iOS simulator, open messages and tap on tile to see conversation on the screen and message bottom bar
in patrol/dev/e2e_apprun:patrol test -t integration_test/ios_text_field_text_test.dart
Actual results
waitUntilVisible() failed
Logs
Logs
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following PatrolActionException was thrown running a test:
Patrol action failed: NativeAutomatorClientException: waitUntilVisible() failed with Invalid
response: 400 The operation couldnât be completed. (patrol.PatrolError error 0.)
When the exception was thrown, this was the stack:
#0 NativeAutomator._wrapRequest (package:patrol/src/native/native_automator.dart:226:7)
<asynchronous suspension>
#1 NativeAutomator.waitUntilVisible (package:patrol/src/native/native_automator.dart:693:5)
<asynchronous suspension>
#2 main.<anonymous closure> (file:///Users/fylyppo/Documents/GitHub/patrol/dev/e2e_app/integration_test/ios_text_field_text_test.dart:13:7)
<asynchronous suspension>
#3 patrolTest.<anonymous closure> (package:patrol/src/common.dart:130:7)
<asynchronous suspension>
#4 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:168:15)
<asynchronous suspension>
#5 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:1013:5)
<asynchronous suspension>
#6 TestWidgetsFlutterBinding._createTestCompletionHandler.<anonymous closure> (package:flutter_test/src/binding.dart:804:12)
<asynchronous suspension>
Patrol version
from branch
Patrol Doctor output
Patrol Doctor output
<!-- Replace this line with your logs. Do not remove the backticks! -->
Flutter Doctor output
Flutter Doctor output
<!-- Replace this line with your logs. Do not remove the backticks! -->
So, I investigated this issue and there are a few problems:
- the enterTextByIndex method inserts text into a TextField with newline, causing Selector(text:) without newline to always fail.
- Ios TextField keeps the current text in "value" property. However, waitUntilVisible and getNativeViews do not use this property in predicate.
- Inspector also uses NativeView model and this model lacks value and placeholderValue.