how to detect flutter red screen in appium?

369 Views Asked by At

so, I am using appium inspector to write a script for mobile testing for a school project.

my problem is that I don't know how to detect this red screen resulted for flutter app.

this image is just example for what I mean :

enter image description here

so I want to write in my scripts whenever the result is this red error screen, fail the test.

but the red screen in appium inspector is just a normal android view with no access to the text displayed, so how can I write automated test for it if I don't have a unique identifier for these screens ?

and these are the visible attributes for me in appium inspector for the shown red screen:

Attribute Value
elementId 00000000-0000-07a4-0000-006700000011
index 1
package com.example.sw_code
class android.view.View
text resource-id
checkable false
checked false
clickable false
enabled true
focusable false
focused false
long-clickable false
password false
scrollable false
selected false
bounds [0,294][1440,2579]
displayed true
1

There are 1 best solutions below

0
On

Flutter UI attributes are not visible to Appium's UiAutomator2 or XCUITest drivers that we typically use to automate Android and iOS applications respectively.

For this reason, Appium folks have created a separate driver to test flutter based applications. Check it out here: https://github.com/appium-userland/appium-flutter-driver

Note that this driver is in experimental phase. You will need to weigh pros and cons and go for this driver.

The other option is to use flutter's own flutter driver (link: https://docs.flutter.dev/testing), but know that it needs Dart programming language.