Forum Discussion

altus_nel's avatar
altus_nel
Contributor
11 years ago

Forcing TestComplete to touch an object even if not topmost

Hi there.



I've come accross a problem whilst testing Android toasts. The problem is as follows. For a given screen (activity) if certain information is not entered while navigatiing away from the object, a toast is generated by the application informing the user of required information. Now, I want this to happen since i can then use a region checkpoint to verify that the toast is displayed. 



The problem that i have now is, is that TestComplete does not want to navigate to another control since it seems to think that the activity has been moved to the background (which it isn't).



Is there a way to force TestComplete to touch the control even if it's not topmost?
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Altus,

     


    Try calling the Refresh method of one of the parent objects after the toast message appears, but before you start working with it.


     

  • HI Tanya,



    Thanks for the reply. Alas, refreshing the parent object does not resolve the issue. Still cannot the "touch" the object.



    However, a workaround for this is to simply simulate a touch (with x y coordinates) somewhere on the screen (Device Touch). This removes the toast for the object and allows normal ineraction with the other objects.



    Thanks for taking the time to reply to this. 



    Regards.
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Altus,

     


    I'm glad that you found a way to overcome this situation. I have one more suggestion for you - try calling the WaitActivity method to wait until the toast disappears, and you can continue executing a test.


     

  • Hi Tanya,



    Unfortunately the WaitActivity will also not yield any result since the toast is only dismissed when data is entered for the applicable EditText android control. 



    If i do come across something (other than the workaround) I'll be sure to post it here since i'm sure this will be something that other testers will be running into as well at some point in time.



    Best Regards.