Skip to content

Better API for triggering SemanticsActions in tests #112413

@goderbauer

Description

@goderbauer

The API to trigger semantics actions from tests right now is not very discoverable:

tester.binding.pipelineOwner.semanticsOwner!.performAction(detectorId, SemanticsAction.scrollLeft);

Instead of requiring developers to figure that out, we should provide an easier way. Similarly to WidgetTester.tap [1] and WidgetTester.tapAt [2] we should provide a simple API on WidgetTester itself to trigger semantics actions in tests based on finders. With such an API, people could be writing something like the following in their tests:

  await tester.performSemanticsAction(find.text('click me'), SemanticsAction.tap);

[1] https://master-api.flutter.dev/flutter/flutter_test/WidgetController/tap.html
[2] https://master-api.flutter.dev/flutter/flutter_test/WidgetController/tapAt.html

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)a: multi windowIssues related to multi window supporta: tests"flutter test", flutter_test, or one of our testsframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework team

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions