Add getSemanticsId command to flutter_driver#19047
Add getSemanticsId command to flutter_driver#19047jonahwilliams merged 10 commits intoflutter:masterfrom
Conversation
| return new ByType(json['type']); | ||
| } | ||
| } | ||
|
|
| } | ||
|
|
||
|
|
||
| /// A Flutter driver command that retrieves a semantics id using a specified finder. |
There was a problem hiding this comment.
mention here as well that it might be the semantics information from an ancestor?
|
Tests added |
| /// then the semantics node of the first ancestor is returned instead. | ||
| /// | ||
| /// If the finder returns multiple objects, or there are no semantics nodes then | ||
| /// a [StateError] is thrown by the extension. |
There was a problem hiding this comment.
Do we define anywhere what "the extension" is? Or is it just an implementation detail that the error is thrown by the extension and we should maybe omit that detail from documentation?
There was a problem hiding this comment.
An error thrown on the app side becomes an error thrown in the driver script, it isn't necessary to mention that is thrown on the device so i will omit this part
| return result.changedState; | ||
| } | ||
|
|
||
| /// Retrieves the semantics node id for the object returned by [finder], or |
There was a problem hiding this comment.
I believe arguments mentioned in doc comments should be enclosed in `` instead of [] unless the argument is also a field on the class.
(here and below)
| /// Semantics must be enabled to use this method, either using a platform | ||
| /// specific shell command or [setSemantics]. | ||
| Future<int> getSemanticsId(SerializableFinder finder, { Duration timeout = _kShortTimeout}) async { | ||
| final GetSemanticsIdResult result = GetSemanticsIdResult.fromJson(await _sendCommand(new GetSemanticsId(finder, timeout: timeout))); |
There was a problem hiding this comment.
nit: maybe add some line breaks to this line to make it easier to read?
| RenderObject renderObject = element.renderObject; | ||
| SemanticsNode node; | ||
| while (renderObject != null && node == null) { | ||
| node = renderObject.debugSemantics; |
There was a problem hiding this comment.
Just to be sure: It's guaranteed that drive tests always run with asserts enabled? Otherwise debugSemantics would be null even when semantics are enabled.
There was a problem hiding this comment.
Not always (microbenchmarks), but for these integration tests we'll always be using a debug build. Added doc comment to the command.
Forked from https://github.com/flutter/flutter/pull/19005/files