Commit graph

650 commits

Author SHA1 Message Date
Hans Muller a9b965cb9b Gallery demo start-time performance test (#3655)
*  Gallery demo start-time performance test
2016-05-03 17:37:10 -07:00
Ian Hickson 4b401a3e75 Track the worst frame in perf tests (#3642)
* Track the worst frame in perf tests

* Use backticks in "/// Returns `null` if"
2016-05-03 14:00:10 -07:00
Devon Carew c9010c91f6 fix analysis errors (#3677)
* fix analysis errors

* review comments; fix test

* re-add an export for debugPrint
2016-05-03 09:09:00 -07:00
Ian Hickson 91dd969966 Refactor the test framework (#3622)
* Refactor widget test framework

Instead of:

```dart
  test("Card Collection smoke test", () {
    testWidgets((WidgetTester tester) {
```

...you now say:

```dart
  testWidgets("Card Collection smoke test", (WidgetTester tester) {
```

Instead of:

```dart
  expect(tester, hasWidget(find.text('hello')));
```

...you now say:

```dart
  expect(find.text('hello'), findsOneWidget);
```

Instead of the previous API (exists, widgets, widget, stateOf,
elementOf, etc), you now have the following comprehensive API. All these
are functions that take a Finder, except the all* properties.

* `any()` - true if anything matches, c.f. `Iterable.any`
* `allWidgets` - all the widgets in the tree
* `widget()` - the one and only widget that matches the finder
* `firstWidget()` - the first widget that matches the finder
* `allElements` - all the elements in the tree
* `element()` - the one and only element that matches the finder
* `firstElement()` - the first element that matches the finder
* `allStates` - all the `State`s in the tree
* `state()` - the one and only state that matches the finder
* `firstState()` - the first state that matches the finder
* `allRenderObjects` - all the render objects in the tree
* `renderObject()` - the one and only render object that matches the finder
* `firstRenderObject()` - the first render object that matches the finder

There's also `layers' which returns the list of current layers.

`tap`, `fling`, getCenter, getSize, etc, take Finders, like the APIs
above, and expect there to only be one matching widget.

The finders are:

 * `find.text(String text)`
 * `find.widgetWithText(Type widgetType, String text)`
 * `find.byKey(Key key)`
 * `find.byType(Type type)`
 * `find.byElementType(Type type)`
 * `find.byConfig(Widget config)`
 * `find.byWidgetPredicate(WidgetPredicate predicate)`
 * `find.byElementPredicate(ElementPredicate predicate)`

The matchers (for `expect`) are:

 * `findsNothing`
 * `findsWidgets`
 * `findsOneWidget`
 * `findsNWidgets(n)`
 * `isOnStage`
 * `isOffStage`
 * `isInCard`
 * `isNotInCard`

Benchmarks now use benchmarkWidgets instead of testWidgets.

Also, for those of you using mockers, `serviceMocker` now automatically
handles the binding initialization.

This patch also:

* changes how tests are run so that we can more easily swap the logic
  out for a "real" mode instead of FakeAsync.

* introduces CachingIterable.

* changes how flutter_driver interacts with the widget tree to use the
  aforementioned new API rather than ElementTreeTester, which is gone.

* removes ElementTreeTester.

* changes the semantics of a test for scrollables because we couldn't
  convince ourselves that the old semantics made sense; it only worked
  before because flushing the microtasks after every event was broken.

* fixes the flushing of microtasks after every event.

* Reindent the tests

* Fix review comments
2016-04-29 13:23:27 -07:00
Devon Carew 50b1b16db6 rev test to 0.12.13+1 to support 1.17.0-dev dart sdks (#3613) 2016-04-28 12:56:55 -07:00
Ian Hickson e968d91ca4 Rename binding abstract classes (#3482)
The old names were getting silly and started stepping on valuable namespace.

The new names are consistent and clear.
2016-04-21 17:18:46 -07:00
Ian Hickson 0e11b0e6e3 Make the widgets binding reusable. (#3479)
Previously the widgets layer only provided a concrete binding, which
makes it awkward to extend it compared to other bindings. This moves
widgets to the same style as the other layers.

In a subsequent patch I'll use this to make the tests layer saner.
2016-04-21 16:06:51 -07:00
Ian Hickson b7af64ee50 Refactor TestGesture (#3461)
Moves TestGesture into test_pointer.dart and makes it more
self-contained.

This is part of a general refactoring of flutter_test.

Depends on https://github.com/flutter/flutter/pull/3459
2016-04-21 13:18:02 -07:00
Yegor 7fe7de3f12 [driver] fix a race in finder logic (#3444) 2016-04-20 15:26:09 -07:00
Ian Hickson 261923e5c6 Refactor service extensions (#3397)
Bindings now have a debugRegisterServiceExtensions() method that is
invoked in debug mode (only). (Once we have a profile mode, there'll be
a registerProfileServiceExtensions() method that gets called in that
mode only to register extensions that apply then.)

The BindingBase class provides convenience methods for registering
service extensions that do the equivalent of:

```dart
void extension() { ... }
bool extension([bool enabled]) { ... }
double extension([double extension])  { ... }
Map<String, String> extension([Map<String, String> parameters]) { ... }
```

The BindingBase class also itself registers ext.flutter.reassemble,
which it has call a function on the binding called
reassembleApplication().

The Scheduler binding now exposes the preexisting
ext.flutter.timeDilation.

The Renderer binding now exposes the preexisting ext.flutter.debugPaint.

The Renderer binding hooks reassembleApplication to trigger the
rendering tree to be reprocessed (in particular, to fix up the
optimisation closures).

All the logic from rendering/debug.dart about service extensions is
replaced by the above.

I moved basic_types to foundation.

The FlutterWidgets binding hooks reassembleApplication to trigger the
widget tree to be entirely rebuilt.

Flutter Driver now uses ext.flutter.driver instead of
ext.flutter_driver, and is hooked using the same binding mechanism.
Eventually we'll probably move the logic into the Flutter library so
that you just get it without having to invoke a special method first.
2016-04-19 10:53:58 -07:00
Yegor e7657b9462 [driver] "waitFor" command in place of broken "exists" (#3373)
* [driver] "waitFor" command in place of broken "exits"

* [driver] wait using frame callback
2016-04-19 09:49:22 -07:00
Yegor 9ce995f65e [driver] refactor API to finder objects (#3365) 2016-04-15 16:57:35 -07:00
Yegor 0e9737e4cc [driver] upgrade to the latest version of vm_service_client (#3348) 2016-04-14 23:23:45 -07:00
Yegor 86597cd10d [driver] lock vm_service_client
until we have a fix for the breaking changes
2016-04-14 16:26:17 -07:00
Yegor d5d4e7c054 [driver] output per-frame build times in the timeline summary (#3334) 2016-04-14 11:28:16 -07:00
Eric Seidel 341bd47624 Move flutter drive to use 8183 to not conflict with diagnostic server
When @jason-simons added the diagnostic server on Android this
happened to conflict with flutter drive's usage of 8182.

We really should fix both of these port users to be dynamic
but this fixes https://github.com/flutter/flutter/issues/3291
for now.

@yjbanov
2016-04-13 11:22:38 -07:00
Seth Ladd f43e1dfaff Fix instruction when app is missing enableFlutterDriverExtension (#3239) 2016-04-11 09:17:51 -07:00
Seth Ladd 3e661965c2 de-dupe API docs in flutter_driver (#3240) 2016-04-11 09:11:32 -07:00
Yegor 99e916d0e2 [driver] fix analyzer warnings in the extension (#3205) 2016-04-07 17:33:17 -07:00
Yegor f697f58ccd [driver] fix match state hand-off in matcher_util.dart (#3103)
Fixes https://github.com/flutter/flutter/issues/3094
2016-04-07 10:08:14 -07:00
Yegor 19e624ccfe [driver] give the timeline data some structure
Fixes https://github.com/flutter/flutter/issues/2713
2016-04-04 17:07:16 -07:00
Yegor 055fd00dc1 Merge pull request #3058 from yjbanov/timeline-summary
[driver] utility for extracting and saving timeline summary
2016-04-01 17:48:25 -07:00
Devon Carew 18d29583d0 pubspec normalization; remove den 2016-04-01 08:33:22 -07:00
Yegor Jbanov 18aed70e1c [driver] switch to different pause event workaround 2016-03-30 22:41:31 -07:00
Devon Carew d5cccf5cd6 rev mockito; remove deprecated uses 2016-03-30 09:10:50 -07:00
Devon Carew 89143313cb Merge pull request #2981 from devoncarew/no_symlinks
run pub with --no-package-symlinks
2016-03-29 19:25:04 -07:00
Devon Carew fe37825fd5 run pub with --no-package-symlinks 2016-03-29 19:02:14 -07:00
Yegor Jbanov bfa16b2b5d [driver] fix observatory port # and timeline data extraction
The way we pick observatory port # has changed and we have broken
logic that handles port 8181. To fix the buildbot, switch to port
8182. We can later figure out what we want to do when we clean up
port handling.

The old VM extention for extracting the timeline data is gone.
Switch to the new '_getVMTimeline' API.
2016-03-29 13:53:40 -07:00
Yegor Jbanov 8aac1c996c [driver] actually start the timer when connecting 2016-03-18 14:38:34 -07:00
yjbanov 26c4177360 [driver] API for getting performance traces 2016-03-14 16:15:18 -07:00
Hixie 797e27edd3 Add @override annotations to flutter framework 2016-03-14 14:02:26 -07:00
Ian Hickson 62f3124e66 Fix generic method syntax. 2016-03-14 10:33:01 -07:00
Ian Hickson d745e20853 Even more types 2016-03-14 09:41:54 -07:00
Hixie 6795efacab Enable always_specify_types lint
And fix the zillion issues that uncovered.
2016-03-12 00:37:31 -08:00
Ian Hickson 43b0104114 Revert "Merge pull request #2639 from Hixie/always_specify_types"
This reverts commit f41b3411da, reversing
changes made to e33d8d9621.

This was a bad check-in due to my mangling uploading a new version of the branch from a different machine.

This reverts https://github.com/flutter/flutter/pull/2639 and will be replaced by https://github.com/flutter/flutter/pull/2640
2016-03-12 00:34:37 -08:00
Hixie d162d98c79 Enable always_specify_types lint
And fix the zillion issues that uncovered.
2016-03-11 18:27:32 -08:00
Ian Hickson 1b9cd52081 Enable ALL THE LINTS
Well, all the easy ones, anyway.

For some reason `// ignore:` isn't working for me so I've disabled
lints that need that. Also disabled those that require a ton of work
(which I'm doing, but not in this PR, to keep it reviewable).

This adds:
- avoid_init_to_null
- library_names
- package_api_docs
- package_names
- package_prefixed_library_names
- prefer_is_not_empty
- sort_constructors_first
- sort_unnamed_constructors_first
- unnecessary_getters_setters
2016-03-10 23:15:31 -08:00
Hixie c7339de6bc Enable always_declare_return_types lint
And fix a zillion omissions this uncovered.
2016-03-09 17:57:39 -08:00
yjbanov 008785be8f [driver] serialize commands to plain strings
Turns out VM service only accepts flat parameter name/value pairs. It
only worked this far because vm_service_client (mistakenly) uses JSON
encoder to encode parameters.

This change separates the Command type hierarchy from that of Result and
tightens type constraints on Command object parameters.
2016-03-02 18:01:16 -08:00
yjbanov ee184a7821 driver.scroll action; scroll perf test for Stocks 2016-03-02 17:13:49 -08:00
Yegor Jbanov 44d7a577e0 [driver] wait for the isolate to enter pause on start 2016-03-02 15:58:01 -08:00
Yegor Jbanov 6d35481cfa add smoke driver test; find by tooltip; retry predicate 2016-02-29 16:50:47 -08:00
yjbanov 6a1f47a532 factor out enum indexing into reusable EnumIndex 2016-02-29 16:50:47 -08:00
Hixie e5087d4dd4 Remove some prints in tests. 2016-02-26 11:07:55 -08:00
yjbanov d2c94990fa deflake retry_test.dart (using FakeAsync) 2016-02-24 13:58:59 -08:00
Chinmay Garde 54daeaa252 Disable flaky retry_test 2016-02-24 13:40:31 -08:00
yjbanov 7f39703759 support waiting for things to happen in Flutter Driver 2016-02-24 10:01:00 -08:00
yjbanov a2b1bd4673 "flutter drive" command
Runs a test app and a driver test simultaneously, then stops the app.

Usage:

```
flutter drive --target=/path/to/test/app.dart
```

This command will look for `/path/to/test/app_test.dart` by
convention. We will expand into other ways of discovering tests in the
future.
2016-02-19 18:11:53 -08:00
yjbanov 439aadf4e4 move to pub version of vm_service_client 2016-02-17 18:02:18 -08:00
Yegor Jbanov b0e4559459 add flutter_driver package
This commit contains:

- FlutterDriver API for e2e tests usable in conjunction with package:test
- FlutterDriverExtension to be enabled by the application in order to
  allow an external agent to connect to it and drive user interactions and
  probe into the element tree
- initial implementations of tap, findByValueKey and getText commands (to
  be expanded in future PRs)
2016-02-17 18:02:18 -08:00