Calling scenario

because if we are running 5 test cases and in that 1 test case fails the other will not execute as the time stamp or you can say it has the sleep time doesn’t match

Are you using grid to control both devices in same test?

I have a similar test in my suite (cucumber):

Scenario Outline: Call 
...
Then I initiate the call - <device>
Then I answer the call - <secondary_device>
And I wait for 6 seconds - <secondary_device>
Then I terminate the call - <device>
...
 Examples:
    | device      | secondary_device |
    | Android A   | Android B        |

Each step received what device should be doing that action.

You should have both devices on same laptop or at least being controlled from same code.

Set your command time out capability to 2 hours, p.e.:

capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 7200);

And your sleep should not break.

In order to identify an incoming call, as far as I know you will have to look for some element on that screen, like the answer button (example button from a samsung, you will have to use native ids, so it differs from device to device):

do {
    Thread.sleep(10000);
} while (driver.findElementsById("com.android.incallui:id/popup_call_answer").size()==0);

This is far from advisable. If same code controls both devices you know when device A starts the call and so you just order B to answer it.

Edit - You should have some counter inside that loop in order to break from there after a time to define, if not it can be trap in there forever if device A call never arrives.

Using the grid, just look around.

https://appiumforbeginners.wordpress.com/2016/03/24/appium-grid-on-android-devices/

Huge discussion here on forum about it:

1 Like