mercredi 16 décembre 2020

Flutter driver: cant find element (text) on the screen

The element I need to find is situated (in the child element):

 static Widget _buildProjectCategoryWidget(BuildContext context, String name) {
final themeData = Theme.of(context);
final primaryTextTheme = themeData.primaryTextTheme;
return Container(
  padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 5.0),
  decoration: BoxDecoration(borderRadius: BorderRadius.circular(13.0), color: FlAppStyles.altButtonColor),
  child: Text(name, style: primaryTextTheme.textSmall),
);

I tried to find the child element with this, but I have DriverError: Failed to fulfill Tap due to remote error:

SerializableFinder message = find.text("mytext");
    await driver.waitFor(message);
    expect(await driver.getText(message), "mytext"); await driver.tap(buttonChangeProfession);
    

Im a beginner to flutter integration testing, dont know what is wrong, please help. I also tried adding a key and find element by it, but the point is I need to find the text of that element.

Aucun commentaire:

Enregistrer un commentaire