-
Notifications
You must be signed in to change notification settings - Fork 27.2k
-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
flutter_driver's finders should have the equivalent of flutter_test's Finder.evaluate() #15852
Comments
What about See also
|
@zoechi Unfortunately all this does is wait for the element but doesn't necessarily check if the element is visible/ present (Ideally returning a boolean value). For instance when I am searching for an element, I would like to give a condition which would go to the next element if the current element isn't found. This requires a boolean function like Ispresent, IsEmpty, isVisible available in Appium and selenium. |
@deonchimple can you not assume that if the wait times out that the element is not in the widget tree? If so you could do something like this. Future<void> testStep() async {
final isOpen = await isPresent(find.byType("Drawer"), driver);
if (isOpen) {
...
}
}
Future<bool> isPresent(SerializableFinder finder, FlutterDriver driver, {Duration timeout = const Duration(seconds: 1)}) async {
try {
await driver.waitFor(finder, timeout: timeout);
return true;
} catch (e) {
return false;
}
} |
@jonsamwell Yep! I've been doing something almost exactly like that and it generally works, but I agree |
await driver.waitForAbsent(loginButton); |
Being able to do the equivalent of "Finder.evaluate()" in a driver test would make sense. |
But using that function;
causes an error log like that |
FlutterDriver does not exist in Flutter 2.5.... |
Steps to Reproduce
Using flutter_driver in the QA environment. Options feels quite limited currently. I am trying to check if an element exists or not, perhaps a function on the like of finder.IsEmpty or something like IfExists in Appium which the skips the element if it doesn't exist and doesn't necessarily throw an exception.
Logs
Application runs fine. Just looking for more functionalities of flutter driver.
Flutter Doctor
The text was updated successfully, but these errors were encountered: