Skip to content

Can't tap items in the drawer when using integration tests #23007

@georgeherby

Description

@georgeherby

So i am currently writing some intergration tests for my first app (just a random poc) and i open the drawer with the test. But i cannot click on the item in the drawer, i have tried doing with a tool tip or a keyvalue neither work it just stops running and fails the test with this message:

DriverError: Error in Flutter application: Timeout while executing tap: TimeoutException after 0:00:05.000000: Future not completed

Steps to Reproduce

This is the code with the Drawer in it

@override
  Widget build(BuildContext context) {
    return new Scaffold(
        drawer: Drawer(
          child: ListView(
            // Important: Remove any padding from the ListView.
            padding: EdgeInsets.zero,
            children: <Widget>[
              DrawerHeader(
                child: Text('ACCOUNT DETAILS'),
                decoration: BoxDecoration(
                  color: Colors.blue,
                ),
              ),
              ListTile(
                leading: Icon(Icons.timeline, key: Key("icon_view_projects")),
                title: Tooltip(message: "View your projects", child: Text('View Projects')),
                onTap: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute(builder: (context) => ViewMyProjects()),
                  );
                },
              ),
            ],
          ),
        ),
        floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
        floatingActionButton: new Builder(builder: (BuildContext context) {
          return new FloatingActionButton(
              key: Key('fab_add'),
              child: new Icon(
                Icons.add,
                color: Colors.white,
                key: Key("icon_add"),
              ),
              elevation: 6.0,
              onPressed: () {
                //Navigator.pop(context);
                _openNewDialog(context);
              },
              backgroundColor: Theme.of(context).accentColor);
        }),
        appBar: new AppBar(
          actions: <Widget>[
            new Builder(builder: (BuildContext context) {
              return IconButton(
                icon: Icon(Icons.sort, key: Key("icon_sort"),),
                onPressed: () {
                  _showSortDialog(context);
                },
              );
            }),
          ],
          title: new Image.asset('images/cg_logo.png',
              fit: BoxFit.cover, height: 40.0),
          centerTitle: true,
        ),
        body: _streamBuilder());
  }

This is the intergration test

test('Open Drawer and see the options and then open window', () async {

      await driver.tap(find.byTooltip("Open navigation menu"));

      expect(await driver.getText(find.text("ACCOUNT DETAILS")), "ACCOUNT DETAILS");
      expect(await driver.getText(find.text("View Projects")), "View Projects");

      await driver.tap(find.byValueKey("icon_sort"));

      await driver.tap(find.byTooltip("Open navigation menu"));

      expect(await driver.getText(find.text("ACCOUNT DETAILS")), "ACCOUNT DETAILS");
      expect(await driver.getText(find.text("View Projects")), "View Projects");

      await driver.tap(find.byTooltip("View your projects"));   //Fails on this line

      expect(await driver.getText(find.text("Active Projects")), "Active Projects");

      await driver.tap(find.byValueKey("icon_past"));

Logs

[✓] Flutter (Channel master, v0.9.7-pre.79, on Mac OS X 10.14 18A391, locale en-GB)
    • Flutter version 0.9.7-pre.79 at /Users/george/development/flutter
    • Framework revision e4111b804b (3 days ago), 2018-10-08 23:27:20 -0400
    • Engine revision bfcdad8557
    • Dart version 2.1.0-dev.6.0.flutter-c6254163dc

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at /Users/george/Library/Android/sdk
    • Android NDK at /Users/george/Library/Android/sdk/ndk-bundle
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.0, Build version 10A255
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 26.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[✓] IntelliJ IDEA Ultimate Edition (version 2018.2.4)
    • IntelliJ at /Users/george/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 29.0.4
    • Dart plugin version 182.4323.44

[✓] Connected device (1 available)
    • iPhone X • 590008BA-75C1-4430-B24B-3F6C41F5FBC9 • ios • iOS 12.0 (simulator)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: tests"flutter test", flutter_test, or one of our testsc: crashStack traces logged to the console

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions