Flutter: Integration testing. Is it possible to visualize taps and scrolls? - flutter

As far as I can see, integration tests are good for running on a device and see how my program behaves.
The problem is that it runs too fast and I can't see anything.
I came up with solution to set await Future.delayed(Duration(seconds: 3)); in setUpAll() and after any significant action to at least see what is happenning on the screen.
Can I also see Driver taps and scrolls simulation somehow?
I tried to enter Developer Settings on my Emulator and turn on "Show taps" and "Pointer location", but it doesn't help. It shows only real taps by mouse cursor and not by FlutterDriver.

Related

How to automate native features (like take image in camera) or pop-ups (tapping on allow or deny) in flutter integration testing

Every time I log in to my flutter app using integration test script "Allow user to access contact" pop up will be displayed which is a native component. I could not access or tap those pop ups using flutter test driver. Is there a way to automate those process or any work around for it?
Native pop ups cant be handled in integration test except to simulate a tap at a specific position.. or may be give a timer for you to manually click on that pop up..
await tester.pump(Duration(seconds: 15));

How to detect hardware key taps?

I am at a point where I need to detect if any of the hardware buttons was presses when the flutter app is in foreground or when it is open.*
For example, when someone presses a volume or another button (even if it is the power off one) I want to perform some action in my app.
I know that when a flutter app is open and I am looking at the app logs and I tap any hardware button is tapped the lops related to that tap is printed in the logs.
Like when I press Vol down Key Down Tap Detected related logs are printed in logs.
How do can I perform a function when any of the above specified action is performed?
New plugin called Hardware Buttons was released just a few days ago.
It supports volume button events and power button events, which seems like fits your need.
Maybe have a go with this?
You will need find the proper flutter packages to do so.
Any system level call needs to use the platform channel api
https://flutter.io/platform-channels/
Here is the repository
https://pub.dartlang.org/flutter/
Here is an example of a method channel.
https://github.com/flutter/plugins/blob/master/packages/device_info/lib/device_info.dart
Here is an example of a stream listener.
https://github.com/flutter/plugins/tree/master/packages/sensors
The stream listener wasn't really well documented when I tried to grab mic fragments.

click action not performed due to Softkeyboard enable(Hide the keyboard also its not working) but test is passed

I tried get login into my account using this capabilities
Android version-7.0
Appium version - 1.71
java-client - 5.8.0
selenium-standalone server -3.52.0
1.first username, password entered successfully using selenium
2.while entering password soft keyboard was enabled but I did hide keyboard also
3.But I clicked login but it is passed but where it is clicked I don't know
(I thought it might be soft keyboard issue)
Please let me know why the action not performed.
Is a native app, hybrid, web? Paste what you got until now...
Anyway, if you searched the element before the software keyboard is hidden and you try to click it after the keyboard is not longer visible... Then you could have a problem.
Add a delay for a few seconds and search again for the element and try clicking
What are you using to hide keyboard? I guess -> driver.hide_keyboard() method? Have you tried doing click at X, Y coordinates like 10,10 that are obviously out of the keyboard(for example...). Or have you tried simulating terminal back button? -> driver.back()
If 1. and 2. are not working, why don't you try with capabilities -> 'unicodeKeyboard' and 'resetKeyboard' setted to true?
You will need to provide more information to be able to help. Then I will edit my answer with code and examples

On Android or iOS - how to approach the possibility of a service or app going into a broken state

...and this broken state persisting until a device restart, since a naive attempt to restart an app would not work. Many users are not savvy enough to know how to terminate services/backgrounded apps. If the user can't (or doesn't 'need to') close apps, then what about restarting apps which have gone wrong? ( It can happen :) ) If my app goes wrong on someone's phone and they cannot easily restart the app without restarting the phone, that seems like a problem. I am aware that apps and services can be terminated by navigating system menus or double tapping the home button etc. but - many users are not aware of these features. For this reason I am thinking of adding an explicit close button to my app which will kill everything to the best of my ability, such that on a subsequent launch the program runs from the beginning again. I realise this is not the 'recommended' approach. Thoughts?
Thoughts?
Don't do it. Instead you should put a FAQ entry on your apps website that says.
Q: My app does not run anymore. HELP!
A: First you should try to restart the app. If that doesn't work feel
free to contact me.
Here is how you do this on the iPhone,
iPad or iPod.
double press the home button. the
multi tasking bar appears.
[ some screen shots ]
long press the app icon and press the
little x that appears on the icon.
[ more screenshots ]
If you want to put buttons for functions that are not obvious for many users you end up with a button for everything. And I (as somebody who knows every function) don't want a button cluttered user interface.
You would be surprised how many emails I get about "how can I zoom?" (A: Pinch your fingers) or "how do I delete an entry (in a tableview)" (A: Swipe your finger over the entry from left to right, and press the red delete button).
If I get an email about this I just point them to the faq which has some nice screenshots.
Btw, if the "broken state" happens so often that you would consider adding a special button I would check my code for bugs again.

dismissModalView crash iphone app, but not with debugger on

I have an iphone app with a modal view. The app crashes when the modal view get dismissed.
As soon as the modal disappear at the bottom of the screen, and consequently the original view is shown behind, then the app crashes with no entry in console view.
I have tried to switch debugger on and I discovered that the app just run fine, with no crashes at all.
-First, I would like to know why such behaviour, shouldn't the debugger sit just on top without "disturbing" the app ?
-Second, without debugger, can you point out what should I look at to solve my problem ? Or if you encounter something similiar ? Please be as much specific you can, because I am not an expert in objective-c programming.
I don't know what details to give you, the app is a normal one with standard iphone component, but for start I can say the modal view (which is built with IB) is called inside a NavigationBar system.
thanks
When these types of things happen, it is almost always because of memory allocation issues. The first step I would take is to do a "Clean All" and a "Build and Analyze", and look at all the analysis warnings. Analyze is very good at finding basic "use before allocate", "use after deallocate", or "wrong number of retains/releases" types of problems.
The next step is to turn on "Zombie" detection mode, which looks for accesses on memory that has already been deleted (in other words, killed objects coming back from the dead.) To do this, get info on your executable, go to the Arguments tab, and add a "variable to be set in the environment" of "NSZombieEnabled" to value "YES". Then look in the console when you run to see if something looks off.
Finally, you might try creating a new configuration where you use all the release mode settings for optimization, but add debug symbols. Maybe that will shake up the allocation disbursement in memory enough to trigger the bug in debug mode.