我正在使用 FlutterGherkin。
我正在尝试测试一个 DropdownButton,但是即使之前的测试已验证子项 (DropdownMenuItem) 存在,对项目的点击测试也会失败。
我的个人步骤:
... previous steps to make appear the DropdownButton
Then I have an "EntityDropdownButton" # succeed
When I tap the "EntityDropdownButton" button # succeed
Then I have a "entityN1DropdownMenuItem" # succeed
When I tap the "entityN1DropdownMenuItem" button # fail
我发现了这个错误:
TimeoutException after 0:00:10.000000: Future not completed
我的功能是基本的,基于这些方法:
find.byValueKey
FlutterDriverUtils.isPresent
FlutterDriverUtils.tap
但即使我使用的是预先编码的步骤:
... previous steps to make appear the DropdownButton
Then I have an "EntityDropdownButton" # succeed
When I tap the "EntityDropdownButton" button # succeed
Then I expect the text "entityN1" to be present # succeed
Then I tap the element that contains the text "entityN1" # fail
我发现了这个错误:
Exception: DriverError: Error in Flutter application: Uncaught extension error while executing scrollIntoView: Bad state: Too many elements
#0 Iterable.single (dart:core/iterable.dart:656:24)
#1 CommandHandlerFactory._scrollIntoView (package:flutter_driver/src/common/handler_factory.dart:402:54)
<asynchronous suspension>
#2 FlutterDriverExtension.call (package:flutter_driver/src/extension/extension.dart:372:31)
<asynchronous suspension>
#3 BindingBase.registerServiceExtension.<anonymous closure> (package:flutter/src/foundation/binding.dart:856:18)
<asynchronous suspension>
#0 VMServiceFlutterDriver.sendCommand (package:flutter_driver/src/driver/vmservice_driver.dart:341:7)
<asynchronous suspension>
#1 FlutterDriver.scrollIntoView (package:flutter_driver/src/driver/driver.dart:402:5)
<asynchronous suspension>
#2 TapWidgetWithTextStep.<anonymous closure> (package:flutter_gherkin/src/flutter/steps/tap_widget_with_text_step.dart:18:7)
<asynchronous suspension>
#3 Future.timeout.<anonymous closure> (dart:async/future_impl.dart:871:15)
<asynchronous suspension>
#4 StepDefinitionGeneric.run.<anonymous closure> (package:gherkin/src/gherkin/steps/step_definition.dart:42:26)
<asynchronous suspension>
#5 Perf.measure (package:gherkin/src/utils/perf.dart:11:14)
<asynchronous suspension>
#6 StepDefinitionGeneric.run (package:gherkin/src/gherkin/steps/step_definition.dart:37:7)
<asynchronous suspension>
#7 FeatureFileRunner._runWithinTest (package:gherkin/src/feature_file_runner.dart:365:22)
<asynchronous suspension>
#8 FeatureFileRunner._runStep (package:gherkin/src/feature_file_runner.dart:334:16)
<asynchronous suspension>
#9 FeatureFileRunner._runScenario (package:gherkin/src/feature_file_runner.dart:256:24)
<asynchronous suspension>
#10 FeatureFileRunner._runScenarioInZone.<anonymous closure> (package:gherkin/src/feature_file_runner.dart:149:24)
<asynchronous suspension>
我的问题是,如果点击一个被测试为存在的按钮不起作用,如何能够用它的孩子测试下拉菜单?