Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get text from raised buttons using flutter_driver(QA environment) #16013

Open
deonchimple opened this issue Mar 28, 2018 · 10 comments

Comments

@deonchimple
Copy link

@deonchimple deonchimple commented Mar 28, 2018

Steps to Reproduce

Trying to get text from raised buttons throws an exception. While driver.getText(....) works mostly fine with other widgets, raised button seems to be causing some issues.

Logs

DriverError: Error in Flutter application: Uncaught extension error while executing get_text: type 'MyButton' is not a subtype of type 'Text' of 'text' where
   MyButton is from package:maui/games/match_the_following.dart
   Text is from package:flutter/src/widgets/text.dart

 #0      FlutterDriverExtension._getText (package:flutter_driver/src/extension/extension.dart:333)
 <asynchronous suspension>
 #1      FlutterDriverExtension.call (package:flutter_driver/src/extension/extension.dart:168)
 <asynchronous suspension>
 #2      BindingBase.registerServiceExtension.<anonymous closure> (package:flutter/src/foundation/binding.dart:370)
 <asynchronous suspension>
@Hixie

This comment has been minimized.

Copy link
Contributor

@Hixie Hixie commented Jun 12, 2018

Can you include a reduced example? The app code and driver code that shows the problem? Thanks.

@dbenninger

This comment has been minimized.

Copy link

@dbenninger dbenninger commented Aug 6, 2018

I have got the same problem, but with a TextField. It seems that getText only works with the Text component:

DriverError: Error in Flutter application: Uncaught extension error while executing get_text: type 'TextField' is not a subtype of type 'Text'

Example code:
...

children: <Widget>[
          new Text(
            'Client private key:',
          ),
          new TextField(
              key: Key('private key field'), controller: _privateKeyController),
          new Text(
            'Client public key:',
          ),

...

test code:
...

test('can generate key pair', () async {
      await driver.traceAction(() async {
        var privateKey = await driver.getText(find.byValueKey('private key field'));

...

@no-response no-response bot closed this Aug 6, 2018
@no-response

This comment has been minimized.

Copy link

@no-response no-response bot commented Aug 6, 2018

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.
cc @Hixie

@Hixie

This comment has been minimized.

Copy link
Contributor

@Hixie Hixie commented Aug 6, 2018

Overzealous bot.

@PauloKeller

This comment has been minimized.

Copy link

@PauloKeller PauloKeller commented May 27, 2019

Maybe I facing the same issue with TextFormFields:

DriverError: Error in Flutter application: Uncaught extension error while executing get_text: type 'TextFormField' is not a subtype of type 'Text'

Some solution!?

@sceee

This comment has been minimized.

Copy link

@sceee sceee commented Jun 25, 2019

I am facing the same issue with RichText:

DriverError: Error in Flutter application: Uncaught extension error while executing get_text: type 'RichText' is not a subtype of type 'Text'

In general it would be great to have a driver.getWidget(finder) method that would allow to access some properties of the returned "widget" that could allow manual comparison of some content of the widget.

@DK15

This comment has been minimized.

Copy link

@DK15 DK15 commented Jul 18, 2019

@deonchimple I just ran a test to validate raised button text using find.text() and it worked for me.

Here's what I did:

home: Center(
          child: RaisedButton(
            onPressed: () {},
            child: Text('Click me'),
          ),
        )

And test:

test('test raisedbutton text', () async {
        final SerializableFinder buttonTextFinder = find.text('Click me');

        await driver.waitFor(buttonTextFinder);
        await driver.tap(buttonTextFinder);
        print('button clicked');
      });

Result:

Screen Shot 2019-07-18 at 5 06 40 PM

@AnhPhamIT

This comment has been minimized.

Copy link

@AnhPhamIT AnhPhamIT commented Aug 22, 2019

Same issue for me with TextFromField
main.dart

new TextFormField(
key: new Key('welcome'),
decoration: new InputDecoration(labelText: 'welcome ...'),
validator: (val) =>
val.isEmpty ? 'Welcome can\'t be empty.' : null,
),

test_driver\home_test.dart
await driver.getText(txtFinder);

Error:
Exception: DriverError: Error in Flutter application: Uncaught extension error while executing get_text: type 'TextFormField' is not a subtype of type 'Text'

Is there any solution for this?

@ManojMM026

This comment has been minimized.

Copy link

@ManojMM026 ManojMM026 commented Sep 4, 2019

Anything on TextFormField ?

@bscottsmith

This comment has been minimized.

Copy link

@bscottsmith bscottsmith commented Sep 10, 2019

I am also having this issue:

DriverError: Error in Flutter application: 
    Uncaught extension error while executing get_text: 
        type 'EditableText' is not a subtype of type 'Text'

This makes it impossible for me to test/verify the "initialValue:" of a TextFormField.
I also feel like this is a bug, not a "new feature"...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.